Re: git: fae467c2212c - main - chflags(1): Fix -f option
Date: Tue, 30 Jan 2024 18:12:10 UTC
On Tue, Jan 30, 2024 at 05:22:38PM +0000, Jessica Clarke wrote: > On 30 Jan 2024, at 17:10, Konstantin Belousov <kib@FreeBSD.org> wrote: > > > > The branch main has been updated by kib: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=fae467c2212ced8e82f5fa385d316445c8874941 > > > > commit fae467c2212ced8e82f5fa385d316445c8874941 > > Author: Ricardo Branco <rbranco@suse.de> > > AuthorDate: 2024-01-29 22:17:47 +0000 > > Commit: Konstantin Belousov <kib@FreeBSD.org> > > CommitDate: 2024-01-30 17:08:03 +0000 > > > > chflags(1): Fix -f option > > > > As stated in the man page, -f must not emit warning on error, and must > > not set the utility exit code. > > But that was already true of the code; this is not what the bug fix is. > The problem was that it would print out the filename with -v (and flags > change attempted with -vv) as if it succeeded, when it didn’t. Right, sorry it slipped. > > But I’m also not entirely convinced this new code is right with respect > to SIGINFO, as it won’t print anything until it reaches a file that > doesn’t cause an error? I’d normally expect SIGINFO to tell me exactly > what it is doing or just did. This should fix siginfo. commit 57658578cf42fc9b6e8906a05b9effcd03a437a1 Author: Konstantin Belousov <kib@FreeBSD.org> Date: Tue Jan 30 20:07:59 2024 +0200 chflags(1): obey siginfo request on chflagsat(2) failure Noted by: jrtc27 Sponsored by: The FreeBSD Foundation MFC after: 1 week diff --git a/bin/chflags/chflags.c b/bin/chflags/chflags.c index 0972240558df..13a327d9426c 100644 --- a/bin/chflags/chflags.c +++ b/bin/chflags/chflags.c @@ -183,10 +183,12 @@ main(int argc, char *argv[]) continue; if (chflagsat(AT_FDCWD, p->fts_accpath, newflags, atflag) == -1) { - if (!fflag) { + if (!fflag || siginfo) { warn("%s", p->fts_path); - rval = 1; + siginfo = 0; } + if (!fflag) + rval = 1; } else if (vflag || siginfo) { (void)printf("%s", p->fts_path); if (vflag > 1 || siginfo)