On Thu, Jul 23, 2020 at 07:16:06PM -0400, The Wanderer wrote: > On 2020-07-23 at 06:26, Andrei POPESCU wrote: > > Seriously? Could you please show me how would I create a file on *nix > > containing '/' in the name? > > It's theoretically possible, but AFAIK basically nothing would support > it or work properly with it. > > The only ways I can think of to do it that I wouldn't expect to be > prohibited by the intermediary layers involved (such as the C standard > library) would be A: direct file I/O not involving a library (which I'd > guess would probably need to be written in architecture-specific ASM), > and B: opening the device underlying the filesystem in a hex editor or > similar and modifying the stored data in the inode.
The main way that one gets a filename containing a '/' character in real life is by discovering a bug somewhere. I've personally seen it once, on an old HP-UX system that was acting as an NFS server for some Mac clients (long before Mac OS X). Apparently the NFS server allowed the clients to create filenames with slashes in them, since that's legal on Mac OS 9 and earlier. Once such a file was created on the server, you couldn't do *anything* to it. You couldn't delete it, or rename it, or open it. The only thing you could do was move out all of the other files in the same directory, then rename the directory that it's in to something like "xxx_radioactive_waste". Then recreate the original directory, and move all the other files back into it.