Re: mkdir when target exists and is a broken symlink

2005-05-20 Thread Paul Eggert
>>POSIX requires this, but it is arguably a misfeature, due to the >>security issues mentioned. > > I still don't understand how this is a security issue any more than the > whole concept of symbolic links is a security issue. Yes, that's the problem basically. If you're about to say "touch /tmp/

RE: mkdir when target exists and is a broken symlink

2005-05-20 Thread Avis, Ed
Paul Eggert wrote: >>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. I don't agree that this is a security problem, since mkdir is

Re: mkdir when target exists and is a broken symlink

2005-05-19 Thread Paul Eggert
[EMAIL PROTECTED] (Eric Blake) writes: > POSIX requires that touch do the equivalent of calling creat() if > the file does not exist, then call utime() whether or not creat() > was called. A broken symlink exists, Not unless the program is specifically mentioned by POSIX as one that does not fol

Re: mkdir when target exists and is a broken symlink

2005-05-18 Thread Eric Blake
> > 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 "t

RE: mkdir when target exists and is a broken symlink

2005-05-18 Thread Avis, Ed
Eric Blake wrote: >>There could be some kind of -f, --follow option so that mkdir will >>create the directory pointed to. You'd probably use it together with >>-p. >This sounds somewhat similar to cp -f, --force. cp uses >slightly different semantics, required by POSIX (rather than >try to cr

Re: mkdir when target exists and is a broken symlink

2005-05-18 Thread Paul Eggert
"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. T

Re: mkdir when target exists and is a broken symlink

2005-05-17 Thread Eric Blake
> ln -s nonexistent foo > There could be some kind of -f, --follow option so that mkdir will > create the directory pointed to. 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

mkdir when target exists and is a broken symlink

2005-05-17 Thread Avis, Ed
I'd like to suggest a possible new feature for mkdir and see what people think of it. % ln -s nonexistent foo % mkdir foo mkdir: cannot create directory `foo': File exists There could be some kind of -f, --follow option so that mkdir will create the directory pointed to. You'd probably use it to