On Thu, 21 May 2009, Gabor HALASZ wrote:

> Cristian Ionescu-Idbohrn wrote:
> > On Wed, 20 May 2009, Gabor HALASZ wrote:
> >
> > > I have a little problem with chmod applet. The gnu verion of chmod
> > > command don't care about dead symlinks:
> > >
> > > ga-k8nf-9-1:~# ln -s nowhere /tmp/dead_link
> > > ga-k8nf-9-1:~# chmod +x /tmp/dead_link; echo ${?}
> > > 0
> >
> > Mine does:
> >
> > $ chmod -x dead_link
> > chmod: cannot operate on dangling symlink `dead_link'
> > zsh: exit 1     chmod -x dead_link
>
> Interesting :), but my problem is the return value of busybox's chmod -f
> +x.

Hmm...  What would you like it to do?

Coreutils chmod version (5.97) is buggy.  Yes, I found a box with that
particular coreutils version).  Later coreutils versions seem to handle
the situation as documented:

  $ man 1 chmod

       chmod never changes the permissions of symbolic links; the chmod system
       call cannot change their permissions.  This is not a problem since  the
       permissions  of  symbolic links are never used.  However, for each sym-
       bolic link listed on the command line, chmod changes the permissions of
       the pointed-to file.

sometime around here:

  2007-09-07  Jim Meyering  <j...@meyering.net>

        chmod: don't ignore a dangling symlink
        * NEWS: Mention the bug fix.
        * src/chmod.c (process_file): Handle the case of FTS_SLNONE,
        i.e., give a diagnostic saying we cannot operate on such a file.
        * tests/chmod/thru-dangling: Compare new stderr output with expected.

  2007-09-07  Bob Proulx  <b...@proulx.com>

        Add a test: demonstrate that chmod ignores a dangling symlink
        * tests/chmod/thru-dangling: New test.  Fails.
        * tests/chmod/Makefile.am (TESTS): Add thru-dangling.

and announced in NEWS:

* Noteworthy changes in release 6.9.90 (2007-12-01) [beta]
...
** Bug fixes

  chmod no longer ignores a dangling symlink.  Now, chmod fails
  with a diagnostic saying that it cannot operate on such a file.
  [bug introduced in coreutils-5.1.0]


What busybox chmod does is right.


Cheers,

-- 
Cristian
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to