From: Philip Guenther Subject: Re: install(1): spread less unneeded panick To: Martijn van Duren Cc: "tech@openbsd.org" Date: Fri, 13 Jun 2025 09:59:54 -0700 ok guenther@ On Friday, June 13, 2025, Martijn van Duren wrote: > Hello tech@, > > With ext2fs_vnops.c r1.95 only root can change the immutable and append > flags for a file. I only noticed this change because install(1) started > throwing warnings in my face. > > Since there's no need to yell at the user that they have no permission > to change the flags to a state that's already in effect, I propose that > we compare current state to desired state before calling fchflags(2). > > Thanks to tb@ for pointing me to the latest commit. > > While here, change warnx(..., strerror(errno)) to warn(...). > > martijn@ > > diff /usr/src > path + /usr/src > commit - c8a32696b4e4595ecb6be82f64a8437903e801c2 > blob - dccb178e599714a492d0bcb769c2c08dade1169b > file + usr.bin/xinstall/xinstall.c > --- usr.bin/xinstall/xinstall.c > +++ usr.bin/xinstall/xinstall.c > @@ -353,10 +353,14 @@ install(char *from_name, char *to_name, u_long fset, > u > * If provided a set of flags, set them, otherwise, preserve the > * flags, except for the dump flag. > */ > - if (fchflags(to_fd, > - flags & SETFLAGS ? fset : from_sb.st_flags & ~UF_NODUMP)) { > - if (errno != EOPNOTSUPP || (from_sb.st_flags & ~UF_NODUMP) > != 0) > - warnx("%s: chflags: %s", target_name, > strerror(errno)); > + if (!(flags & SETFLAGS)) > + fset = from_sb.st_flags & ~UF_NODUMP; > + if (to_sb.st_flags != fset) { > + if (fchflags(to_fd, fset) != 0) { > + if (errno != EOPNOTSUPP || > + (from_sb.st_flags & ~UF_NODUMP) != 0) > + warn("%s: chflags: %s", target_name); > + } > } > > if (flags & USEFSYNC) > >