bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] canonicalize-lgpl: Canonicalize casing too for MinGW.


From: Bruno Haible
Subject: Re: [PATCH v2] canonicalize-lgpl: Canonicalize casing too for MinGW.
Date: Sat, 11 Dec 2021 14:41:36 +0100

Hello Jan,

> > 2) If we wanted to make this function consistent on all platforms, we would
> >    also need to handle
> >      - Linux with mounted VFAT file systems,
> >      - macOS with case-insensitive HFS+,
> >      - different locales on Windows (e.g. to recognize that 'ä' and 'Ä' are
> >        equivalent in Windows installations with Western locales).
> >    And, on macOS with HFS+, also the Unicode canonicalization (NFC vs. NFD).
> 
> If that is what we would really like, someone could work on fixing those
> too, no need for this patch to fix all bugs at once?

The problem with that is that it is very expensive. The implementation
would have to determine the mount point first (via statfs()), then query
the properties of the mounted file system, and additionally on Windows,
use the locale. And for remote file systems, I don't know whether it
will actually be possible to implement: When I have a CIFS or NFS file
system mounted from a macOS machine, how do I know whether on the macOS
side it is case-sensitive or case-insensitive HFS+?

> We
> are using canonicalize-path in Guile, which uses canonicalize_file_name.
> 
> I think of a canonical form of something as a unique, authoritative
> representation.

Yes, the name is misleading. Only certain properties of the file name
are canonicalized by this function.

> We are using the canonical form as an automatic include guard, to not
> include the same file twice.  A user reported a bug: In a large project
> they used an import of a file with alternative casing.

I would suggest to look at two Gnulib modules:
  - 'same'
  - 'same-inode' (like Paul suggested).

They deal with the problem without undue costs.

Bruno






reply via email to

[Prev in Thread] Current Thread [Next in Thread]