bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: minor mkdir bug fixes


From: David Feuer
Subject: Re: minor mkdir bug fixes
Date: Wed, 15 Jun 2005 00:36:58 -0400
User-agent: Mutt/1.5.9i

I'm not sure if this is a bug or not, but it smells fishy (I'm not working
with a bleeding-edge coreutils, so I don't know if this is still there):

In makepath.c:

      /* If we've saved the cwd and DIRPATH is an absolute pathname,
         we must chdir to `/' in order to enable the chdir optimization.
         So if chdir ("/") fails, turn off the optimization.  */
      if (do_chdir && *dirpath == '/' && chdir ("/") < 0)
        do_chdir = false;

As I understand it (perhaps incorrectly), the only time it might be
possible to create a directory when it is impossible to chdir to one of
its parents is when all but the last existing directory have their
execute bits set.  Doing a special test for chdir to root does not seem
to be the right thing.  Rather, it should be possible to turn off the
chdir optimization at any time in the process if a directory is reached
that cannot be entered.  If I understand it correctly, the current code
gives an error in this case, which is wrong.  HOWEVER, I have not found
any situation in Linux where it would be possible to create the desired
directory, but not possible to chdir to all the parents.  So this all
seems sketchy.

David




reply via email to

[Prev in Thread] Current Thread [Next in Thread]