Name (File) casing error on Darwin

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).

I installed gnatstudio (thank you Pascal), and Alire (from https://alire.ada.dev/ because from 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.

There’s a bit of a saga with regard to filesystem case sensitivity on macOS (PR81114, PR111909)

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).

1 Like

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

RBE

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)

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 :slight_smile:

You can create a case-sensitive disk image …