Skip to main content

Timeline for Is it possible to delete . and ..?

Current License: CC BY-SA 4.0

7 events
when toggle format what by license comment
Jan 22, 2021 at 10:42 comment added user313992 In the (unlikely) case someone actually tries that, notice that debugfs is a very blunt tool: mknod /dir/pipe p will not create a named pipe inside the /dir directory, but one named /dir/pipe (yes, including the slashes as part of the filename) inside the current directory.
Jan 22, 2021 at 9:48 comment added user313992 I don't think it's good to conflate the emulation of . and .. when resolving paths (which is required by POSIX compat and is done by the kernel at VFS level) and their emulation of . and .. when listing directories (which is done by most filesystems, though not required by POSIX, and not at all useful or reliable). If you re-created . as a named pipe or regular file in debugfs, stat . would still show it as a directory. A much better question IMHO would've been: what programs would break if filesystems no longer faked the . and .. entries when listing directories?
Jan 21, 2021 at 14:19 vote accept MaxSilvester
Jan 21, 2021 at 14:12 comment added Stephen Kitt @Stéphane yes, I only wanted to explain why a file system would emulate them; thanks for the clarification, I’ve updated the answer.
Jan 21, 2021 at 14:11 history edited Stephen Kitt CC BY-SA 4.0
Clarify what POSIX requires.
Jan 21, 2021 at 13:59 comment added Stéphane Chazelas POSIX doesn't require them. It requires . to resolve to the current directory and .. to resolve to the parent, but not readdir() to include any of them in its result. Actually, the world would be a better place if readdir() no longer returned them. See also: austingroupbugs.net/view.php?id=1228
Jan 21, 2021 at 13:56 history answered Stephen Kitt CC BY-SA 4.0