On Thu, Oct 24, 2002 at 04:21:09AM +1000, Bruce Evans wrote:
> On Wed, 23 Oct 2002, Ruslan Ermilov wrote:
> 
> > On Tue, Oct 22, 2002 at 10:34:25PM -0700, Kris Kennaway wrote:
> > > I normally do something like:
> > >
> > > find /usr/include -ctime +1 -type f -delete
> > >
> > > To clean out stale includes after a buildworld.  Perhaps something
> > > like this should be added to the end of the directions.
> > >
> > Headers are normally installed with ``install -C'', and those
> > that did not change recently will not be touched at all.  The
> > command above will effectively remove these.
> 
> Only if someone "fix"es ``install -C'' to not change ctimes.  -C only
> causes mtimes to be preserved.  ``install -C'' often needs to touch
> metadata and it does this unconditionally to simplify things; this has
> the somewhat intentional side effect of changing the ctime.
> 
The attached seems to be fixing it, please review.


Cheers,
-- 
Ruslan Ermilov          Sysadmin and DBA,
[EMAIL PROTECTED]           Sunbay Software AG,
[EMAIL PROTECTED]          FreeBSD committer,
+380.652.512.251        Simferopol, Ukraine

http://www.FreeBSD.org  The Power To Serve
http://www.oracle.com   Enabling The Information Age
Index: xinstall.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/xinstall/xinstall.c,v
retrieving revision 1.57
diff -u -p -r1.57 xinstall.c
--- xinstall.c  4 Sep 2002 23:29:09 -0000       1.57
+++ xinstall.c  23 Oct 2002 18:48:14 -0000
@@ -451,7 +451,7 @@ install(const char *from_name, const cha
         */
        if ((gid != (gid_t)-1 && gid != to_sb.st_gid) ||
            (uid != (uid_t)-1 && uid != to_sb.st_uid) ||
-           (mode != to_sb.st_mode)) {
+           (mode != (to_sb.st_mode & ALLPERMS))) {
                /* Try to turn off the immutable bits. */
                if (to_sb.st_flags & NOCHANGEBITS)
                        (void)fchflags(to_fd, to_sb.st_flags & ~NOCHANGEBITS);
@@ -466,7 +466,7 @@ install(const char *from_name, const cha
                        err(EX_OSERR,"%s: chown/chgrp", to_name);
                }
 
-       if (mode != to_sb.st_mode)
+       if (mode != (to_sb.st_mode & ALLPERMS))
                if (fchmod(to_fd, mode)) {
                        serrno = errno;
                        (void)unlink(to_name);
@@ -481,7 +481,9 @@ install(const char *from_name, const cha
         * trying to turn off UF_NODUMP.  If we're trying to set real flags,
         * then warn if the the fs doesn't support it, otherwise fail.
         */
-       if (!devnull && fchflags(to_fd,
+       if (!devnull && (flags & SETFLAGS ||
+           (from_sb.st_flags & ~UF_NODUMP) != to_sb.st_flags) &&
+           fchflags(to_fd,
            flags & SETFLAGS ? fset : from_sb.st_flags & ~UF_NODUMP)) {
                if (flags & SETFLAGS) {
                        if (errno == EOPNOTSUPP)

Attachment: msg44834/pgp00000.pgp
Description: PGP signature

Reply via email to