|
|
Log in / Subscribe / Register

Case-insensitive filesystem lookups

Case-insensitive filesystem lookups

Posted May 23, 2018 16:04 UTC (Wed) by epa (subscriber, #39769)
Parent article: Case-insensitive filesystem lookups

You could get into trouble if foo exists on disk and someone does

% mv Foo FOO

Classically, mv(1) works by first linking and then unlinking. So it would create the name FOO and then ask to unlink Foo. That would have two possible matches, neither of them exact.


to post comments

Case-insensitive filesystem lookups

Posted May 23, 2018 18:25 UTC (Wed) by saffroy (guest, #43999) [Link] (1 responses)

I'm not sure mv(1) behaves like that on Linux nowadays:
$ strace mv foo bar

...
stat("bar", 0x7fffffffdd40)             = -1 ENOENT (No such file or directory)
lstat("foo", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
lstat("bar", 0x7fffffffda10)            = -1 ENOENT (No such file or directory)
rename("foo", "bar")                    = 0
...
But apps are certainly allowed to do link+unlink, and it should work reliably (ie. for a case-insensitive mount the link call should fail with EEXIST).

Case-insensitive filesystem lookups

Posted May 26, 2018 9:29 UTC (Sat) by k8to (guest, #15413) [Link]

rename() backing mv has been standard for at least two decades. I'm only familiar with things like solaris, freebsd, linux, os x, at this level.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds