"Avis, Ed" <[EMAIL PROTECTED]> writes: > There could be some kind of -f, --follow option so that mkdir will > create the directory pointed to.
There is a potential security problem there, if the symbolic link is in a directory writable by an attacker. > You'd probably use it together with -p. Then 'mkdir -fp' would be a > way to try everything sensible to make sure the destination exists > and can be used as a directory (ie, is a directory itself or a > symlink to one). Perhaps "mkdir -F -p" would also remove files that got in the way? :-) > Is this a sensible thing to put in mkdir or is there some existing Unix > idiom that does what I want? Not in POSIX/Unix, but in coreutils 5.3.0 and later: either "mkdir -p $(readlink -f file)" or "mkdir -p $(readlink -m file)", depending on the exact semantics that you want. But think about the security problems. ftp://alpha.gnu.org/gnu/coreutils/coreutils-5.3.0.tar.gz > I note that 'touch foo' when foo is a broken symlink will create the > link destination if possible (though without making any directories, > obviously). POSIX requires this, but it is arguably a misfeature, due to the security issues mentioned. Perhaps we should add an option to "touch" to disable it? _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils