Sujet : Re: Case Insensitive File Systems -- Torvalds Hates Them
De : invalid (at) *nospam* invalid.invalid (Richard Kettlewell)
Groupes : comp.os.linux.misc comp.os.linux.advocacyDate : 10. May 2025, 11:06:01
Autres entêtes
Organisation : terraraq NNTP server
Message-ID : <wwv1psw6ara.fsf@LkoBDZeT.terraraq.uk>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
The Natural Philosopher <
tnp@invalid.invalid> writes:
On 10/05/2025 09:38, Richard Kettlewell wrote:
The Natural Philosopher <tnp@invalid.invalid> writes:
On 03/05/2025 13:09, Chris Ahlstrom wrote:
Lawrence D'Oliveiro wrote this post while blinking in Morse code:
ldo@theon:caseinsens-try> touch try.dat
ldo@theon:caseinsens-try> ls -l
total 0
-rw-r--r-- 1 ldo users 0 May 3 11:57 try.dat
ldo@theon:caseinsens-try> mv try.dat TRY.DAT
mv: 'try.dat' and 'TRY.DAT' are the same file
>
I guess Linux isn’t any better ...
It works on my Linux box (Debian Sid).
Heh heh:
>
And mine (Mint 22)
I would guess that you’re doing the test on a case-dependent
filesystem? With vfat and 9p (to NTFS, in WSL) the behavior is as
Lawrence describes.
Lawrence said it was a feature of Linux, not of the file system in use
The context was case-insensitive filesystems, but the logic being
applied is indeed independent of filesystem; it just leads to different
results in different types of filesystem.
(Strictly, it’s a feature of GNU coreutils, but apart from that I think
his point stands.)
First, the Linux rename() syscall has no trouble with renames to the
‘same’ name (with or without a case change and in both case-insensitive
and case-sensitive filesystems). So in that sense Linux copes with the
situation just fine.
In fact so does Windows, both via explorer and ren; I don’t know what
behavior the poster before Lawrence was experiencing but there doesn’t
seem to be a problem today.
However, we’re not using (just) rename() here. coreutils’s mv does quite
a lot of work for a superficially simple rename but the relevant part
here is that it explicitly checks whether source and destination are the
same file and refuses to rename in that situation. The situation also
arises if you use hard links:
$ touch a
$ ln a b
$ mv a b
mv: 'a' and 'b' are the same file
So that’s the sense in which it’s a feature of Linux (strictly: of
coreutils). The behavior in case-insensitive filesystems follows, since
in a case-insensitive filesystem, try.dat and TRY.DAT are two names for
the same file.
IMO that’s a bug in mv: you should be able to change letter case in
case-insensitive filesystems using just mv.
-- https://www.greenend.org.uk/rjk/