(Not that you would ever want to), is it possible to create a directory with the literal name ..
or .
? Under most filesystems it is a reserved name, but would it be possible on, say, XFS, JFS, or some other filesystem which permits it? If so, how?
Secondary question: if you manually modified the filesystem without mounting it, could you create a directory like that, and what would be its behaviour?
..
and.
dir entries, but the kernel won't care about them. At least on linux,cd ..
,test -d ..
,test -d .
will work as expected no matter if the filesystem has such a directory entry or not. I'm not able to give you an example now, but I had created a test FUSE "nullfs " fs which implemented a single dir which returned regular files for any name, including.
and..
, and did not list any entries (not even.
or..
), but the kernel did not care, and everything was fine. – Nov 07 '19 at 20:45.
and..
entries when listing directories, without actually storing them -- search foremit_dots
in the linux source. – Nov 07 '19 at 20:47mkdir /tmp/dots; perl -e 'open my $f, ">", "/tmp/dots/.$_." for map chr, 0x200c, 0x200d, 0x200e, 0x200f'; ls -a /tmp/dots
. Even the infamous GNU ls quoting won't show them differently (unless you're using theC
locale). – Nov 08 '19 at 13:22