[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "chmod a+rwx A B" doesn't chmod A before chmoding B
From: |
Jim Meyering |
Subject: |
Re: "chmod a+rwx A B" doesn't chmod A before chmoding B |
Date: |
Tue, 19 Sep 2006 23:43:56 +0200 |
Paul Eggert <address@hidden> wrote:
> While testing the new mkdir -p stuff I noticed a bug in chmod:
> it doesn't operate left-to-right as tradition and POSIX require:
>
> $ mkdir d d/e
> $ chmod 0 d/e d
> $ chmod a+rwx d d/e
> chmod: cannot access `d/e': Permission denied
>
> The last chmod should succeed, but it fails.
>
> I installed the following patch to fix this and test for the
> bug.
>
> I suppose another option would be to modify fts so that it
> has a new flag saying "please do everything left-to-right",
> but I suspect that'd be more complicated.
>
> After installing this I noticed the following line in NEWS:
>
> fts no longer changes the current working directory, so its clients
> (chmod, chown, chgrp, du) no longer malfunction under extreme conditions.
>
> so I guess the following patch is overly conservative, as it
> checks for fts_close failing? If you like, I can remove
> these new checks, and this will simplify the change quite a
> bit; but it seems to me that some of the code in fts.c
> (e.g., fts_close returning -1) could also be removed.
Good catch.
I'll take a look at this tomorrow.