public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
To: Arnaud Charlet <charlet@adacore.com>
Cc: gcc-patches@gcc.gnu.org, idsandoe@googlemail.com
Subject: Re: [PATCH] Fix PR ada/111909 On Darwin, determine filesystem case sensitivity at runtime
Date: Sat, 4 Nov 2023 17:02:59 +0000	[thread overview]
Message-ID: <6581E8BE-9D03-4F31-B5C4-B9DC79BBE1A7@pushface.org> (raw)
In-Reply-To: <20231103083926.GA2587057@adacore.com>

On 3 Nov 2023, at 08:39, Arnaud Charlet <charlet@adacore.com> wrote:

> In addition to the non portable issues already mentioned, this change isn't OK also
> for other reasons.
> 
> Basically this function is global and decides once for all on the case sensitivity, while
> the case sensitiviy is on a per filsystem basis as you noted.

Well, the current code does exactly what you describe, with less relationship to the actual 
environment than this proposal.

> So without changing fundamentally the model, you can't decide dynamically for the whole
> system. Making the choice based on the current directory is pretty random, since the current
> directory isn't well defined at program's start up and could be pretty much any filesystem.

I’d imagine that projects spread over more than one differently-case-sensitive filesystem would
be rare. As to the current directory at compiler startup, with GPRbuild it’s the object directory, so
likely to be somewhere near the project’s source tree.

> Note that the current setting on arm is actually for iOS, which we did support at AdaCore
> at some point (and could revive in the future, who knows).

Wouldn’t it be more natural to go via LLVM? I understand from Iain that iOS isn’t currently
supported by GCC.

> So it would be fine to refine the test to differentiate between macOS and embedded iOS and co,
> that would be a better change here.

There didn’t seem to be a way to do that.

But anyway, I find myself puzzled by the casing issue. It seems to me that on a CS filesystem
users would be well advised to stick to lower-case filenames, or the compiler won’t be able to
resolve 'with' statements; whereas on a non-CS system, there’d be no such constraint. Indeed,
when compiling a file with a mixed-case name in a CS environment, the compiler warns:

$ GNAT_FILE_NAME_CASE_SENSITIVE=1 gcc -c -u -f WTF.adb
WTF.adb:1:11: warning: file name does not match unit name, should be "wtf.adb" [enabled by default]

Also, there’ve been about 80 downloads of GCC 13.1.0 for aarch64-apple-darwin, and no 
case-sensitivity issues have been reported.

So, Iain, do we want to pursue this?

> 
>> This change affects only Ada.
>> 
>> In gcc/ada/adaint.c(__gnat_get_file_names_case_sensitive), the
>> assumption for __APPLE__ is that file names are case-insensitive
>> unless __arm__ or __arm64__ are defined, in which case file names
>> are declared case-sensitive.
>> 
>> The associated comment is
>>  "By default, we suppose filesystems aren't case sensitive on
>>  Windows and Darwin (but they are on arm-darwin)."
>> 
>> This means that on aarch64-apple-darwin, file names are declared
>> case-sensitive, which is not normally the case (but users can set
>> up case-sensitive volumes).
>> 
>> It's understood that GCC does not currently support iOS/tvOS/watchOS,
>> so we assume macOS.
>> 
>> Bootstrapped on x86_64-apple-darwin with languages c,c++,ada and regression tested (check-gnat).
>> Also, tested with the example from PR ada/81114, extracted into 4 volumes (APFS, APFS-case-sensitive,
>> HFS, HFS-case-sensitive; the example code built successfully on the case-sensitive volumes.
>> Setting GNAT_FILE_NAME_CASE_SENSITIVE successfully overrode the choices made by the
>> new code.
>> 
>> gcc/ada/Changelog:
>> 
>> 2023-10-29 Simon Wright <simon@pushface.org>
>> 
>> PR ada/111909
>> 
>> * gcc/ada/adaint.c
>>  (__gnat_get_file_names_case_sensitive): Remove the checks for
>>  __arm__, __arm64__.
>>  Split out the check for __APPLE__; remove the checks for __arm__,
>>  __arm64__, and use getattrlist(2) to determine whether the current
>>  working directory is on a case-sensitive filesystem.
>> 
>> Signed-off-by: Simon Wright <simon@pushface.org>


  reply	other threads:[~2023-11-04 17:03 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-29 11:51 Simon Wright
2023-10-31  8:07 ` Iain Sandoe
2023-11-03  8:39 ` Arnaud Charlet
2023-11-04 17:02   ` Simon Wright [this message]
2023-11-04 23:28     ` Iain Sandoe
2023-11-06  8:36     ` Arnaud Charlet
2023-11-11 17:47       ` Simon Wright
2023-11-11 18:10         ` Iain Sandoe
2023-11-13 16:03           ` Simon Wright
2023-11-13 16:18             ` Arnaud Charlet
2023-11-16 20:56               ` Simon Wright
2023-11-17  8:37                 ` Arnaud Charlet
2023-11-17  9:06                   ` Simon Wright
2023-11-17  9:29                     ` Arnaud Charlet
2023-11-17 12:53                       ` Simon Wright
2023-11-17 13:36                         ` Arnaud Charlet
2023-11-17 13:39                           ` Arnaud Charlet
2023-11-17 13:43                           ` Simon Wright
2023-11-21 11:22                             ` Iain Sandoe
2023-11-21 20:25                               ` Simon Wright
2023-11-21 23:13                                 ` Iain Sandoe
2023-11-22 13:54                                   ` Simon Wright
2023-11-22 13:55                                     ` Arnaud Charlet
2023-11-22 14:48                                       ` Iain Sandoe
2023-11-22 15:03                                         ` Iain Sandoe
2023-11-22 15:13                                           ` Simon Wright
2023-11-28 12:16                                             ` Simon Wright
2023-11-28 13:50                                               ` Marc Poulhiès
2023-11-28 16:48                                                 ` Marc Poulhiès
2023-11-22 14:41                                     ` Paul Koning

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6581E8BE-9D03-4F31-B5C4-B9DC79BBE1A7@pushface.org \
    --to=simon@pushface.org \
    --cc=charlet@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=idsandoe@googlemail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).