# Name (File) casing error on Darwin

**URL:** https://forum.ada-lang.io/t/name-file-casing-error-on-darwin/1795
**Category:** General
**Created:** [February 9, 2025, 10:23pm UTC](https://forum.ada-lang.io/t/name-file-casing-error-on-darwin/1795 "2025-02-09T22:23:50Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![LionelDraghi](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/lioneldraghi/32/416_2.png) [@LionelDraghi](https://forum.ada-lang.io/u/LionelDraghi)
#### Post date: [February 9, 2025, 10:23pm UTC](https://forum.ada-lang.io/t/name-file-casing-error-on-darwin/1795/1 "2025-02-09T22:23:50Z")

</div>

I am a new MacOS user, to be able to test bbt, because a user seems to have a problem with libunwind ([Testing on MacOS · LionelDraghi/bbt · Discussion #13 · GitHub](https://github.com/LionelDraghi/bbt/discussions/13)).

I installed gnatstudio (thank you Pascal), and Alire (from [https://alire.ada.dev/](https://alire.ada.dev/) because from [https://ada-lang.io/](https://ada-lang.io/) it was not the right one, probably the one for Apple silicon).

The tests went fine, almost all OK, and I coudn’t reproduce the libunwind problem (maybe because I am on an Intel platform).  
If some one has an idea, BTW…

But I had another problem, that turn to be a possible GNAT bug. When I create a file with Text\_IO giving a file name, when I then ask for it with the Name function, the name is returned in lower case.  
I understand from the GNAT code that this should happen only on windows.

The problem is (possibly) in System.File\_IO.Open, line 782 and 1007

> ```
> pragma Import (C, Get_Case_Sensitive,
> "__gnat_get_file_names_case_sensitive");
> 
> ```
> 
> …  
> File\_Names\_Case\_Sensitive : constant Boolean := Get\_Case\_Sensitive /= 0;  
> …  
> if not File\_Names\_Case\_Sensitive then  
> To\_Lower (Fullname (1 … Full\_Name\_Len));  
> end if;

Is that a known bug?

I’m running on an iMac 18.3 with an Intel I7 CPU, under Ventura 13.6.9, using gnat native 14.2.1.

---

<div class="post-metadata">

### Author: ![simonjwright](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/simonjwright/32/11_2.png) [@simonjwright](https://forum.ada-lang.io/u/simonjwright)
#### Post date: [February 9, 2025, 10:53pm UTC](https://forum.ada-lang.io/t/name-file-casing-error-on-darwin/1795/2 "2025-02-09T22:53:44Z")

</div>

There’s a bit of a saga with regard to filesystem case sensitivity on macOS ([PR81114](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81114), [PR111909](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111909))

GCC thinks that macOS filesystems are case-insensitive, which is certainly the default case. It used to be that it thought aarch64 (arm64) filesystems were case-sensitive, because on iOS they are; but since 111909 that’s been fixed, so it’s case-insensitive on either architecture.

For reasons (possibly to do with `foo.ads` and `Foo.ADS` referring to the same file), gnat and gprbuild will smash all filenames to lower-case if the filesystem is case-insensitive (which I think is what you’re seeing).

You can avoid this by setting the environment variable `GNAT_FILE_NAME_CASE_SENSITIVE` to 1.

This same problem will arise on Windows.

Best not to use international characters in filenames on these systems (see PR81114 for my take on this).

---

<div class="post-metadata">

### Author: ![Ret\_Build\_Engineer](https://forum.ada-lang.io/letter_avatar_proxy/v4/letter/r/ccd318/32.png) [@Ret\_Build\_Engineer](https://forum.ada-lang.io/u/Ret_Build_Engineer)
#### Post date: [February 9, 2025, 11:46pm UTC](https://forum.ada-lang.io/t/name-file-casing-error-on-darwin/1795/3 "2025-02-09T23:46:12Z")

</div>

I tried once to install MacOS on a preformatted case-sensitive drive. It silently reformatted it to be case-insensitive during the installation.

RBE

---

<div class="post-metadata">

### Author: ![LionelDraghi](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/lioneldraghi/32/416_2.png) [@LionelDraghi](https://forum.ada-lang.io/u/LionelDraghi)
#### Post date: [February 10, 2025, 12:18am UTC](https://forum.ada-lang.io/t/name-file-casing-error-on-darwin/1795/4 "2025-02-10T00:18:38Z")

</div>

> [@simonjwright](#):
>
> You can avoid this by setting the environment variable `GNAT_FILE_NAME_CASE_SENSITIVE` to 1.

Thank you Simon, well spot, it’s running as expected now.

I have an internal utility that shorten file names according to a, for example, initial directory, to avoid long file name in output. This utility works on string, and is not calling any OS Normalize function.  
So when I work in /Users/lionel/tmp on /Users/lionel/tmp/file1, the short form should be ./file1  
But as when creating file1 the full name recorded starts with /users instead of /Users, my function fail.

(I am probably not making the best use of Ada.Directories.\*, I guess)

---

<div class="post-metadata">

### Author: ![simonjwright](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/simonjwright/32/11_2.png) [@simonjwright](https://forum.ada-lang.io/u/simonjwright)
#### Post date: [February 10, 2025, 8:43am UTC](https://forum.ada-lang.io/t/name-file-casing-error-on-darwin/1795/5 "2025-02-10T08:43:50Z")

</div>

It’s _possible_ that you could use DiskUtility to reformat the /System/Data partition to case-sensitive (but not worth trying on a machine you hope to use immediately 🙂

You can create a case-sensitive disk image …
