On 4/19/21 3:42 AM, Allan McRae wrote: > On 18/4/21 12:42 pm, Eli Schwartz wrote: >> We do not need the --relative case as it is dead code (we only ever link >> a filename without directory components). >> >> For the rest, GNU-specific ln -T does two things: >> >> - if the link name is an existing directory, ln fails instead of >> creating a surprising link inside the directory >> - if the link name is a symlink to a directory, ln treats it as a file, >> and due to -f, unlinks it >> >> The second case can be portably solved by ln -n, and the first case is >> not actually currently functional, but we can portably replace the error >> message with rmdir, so, why not? > > Can we? That assumes the directory is non-empty and rmdir fails. I > don't think removing an empty directory and replacing it with a symlink > is expected behaviour. > > Can we just abort with an error if the target is a directory?
I guess, but what's the difference between this and replacing a symlink to a directory? -- Eli Schwartz Bug Wrangler and Trusted User
OpenPGP_signature
Description: OpenPGP digital signature
