[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: --preserve-root option of chown, chmod, etc. warns but does not exit
From: |
Jim Meyering |
Subject: |
Re: --preserve-root option of chown, chmod, etc. warns but does not exit when running on / with recursion |
Date: |
Wed, 13 Dec 2006 00:45:02 +0100 |
address@hidden (Matthew M. Boedicker) wrote:
> Hope this is not a dupe. I sent this before I subscribed but it didn't seem
> to go through.
No problem. This list is moderated, and sometimes it takes a while
for a human to examine the queue.
> The --preserve-root failsafe in chown, chmod, etc. does not exit when it
> should. It prints a warning and continues to recurse. ROOT_DEV_INO_WARN
> should pass a non-zero value as the first argument to error() to exit.
Thank you for the report and patch!
There are definitely bugs, in that chmod, chown, and chgrp
fail to honor the semantics of the --preserve-root option.
(Note that the other program to accept that option, rm, does honor it.)
However, your patch would make the three tools stop too early.
The intent was to make them skip an argument of "/", or a
hierarchy corresponding to a symlink-to-/ encountered by chown -RH,
and to continue processing any remaining arguments (or the remainder
of the hierarchy in the chown -RH vs. symlink-to-/ case).
That sort of behavior (not terminating the entire process just because
of a problem with one argument) is consistent with the way these tools
handle other error conditions.
I'm preparing a patch + test case etc.
Will post tomorrow.