From unknown Mon Jun 23 11:27:14 2025 X-Loop: help-debbugs@gnu.org Subject: bug#17035: [PATCH] chmod -c -R produces errors with special permissions Resent-From: Dylan Alex Simon Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 18 Mar 2014 16:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 17035 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: patch To: 17035@debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.139516159121991 (code B ref -1); Tue, 18 Mar 2014 16:54:02 +0000 Received: (at submit) by debbugs.gnu.org; 18 Mar 2014 16:53:11 +0000 Received: from localhost ([127.0.0.1]:40343 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WPxGD-0005iW-Hh for submit@debbugs.gnu.org; Tue, 18 Mar 2014 12:53:09 -0400 Received: from eggs.gnu.org ([208.118.235.92]:54116) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WPwuF-000529-8j for submit@debbugs.gnu.org; Tue, 18 Mar 2014 12:30:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WPwu9-0003z4-9p for submit@debbugs.gnu.org; Tue, 18 Mar 2014 12:30:22 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:59990) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WPwu9-0003yy-7l for submit@debbugs.gnu.org; Tue, 18 Mar 2014 12:30:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55751) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WPwu3-0006Wk-IL for bug-coreutils@gnu.org; Tue, 18 Mar 2014 12:30:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WPwtw-0003lc-FU for bug-coreutils@gnu.org; Tue, 18 Mar 2014 12:30:11 -0400 Received: from datura.dylex.net ([66.114.66.16]:37677) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WPwtw-0003fe-1K for bug-coreutils@gnu.org; Tue, 18 Mar 2014 12:30:04 -0400 Received: from dylan by datura.dylex.net with local (Exim 4.82) (envelope-from ) id 1WPwX9-0007a0-9s for bug-coreutils@gnu.org; Tue, 18 Mar 2014 12:06:31 -0400 Date: Tue, 18 Mar 2014 12:06:31 -0400 From: Dylan Alex Simon Message-ID: <20140318160631.GA29034@datura.dylex.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="YZ5djTAD1cGYuMQK" Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-Mailman-Approved-At: Tue, 18 Mar 2014 12:53:04 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.1 (----) --YZ5djTAD1cGYuMQK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline chmod sometimes tries to stat files in the wrong directory when reporting changes: > mkdir -p a/b > chmod -R g+s a/b # requires some special permission bit set first > chmod -c -R g+w a chmod: getting new attributes of 'b': No such file or directory A fix is attached. --YZ5djTAD1cGYuMQK Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-chmod-fix-mode_changed-check.patch" >From 8e4f39ea022c9305d43ebd2823cf07b5daf682a9 Mon Sep 17 00:00:00 2001 From: Dylan Simon Date: Tue, 18 Mar 2014 11:50:29 -0400 Subject: [PATCH] chmod: fix mode_changed check * src/chmod.c (mode_changed): Use fts->fts_cwd_fd with fstatat rather than stat. All callers changed. --- src/chmod.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/chmod.c b/src/chmod.c index 81bf4b2..f9debde 100644 --- a/src/chmod.c +++ b/src/chmod.c @@ -111,7 +111,8 @@ static struct option const long_options[] = The old mode was OLD_MODE, but it was changed to NEW_MODE. */ static bool -mode_changed (char const *file, mode_t old_mode, mode_t new_mode) +mode_changed (int dirfd, char const *file, char const *file_full_name, + mode_t old_mode, mode_t new_mode) { if (new_mode & (S_ISUID | S_ISGID | S_ISVTX)) { @@ -120,10 +121,10 @@ mode_changed (char const *file, mode_t old_mode, mode_t new_mode) struct stat new_stats; - if (stat (file, &new_stats) != 0) + if (fstatat (dirfd, file, &new_stats, 0) != 0) { if (! force_silent) - error (0, errno, _("getting new attributes of %s"), quote (file)); + error (0, errno, _("getting new attributes of %s"), quote (file_full_name)); return false; } @@ -283,7 +284,8 @@ process_file (FTS *fts, FTSENT *ent) if (verbosity != V_off) { bool changed = (chmod_succeeded - && mode_changed (file, old_mode, new_mode)); + && mode_changed (fts->fts_cwd_fd, file, file_full_name, + old_mode, new_mode)); if (changed || verbosity == V_high) { -- 1.9.0 --YZ5djTAD1cGYuMQK-- From unknown Mon Jun 23 11:27:14 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Dylan Alex Simon Subject: bug#17035: closed (Re: bug#17035: [PATCH] chmod -c -R produces errors with special permissions) Message-ID: References: <53289449.7040707@draigBrady.com> <20140318160631.GA29034@datura.dylex.net> X-Gnu-PR-Message: they-closed 17035 X-Gnu-PR-Package: coreutils X-Gnu-PR-Keywords: patch Reply-To: 17035@debbugs.gnu.org Date: Tue, 18 Mar 2014 18:46:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1395168362-2866-1" This is a multi-part message in MIME format... ------------=_1395168362-2866-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #17035: [PATCH] chmod -c -R produces errors with special permissions which was filed against the coreutils package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 17035@debbugs.gnu.org. --=20 17035: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D17035 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1395168362-2866-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 17035-done) by debbugs.gnu.org; 18 Mar 2014 18:45:50 +0000 Received: from localhost ([127.0.0.1]:40383 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WPz1I-0000jj-Up for submit@debbugs.gnu.org; Tue, 18 Mar 2014 14:45:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:65372) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WPz16-0000jI-T6 for 17035-done@debbugs.gnu.org; Tue, 18 Mar 2014 14:45:38 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s2IIjYLC030444 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 18 Mar 2014 14:45:34 -0400 Received: from [10.36.116.77] (ovpn-116-77.ams2.redhat.com [10.36.116.77]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s2IIjTgR019525 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Tue, 18 Mar 2014 14:45:31 -0400 Message-ID: <53289449.7040707@draigBrady.com> Date: Tue, 18 Mar 2014 18:45:29 +0000 From: =?ISO-8859-1?Q?P=E1draig_Brady?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Dylan Alex Simon Subject: Re: bug#17035: [PATCH] chmod -c -R produces errors with special permissions References: <20140318160631.GA29034@datura.dylex.net> In-Reply-To: <20140318160631.GA29034@datura.dylex.net> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 17035-done Cc: 17035-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) On 03/18/2014 04:06 PM, Dylan Alex Simon wrote: > chmod sometimes tries to stat files in the wrong directory when reporting > changes: > >> mkdir -p a/b >> chmod -R g+s a/b # requires some special permission bit set first >> chmod -c -R g+w a > chmod: getting new attributes of 'b': No such file or directory > > A fix is attached. > The fix looks good. It seems this bug was introduced with the change to FTS in 5.1.0 (released Dec 2003) I'll push soon in your name with these changes merged in. thanks! Pádraig. $ git diff HEAD@{1} diff --git a/NEWS b/NEWS index 35d48e5..3623674 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,9 @@ GNU coreutils NEWS -*- outline -*- ** Bug fixes + chmod -R --changes no longer issues erroneous warnings for files with special + bits set. [bug introduced in coreutils-5.1.0] + cp -a, mv, and install --preserve-context, once again set the correct SELinux context for existing directories in the destination. Previously they set the context of an existing directory to that of its last copied descendent. diff --git a/src/chmod.c b/src/chmod.c index f9debde..ae8b6fb 100644 --- a/src/chmod.c +++ b/src/chmod.c @@ -111,7 +111,7 @@ static struct option const long_options[] = The old mode was OLD_MODE, but it was changed to NEW_MODE. */ static bool -mode_changed (int dirfd, char const *file, char const *file_full_name, +mode_changed (int dir_fd, char const *file, char const *file_full_name, mode_t old_mode, mode_t new_mode) { if (new_mode & (S_ISUID | S_ISGID | S_ISVTX)) @@ -121,7 +121,7 @@ mode_changed (int dirfd, char const *file, char const *file_full_name, struct stat new_stats; - if (fstatat (dirfd, file, &new_stats, 0) != 0) + if (fstatat (dir_fd, file, &new_stats, 0) != 0) { if (! force_silent) error (0, errno, _("getting new attributes of %s"), quote (file_full_name)); diff --git a/tests/chmod/c-option.sh b/tests/chmod/c-option.sh index 1dd9b9e..38b127b 100755 --- a/tests/chmod/c-option.sh +++ b/tests/chmod/c-option.sh @@ -37,4 +37,15 @@ case "$(cat out)" in *) cat out; fail=1 ;; esac +# From V5.1.0 to 8.22 this would stat the wrong file and +# give an erroneous ENOENT diagnostic +mkdir -p a/b || framework_failure_ +# chmod g+s might fail as detailed in setgid.sh +# but we don't care about those edge cases here +chmod g+s a/b +# This should never warn, but in did when special +# bits are set on b (the common case under test) +chmod -c -R g+w a 2>err +test -s err && fail=1 + Exit $fail ------------=_1395168362-2866-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 18 Mar 2014 16:53:11 +0000 Received: from localhost ([127.0.0.1]:40343 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WPxGD-0005iW-Hh for submit@debbugs.gnu.org; Tue, 18 Mar 2014 12:53:09 -0400 Received: from eggs.gnu.org ([208.118.235.92]:54116) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WPwuF-000529-8j for submit@debbugs.gnu.org; Tue, 18 Mar 2014 12:30:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WPwu9-0003z4-9p for submit@debbugs.gnu.org; Tue, 18 Mar 2014 12:30:22 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:59990) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WPwu9-0003yy-7l for submit@debbugs.gnu.org; Tue, 18 Mar 2014 12:30:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55751) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WPwu3-0006Wk-IL for bug-coreutils@gnu.org; Tue, 18 Mar 2014 12:30:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WPwtw-0003lc-FU for bug-coreutils@gnu.org; Tue, 18 Mar 2014 12:30:11 -0400 Received: from datura.dylex.net ([66.114.66.16]:37677) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WPwtw-0003fe-1K for bug-coreutils@gnu.org; Tue, 18 Mar 2014 12:30:04 -0400 Received: from dylan by datura.dylex.net with local (Exim 4.82) (envelope-from ) id 1WPwX9-0007a0-9s for bug-coreutils@gnu.org; Tue, 18 Mar 2014 12:06:31 -0400 Date: Tue, 18 Mar 2014 12:06:31 -0400 From: Dylan Alex Simon To: bug-coreutils@gnu.org Subject: [PATCH] chmod -c -R produces errors with special permissions Message-ID: <20140318160631.GA29034@datura.dylex.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="YZ5djTAD1cGYuMQK" Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Tue, 18 Mar 2014 12:53:04 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.1 (----) --YZ5djTAD1cGYuMQK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline chmod sometimes tries to stat files in the wrong directory when reporting changes: > mkdir -p a/b > chmod -R g+s a/b # requires some special permission bit set first > chmod -c -R g+w a chmod: getting new attributes of 'b': No such file or directory A fix is attached. --YZ5djTAD1cGYuMQK Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-chmod-fix-mode_changed-check.patch" >From 8e4f39ea022c9305d43ebd2823cf07b5daf682a9 Mon Sep 17 00:00:00 2001 From: Dylan Simon Date: Tue, 18 Mar 2014 11:50:29 -0400 Subject: [PATCH] chmod: fix mode_changed check * src/chmod.c (mode_changed): Use fts->fts_cwd_fd with fstatat rather than stat. All callers changed. --- src/chmod.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/chmod.c b/src/chmod.c index 81bf4b2..f9debde 100644 --- a/src/chmod.c +++ b/src/chmod.c @@ -111,7 +111,8 @@ static struct option const long_options[] = The old mode was OLD_MODE, but it was changed to NEW_MODE. */ static bool -mode_changed (char const *file, mode_t old_mode, mode_t new_mode) +mode_changed (int dirfd, char const *file, char const *file_full_name, + mode_t old_mode, mode_t new_mode) { if (new_mode & (S_ISUID | S_ISGID | S_ISVTX)) { @@ -120,10 +121,10 @@ mode_changed (char const *file, mode_t old_mode, mode_t new_mode) struct stat new_stats; - if (stat (file, &new_stats) != 0) + if (fstatat (dirfd, file, &new_stats, 0) != 0) { if (! force_silent) - error (0, errno, _("getting new attributes of %s"), quote (file)); + error (0, errno, _("getting new attributes of %s"), quote (file_full_name)); return false; } @@ -283,7 +284,8 @@ process_file (FTS *fts, FTSENT *ent) if (verbosity != V_off) { bool changed = (chmod_succeeded - && mode_changed (file, old_mode, new_mode)); + && mode_changed (fts->fts_cwd_fd, file, file_full_name, + old_mode, new_mode)); if (changed || verbosity == V_high) { -- 1.9.0 --YZ5djTAD1cGYuMQK-- ------------=_1395168362-2866-1-- From unknown Mon Jun 23 11:27:14 2025 X-Loop: help-debbugs@gnu.org Subject: bug#17035: [PATCH] chmod -c -R produces errors with special permissions Resent-From: Bernhard Voelker Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 18 Mar 2014 22:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17035 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: patch To: 17035@debbugs.gnu.org, P@draigBrady.com, dylan@dylex.net Received: via spool by 17035-submit@debbugs.gnu.org id=B17035.139518111326363 (code B ref 17035); Tue, 18 Mar 2014 22:19:01 +0000 Received: (at 17035) by debbugs.gnu.org; 18 Mar 2014 22:18:33 +0000 Received: from localhost ([127.0.0.1]:40472 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WQ2LA-0006r8-ER for submit@debbugs.gnu.org; Tue, 18 Mar 2014 18:18:32 -0400 Received: from moutng.kundenserver.de ([212.227.17.10]:59117) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WQ2L8-0006qz-Bx for 17035@debbugs.gnu.org; Tue, 18 Mar 2014 18:18:31 -0400 Received: from [192.168.1.11] (p5091ECDF.dip0.t-ipconnect.de [80.145.236.223]) by mrelayeu.kundenserver.de (node=mreue102) with ESMTP (Nemesis) id 0MD8M0-1WKaoY0lZ6-00Gccd; Tue, 18 Mar 2014 23:18:26 +0100 Message-ID: <5328C631.6020809@bernhard-voelker.de> Date: Tue, 18 Mar 2014 23:18:25 +0100 From: Bernhard Voelker User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 References: <20140318160631.GA29034@datura.dylex.net> <53289449.7040707@draigBrady.com> In-Reply-To: <53289449.7040707@draigBrady.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Provags-ID: V02:K0:VI5hCccPTPNuczPPq3IRCTtSMtIjM7BTR1OHbTAL56u zVu7h4td7JoIow6EdY3OWlBB3mbk+O/sGAq8abXyRF+hOpxt1t WyC2vjaiIkcB4KQ2R+9Y4QSfhBdOzs+prnsN7kCKlfHV2bzqkn t4KpZnGoKD3aptvKNuDxrtTNUqW0Lxaih/SZEPT44aBGnzkUU7 hAhyLtwCUmc8iJIFSWymmrP3bSvgtARPshkzj46kIskDiyPZst IP/UXJKavymDsBEyV5xzc6PqEb+qCMFS41lEfo/YrorB1TgSIe fBCaq3/eWNNoJxxjozdRhwJ3W0P4zml5ciandVbNXw2wYsbsZi 5FMr3vwX8A0KUMGS50av1tXprqIeuhMd3H0KI4vKG X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) On 03/18/2014 07:45 PM, Pádraig Brady wrote: > The fix looks good. It seems this bug was introduced > with the change to FTS in 5.1.0 (released Dec 2003) Wasn't it commit v5.2.1-690-gbc580f6? > I'll push soon in your name with these changes merged in. > $ git diff HEAD@{1} > > diff --git a/NEWS b/NEWS > index 35d48e5..3623674 100644 > --- a/NEWS > +++ b/NEWS > @@ -4,6 +4,9 @@ GNU coreutils NEWS -*- outline -*- > > ** Bug fixes > > + chmod -R --changes no longer issues erroneous warnings for files with special > + bits set. [bug introduced in coreutils-5.1.0] > + v5.3.0? See above. > cp -a, mv, and install --preserve-context, once again set the correct SELinux > context for existing directories in the destination. Previously they set > the context of an existing directory to that of its last copied descendent. > diff --git a/src/chmod.c b/src/chmod.c > index f9debde..ae8b6fb 100644 > --- a/src/chmod.c > +++ b/src/chmod.c > @@ -111,7 +111,7 @@ static struct option const long_options[] = > The old mode was OLD_MODE, but it was changed to NEW_MODE. */ > > static bool > -mode_changed (int dirfd, char const *file, char const *file_full_name, > +mode_changed (int dir_fd, char const *file, char const *file_full_name, > mode_t old_mode, mode_t new_mode) > { > if (new_mode & (S_ISUID | S_ISGID | S_ISVTX)) > @@ -121,7 +121,7 @@ mode_changed (int dirfd, char const *file, char const *file_full_name, > > struct stat new_stats; > > - if (fstatat (dirfd, file, &new_stats, 0) != 0) > + if (fstatat (dir_fd, file, &new_stats, 0) != 0) > { > if (! force_silent) > error (0, errno, _("getting new attributes of %s"), quote (file_full_name)); > diff --git a/tests/chmod/c-option.sh b/tests/chmod/c-option.sh > index 1dd9b9e..38b127b 100755 > --- a/tests/chmod/c-option.sh > +++ b/tests/chmod/c-option.sh > @@ -37,4 +37,15 @@ case "$(cat out)" in > *) cat out; fail=1 ;; > esac > > +# From V5.1.0 to 8.22 this would stat the wrong file and > +# give an erroneous ENOENT diagnostic > +mkdir -p a/b || framework_failure_ > +# chmod g+s might fail as detailed in setgid.sh > +# but we don't care about those edge cases here > +chmod g+s a/b > +# This should never warn, but in did when special s/ in / it / > +# bits are set on b (the common case under test) > +chmod -c -R g+w a 2>err > +test -s err && fail=1 > + > Exit $fail Thanks. One question: I did not dig into this deeper yet, but what exactly is the connection between "directory with special permissions" vs. "stat()ing the wrong file"? I'm asking because incidentally yesterday I saw the same warning from "chmod -R -c" when playing with recursive bind-mounts, i.e., there were no files or directories with special bits set. Thanks & have a nice day, Berny From unknown Mon Jun 23 11:27:14 2025 X-Loop: help-debbugs@gnu.org Subject: bug#17035: [PATCH] chmod -c -R produces errors with special permissions Resent-From: Bernhard Voelker Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 18 Mar 2014 22:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17035 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: patch To: 17035@debbugs.gnu.org, P@draigBrady.com, dylan@dylex.net Received: via spool by 17035-submit@debbugs.gnu.org id=B17035.139518202632317 (code B ref 17035); Tue, 18 Mar 2014 22:34:02 +0000 Received: (at 17035) by debbugs.gnu.org; 18 Mar 2014 22:33:46 +0000 Received: from localhost ([127.0.0.1]:40489 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WQ2Zu-0008PB-9r for submit@debbugs.gnu.org; Tue, 18 Mar 2014 18:33:46 -0400 Received: from moutng.kundenserver.de ([212.227.17.13]:51196) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WQ2Zr-0008P0-NO for 17035@debbugs.gnu.org; Tue, 18 Mar 2014 18:33:44 -0400 Received: from [192.168.1.11] (p5091ECDF.dip0.t-ipconnect.de [80.145.236.223]) by mrelayeu.kundenserver.de (node=mreue104) with ESMTP (Nemesis) id 0MQODc-1WXhXc1tIy-00ThT4; Tue, 18 Mar 2014 23:33:40 +0100 Message-ID: <5328C9C3.10002@bernhard-voelker.de> Date: Tue, 18 Mar 2014 23:33:39 +0100 From: Bernhard Voelker User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 References: <20140318160631.GA29034@datura.dylex.net> <53289449.7040707@draigBrady.com> In-Reply-To: <53289449.7040707@draigBrady.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Provags-ID: V02:K0:oHrs1/6rqImkXnuLRpacweJ7wObxxujKgzviV9Vk8SE O2YeUlSRgBUz0f4HfqDhxGRGcRu++PbJZk7E2cSt/2xn3MfV2J CyWa68GNm5MPzlv/qXJEMHcn9sBpIJltnRnNqDWelBeyqspnMX IuQW8vO3s+o9gPsoU2eTYbHVagslgoZtI/2Spl6PU+PyiJ/Xsn CNYlbyUiiFPWkW5/6oEThChbnleLeQ+K1eQsSJrZBJCUqM+9GA 3CJFuLxlOcTs/ksTI21L22g5rQPf2FyCFG/cvLh7ckD+JQHe3e nfnRLQ0xRuMsINSVUJySCPgyM2M4/oMbYs8XuDAmZFTCed/r81 k/90m927mV8dA/Ws1zLHNEFJbZcZyD2Ma5Q02nzaH X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) On 03/18/2014 07:45 PM, Pádraig Brady wrote: > @@ -121,7 +121,7 @@ mode_changed (int dirfd, char const *file, char const *file_full_name, > > struct stat new_stats; > > - if (fstatat (dirfd, file, &new_stats, 0) != 0) > + if (fstatat (dir_fd, file, &new_stats, 0) != 0) > { > if (! force_silent) > error (0, errno, _("getting new attributes of %s"), quote (file_full_name)); Another minor nit: the last line doesn't pass sc_long_lines: $ make syntax-check ... src/chmod.c:127: error (0, errno, _("getting new attributes of %s"), quote (file_full_name)); maint.mk: line(s) with more than 80 characters; reindent Thanks & have a nice day, Berny From unknown Mon Jun 23 11:27:14 2025 X-Loop: help-debbugs@gnu.org Subject: bug#17035: [PATCH] chmod -c -R produces errors with special permissions Resent-From: Jim Meyering Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 18 Mar 2014 23:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17035 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: patch To: 17035@debbugs.gnu.org, =?UTF-8?Q?P=C3=A1draig?= Brady , dylan@dylex.net Cc: 17035-done@debbugs.gnu.org Received: via spool by 17035-submit@debbugs.gnu.org id=B17035.13951858207433 (code B ref 17035); Tue, 18 Mar 2014 23:37:02 +0000 Received: (at 17035) by debbugs.gnu.org; 18 Mar 2014 23:37:00 +0000 Received: from localhost ([127.0.0.1]:40516 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WQ3Z5-0001vo-H5 for submit@debbugs.gnu.org; Tue, 18 Mar 2014 19:36:59 -0400 Received: from mail-pb0-f43.google.com ([209.85.160.43]:52154) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WQ3Z4-0001ve-5O; Tue, 18 Mar 2014 19:36:58 -0400 Received: by mail-pb0-f43.google.com with SMTP id um1so8015054pbc.2 for ; Tue, 18 Mar 2014 16:36:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=51LKdQzcdqPSQwSprpXBDLOeZMWjOrWNPoAzKN7aCms=; b=A/7KFmyZnr+zUIQ8DYg/+ztaO94xqj92LemjqUYYXOQcHCp13ox+VmOHFVH40B7KQr iHOXgIKlfsknLRXAlbHRaYci7IDXqeYPE3UbrDQANMPC19G1knYj0GSAp8lrTmTexEN8 hnkDbTGSiHZmP2A0aQnbD+PoxdGjQLJqsLI1Ld2zYYBOPcCKyzRVdJeAUy1lzgo51HPf knnwn4WgQBRUO9cDTtqA8clU0ERYkUxRC8CX1+AUe72ww60pThD3itIdfPQCqIJajzGZ iRGjfubi6BQkYAaY3FeZhPf5vWZmTZxFdN65NWbqvJrxrEB221RRXCdeFenTUt5i2vvM 7SXQ== X-Received: by 10.68.215.68 with SMTP id og4mr35931439pbc.112.1395185817312; Tue, 18 Mar 2014 16:36:57 -0700 (PDT) MIME-Version: 1.0 Received: by 10.68.201.231 with HTTP; Tue, 18 Mar 2014 16:36:37 -0700 (PDT) In-Reply-To: <53289449.7040707@draigBrady.com> References: <20140318160631.GA29034@datura.dylex.net> <53289449.7040707@draigBrady.com> From: Jim Meyering Date: Tue, 18 Mar 2014 16:36:37 -0700 X-Google-Sender-Auth: oXNjn2BuKEEi0WyRpv5ik_7pfSs Message-ID: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Tue, Mar 18, 2014 at 11:45 AM, P=E1draig Brady wrote: > diff --git a/tests/chmod/c-option.sh b/tests/chmod/c-option.sh ... > +# This should never warn, but in did when special > +# bits are set on b (the common case under test) > +chmod -c -R g+w a 2>err > +test -s err && fail=3D1 Thanks for adding the test. I have a small preference for using compare-vs-/dev/null rather than "test -s," since the former will print the unexpected output in the log, while the latter won't. So maybe this instead? compare /dev/null err || fail=3D1 From unknown Mon Jun 23 11:27:14 2025 X-Loop: help-debbugs@gnu.org Subject: bug#17035: [PATCH] chmod -c -R produces errors with special permissions Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 18 Mar 2014 23:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17035 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: patch To: Bernhard Voelker Cc: dylan@dylex.net, 17035@debbugs.gnu.org Received: via spool by 17035-submit@debbugs.gnu.org id=B17035.13951860887918 (code B ref 17035); Tue, 18 Mar 2014 23:42:01 +0000 Received: (at 17035) by debbugs.gnu.org; 18 Mar 2014 23:41:28 +0000 Received: from localhost ([127.0.0.1]:40523 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WQ3dQ-00023e-2U for submit@debbugs.gnu.org; Tue, 18 Mar 2014 19:41:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:8644) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WQ3dN-00023U-Ks for 17035@debbugs.gnu.org; Tue, 18 Mar 2014 19:41:26 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s2INfMGf014209 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 18 Mar 2014 19:41:22 -0400 Received: from [10.36.116.77] (ovpn-116-77.ams2.redhat.com [10.36.116.77]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s2INfJHl022071 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Tue, 18 Mar 2014 19:41:21 -0400 Message-ID: <5328D99F.8060901@draigBrady.com> Date: Tue, 18 Mar 2014 23:41:19 +0000 From: =?UTF-8?Q?P=C3=A1draig?= Brady User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 References: <20140318160631.GA29034@datura.dylex.net> <53289449.7040707@draigBrady.com> <5328C631.6020809@bernhard-voelker.de> In-Reply-To: <5328C631.6020809@bernhard-voelker.de> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) On 03/18/2014 10:18 PM, Bernhard Voelker wrote: > On 03/18/2014 07:45 PM, Pádraig Brady wrote: >> The fix looks good. It seems this bug was introduced >> with the change to FTS in 5.1.0 (released Dec 2003) > > Wasn't it commit v5.2.1-690-gbc580f6? I think that restricted the issue to if (new_mode & (S_ISUID | S_ISGID | S_ISVTX)) but the stat on the relative name was there previously? > One question: I did not dig into this deeper yet, but what exactly > is the connection between "directory with special permissions" > vs. "stat()ing the wrong file"? > I'm asking because incidentally yesterday I saw the same warning > from "chmod -R -c" when playing with recursive bind-mounts, i.e., > there were no files or directories with special bits set. Interesting. Looking at the code seems that message is restricted to the above condition where those bits are set. Can you reproduce? thanks, Pádraig. From unknown Mon Jun 23 11:27:14 2025 X-Loop: help-debbugs@gnu.org Subject: bug#17035: [PATCH] chmod -c -R produces errors with special permissions Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 19 Mar 2014 00:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17035 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: patch To: Jim Meyering Cc: dylan@dylex.net, 17035@debbugs.gnu.org Received: via spool by 17035-submit@debbugs.gnu.org id=B17035.139518797111559 (code B ref 17035); Wed, 19 Mar 2014 00:13:02 +0000 Received: (at 17035) by debbugs.gnu.org; 19 Mar 2014 00:12:51 +0000 Received: from localhost ([127.0.0.1]:40530 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WQ47m-00030N-LS for submit@debbugs.gnu.org; Tue, 18 Mar 2014 20:12:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:22796) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WQ47k-000304-6g for 17035@debbugs.gnu.org; Tue, 18 Mar 2014 20:12:48 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s2J0CeEp014348 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 18 Mar 2014 20:12:41 -0400 Received: from [10.36.116.77] (ovpn-116-77.ams2.redhat.com [10.36.116.77]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s2INeBS2015933 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Tue, 18 Mar 2014 19:40:13 -0400 Message-ID: <5328D95B.10406@draigBrady.com> Date: Tue, 18 Mar 2014 23:40:11 +0000 From: =?UTF-8?Q?P=C3=A1draig?= Brady User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 References: <20140318160631.GA29034@datura.dylex.net> <53289449.7040707@draigBrady.com> In-Reply-To: X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) On 03/18/2014 11:36 PM, Jim Meyering wrote: > compare /dev/null err || fail=1 Yes better thanks From unknown Mon Jun 23 11:27:14 2025 X-Loop: help-debbugs@gnu.org Subject: bug#17035: [PATCH] chmod -c -R produces errors with special permissions Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 19 Mar 2014 02:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17035 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: patch To: Bernhard Voelker Cc: dylan@dylex.net, 17035@debbugs.gnu.org Received: via spool by 17035-submit@debbugs.gnu.org id=B17035.139519674628714 (code B ref 17035); Wed, 19 Mar 2014 02:40:02 +0000 Received: (at 17035) by debbugs.gnu.org; 19 Mar 2014 02:39:06 +0000 Received: from localhost ([127.0.0.1]:40591 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WQ6PJ-0007T3-VC for submit@debbugs.gnu.org; Tue, 18 Mar 2014 22:39:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55137) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WQ6PE-0007SZ-UF for 17035@debbugs.gnu.org; Tue, 18 Mar 2014 22:39:02 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s2J2cva2005827 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 18 Mar 2014 22:38:58 -0400 Received: from [10.36.116.23] (ovpn-116-23.ams2.redhat.com [10.36.116.23]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s2J2cs7F015487 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Tue, 18 Mar 2014 22:38:56 -0400 Message-ID: <5329033E.2030702@draigBrady.com> Date: Wed, 19 Mar 2014 02:38:54 +0000 From: =?UTF-8?Q?P=C3=A1draig?= Brady User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 References: <20140318160631.GA29034@datura.dylex.net> <53289449.7040707@draigBrady.com> <5328C631.6020809@bernhard-voelker.de> <5328D99F.8060901@draigBrady.com> In-Reply-To: <5328D99F.8060901@draigBrady.com> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) On 03/18/2014 11:41 PM, Pádraig Brady wrote: > On 03/18/2014 10:18 PM, Bernhard Voelker wrote: >> On 03/18/2014 07:45 PM, Pádraig Brady wrote: >>> The fix looks good. It seems this bug was introduced >>> with the change to FTS in 5.1.0 (released Dec 2003) >> >> Wasn't it commit v5.2.1-690-gbc580f6? > > I think that restricted the issue to if (new_mode & (S_ISUID | S_ISGID | S_ISVTX)) > but the stat on the relative name was there previously? But if that was the case then previous to v5.2.1 release would have gotten the diagnostic without special mode bits, which is unlikely as the issue would then very likely have been noticed. So I dug a little further and the issue seems to be with where fts was improved to not change directory when traversing in coreutils 6.0 in: http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commit;h=c1994c16 Change is now pushed: http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commit;h=09eda9ed thanks, Pádraig. From unknown Mon Jun 23 11:27:14 2025 X-Loop: help-debbugs@gnu.org Subject: bug#17035: [PATCH] chmod -c -R produces errors with special permissions Resent-From: Bernhard Voelker Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 19 Mar 2014 07:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17035 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: patch To: =?UTF-8?Q?P=C3=A1draig?= Brady Cc: dylan@dylex.net, 17035@debbugs.gnu.org Received: via spool by 17035-submit@debbugs.gnu.org id=B17035.13952158424596 (code B ref 17035); Wed, 19 Mar 2014 07:58:02 +0000 Received: (at 17035) by debbugs.gnu.org; 19 Mar 2014 07:57:22 +0000 Received: from localhost ([127.0.0.1]:40663 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WQBNJ-0001C3-51 for submit@debbugs.gnu.org; Wed, 19 Mar 2014 03:57:21 -0400 Received: from moutng.kundenserver.de ([212.227.17.10]:57267) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WQBNC-0001Bm-M0 for 17035@debbugs.gnu.org; Wed, 19 Mar 2014 03:57:15 -0400 Received: from [10.0.2.15] (gw.camline.com [62.153.148.194]) by mrelayeu.kundenserver.de (node=mreue103) with ESMTP (Nemesis) id 0MRijR-1WWSlD2Rnl-00StwW; Wed, 19 Mar 2014 08:57:11 +0100 Message-ID: <53294DD5.4000903@bernhard-voelker.de> Date: Wed, 19 Mar 2014 08:57:09 +0100 From: Bernhard Voelker User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 References: <20140318160631.GA29034@datura.dylex.net> <53289449.7040707@draigBrady.com> <5328C631.6020809@bernhard-voelker.de> <5328D99F.8060901@draigBrady.com> In-Reply-To: <5328D99F.8060901@draigBrady.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Provags-ID: V02:K0:cYi6s+qaEzHohNFFb4YaTjFb5AHB4aoDyhILskq6Ybi lDj8f36Z7FXIb6NclEXAlUkNrVFhSmL2ehgi69QJ8OedVh+8K5 xHWuqlxihGs3piqOSVFhQ/+OGfVT7oa2D3iiBhdLmrHwo7QzSb OEFOJO1oaQ7wm3moqt1aaIyXqFdg/qVlacKKH1/Yhmr/CPKV5c gJWB6x9cm3YHIUbySQM43JO0tekRPP3YRZ5ePtNThui7Afd5lP NJtN8V0Lck7j+JZJktdhvGVum/n47V5dRoi/xkWtQb6PahxeLE GQ8Qkg2o6xwkbe7yzVn80PHT4SL/Fq+zs6HvZ5A/0YJWOkKdsr VsXI5DKRy0+gJtiwYdYpDH4gMNjQ7KzGmnHbxE2Tm X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) On 03/19/2014 12:41 AM, Pádraig Brady wrote: > On 03/18/2014 10:18 PM, Bernhard Voelker wrote: >> One question: I did not dig into this deeper yet, but what exactly >> is the connection between "directory with special permissions" >> vs. "stat()ing the wrong file"? >> I'm asking because incidentally yesterday I saw the same warning >> from "chmod -R -c" when playing with recursive bind-mounts, i.e., >> there were no files or directories with special bits set. > > Interesting. Looking at the code seems that message > is restricted to the above condition where those bits are set. > Can you reproduce? Yes, fortunately - and now I see that my case implicitly was using +t mode because of the TMPFS file system type: $ mount -t tmpfs /mnt /mnt $ mkdir -p /mnt/dir/mnt $ mount --bind /mnt /mnt/dir/mnt $ cd /mnt $ ln -s dir/mnt/dir d $ ls -ldogi . d dir dir/mnt 186326 drwxrwxrwt 3 80 Mar 19 08:31 . 188029 lrwxrwxrwx 1 11 Mar 19 08:31 d -> dir/mnt/dir 188511 drwxr-xrwx 3 60 Mar 19 08:31 dir 186326 drwxrwxrwt 3 80 Mar 19 08:31 dir/mnt $ chmod -Rc o+w dir mode of ‘dir’ changed from 0755 (rwxr-xr-x) to 0757 (rwxr-xrwx) chmod: getting new attributes of ‘mnt’: No such file or directory mode of ‘dir/mnt/dir/mnt’ changed from 0755 (rwxr-xr-x) to 0757 (rwxr-xrwx) As a final side note to this case, I want to mention that the issue also happens with the -v option, of course: $ mkdir -p a/b $ chmod +t a/b $ chmod -Rv o+w a mode of ‘a’ changed from 0755 (rwxr-xr-x) to 0757 (rwxr-xrwx) chmod: getting new attributes of ‘b’: No such file or directory mode of ‘a/b’ retained as 1757 (rwxr-xrwt) Thanks & have a nice day, Berny