Bug 111909 - Filename case sensitivity defaulted wrongly on macOS
Summary: Filename case sensitivity defaulted wrongly on macOS
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: ada (show other bugs)
Version: 14.0
: P3 normal
Target Milestone: ---
Assignee: simon
URL: https://gcc.gnu.org/pipermail/gcc-pat...
Keywords: patch
Depends on:
Blocks:
 
Reported: 2023-10-21 15:22 UTC by simon
Modified: 2024-03-13 14:56 UTC (History)
3 users (show)

See Also:
Host:
Target: aarch64-apple-darwin
Build:
Known to work:
Known to fail:
Last reconfirmed: 2023-10-30 00:00:00


Attachments
Demo of code to determine case sensitivity (1.16 KB, application/zip)
2023-10-21 15:22 UTC, simon
Details

Note You need to log in before you can comment on or make changes to this bug.
Description simon 2023-10-21 15:22:04 UTC
Created attachment 56167 [details]
Demo of code to determine case sensitivity

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 change was made in commit b54d1d39d30c (in github gcc-mirror).
   
This means that on aarch64-apple-darwin, file names are declared
case-sensitive.

I understand that GCC does not currently support iOS/tvOS/watchOS, so
we could assume macOS.

On macOS, the default filesystem is case-insensitive; changing this
function to reflect that would be an improvement. However, it's
possible to create case-sensitive filesystems, and some users do when
dealing with OSS code. It would be good to check the actual filesystem
in use.
Comment 1 Eric Gallager 2023-10-22 01:20:36 UTC
Cross-referencing against some related issues:
https://github.com/iains/gcc-darwin-arm64/issues/101
Bug 81114
Comment 2 Eric Gallager 2023-10-30 14:00:17 UTC
Patch posted to mailing lists:
https://gcc.gnu.org/pipermail/gcc-patches/2023-October/634636.html
Comment 3 GCC Commits 2023-11-28 16:48:23 UTC
The master branch has been updated by Marc Poulhi?s <dkm@gcc.gnu.org>:

https://gcc.gnu.org/g:396db92d3aa7412dd7133563fecbc6237fa81c02

commit r14-5936-g396db92d3aa7412dd7133563fecbc6237fa81c02
Author: Simon Wright <simon@pushface.org>
Date:   Tue Nov 28 14:56:36 2023 +0100

    Fix PR ada/111909 On Darwin, determine filesystem case sensitivity at runtime
    
    In gcc/ada/adaint.c(__gnat_get_file_names_case_sensitive), the current
    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 treated as
    case-sensitive, which is not the default case.
    
    The true default position is that macOS file systems are
    case-insensitive, iOS file systems are case-sensitive.
    
    Apple provide a header file <TargetConditionals.h> which permits a
    compile-time check for the compiler target (e.g. OSX vs IOS); if
    TARGET_OS_IOS is defined as 1, this is a build for iOS.
    
    2023-11-22  Simon Wright  <simon@pushface.org>
    
    gcc/ada/
    
            PR ada/111909
            * adaint.c
            (__gnat_get_file_names_case_sensitive): Split out the __APPLE__
            check and remove the checks for __arm__, __arm64__. For Apple,
            file names are by default case-insensitive unless TARGET_OS_IOS is
            set.
    
    Signed-off-by: Simon Wright <simon@pushface.org>
Comment 4 simon 2024-03-13 14:56:47 UTC
Fixed on mainline.