Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Oct 2002 21:58:24 +0300
From:      Ruslan Ermilov <ru@FreeBSD.org>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        Kris Kennaway <kris@obsecurity.org>, current@FreeBSD.org
Subject:   install -C not preserving ctimes (was: Re: UPDATING entry needed (Re: Building KDE3))
Message-ID:  <20021023185824.GB8656@sunbay.com>
In-Reply-To: <20021024041602.T23784-100000@gamplex.bde.org>
References:  <20021023111852.GB31781@sunbay.com> <20021024041602.T23784-100000@gamplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--adJ1OR3c6QgCpb/j
Content-Type: multipart/mixed; boundary="CdrF4e02JqNVZeln"
Content-Disposition: inline


--CdrF4e02JqNVZeln
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Oct 24, 2002 at 04:21:09AM +1000, Bruce Evans wrote:
> On Wed, 23 Oct 2002, Ruslan Ermilov wrote:
>=20
> > 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.
>=20
> 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.
>=20
The attached seems to be fixing it, please review.


Cheers,
--=20
Ruslan Ermilov		Sysadmin and DBA,
ru@sunbay.com		Sunbay Software AG,
ru@FreeBSD.org		FreeBSD committer,
+380.652.512.251	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age

--CdrF4e02JqNVZeln
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=p
Content-Transfer-Encoding: quoted-printable

Index: xinstall.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
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 !=3D (gid_t)-1 && gid !=3D to_sb.st_gid) ||
 	    (uid !=3D (uid_t)-1 && uid !=3D to_sb.st_uid) ||
-	    (mode !=3D to_sb.st_mode)) {
+	    (mode !=3D (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);
 		}
=20
-	if (mode !=3D to_sb.st_mode)
+	if (mode !=3D (to_sb.st_mode & ALLPERMS))
 		if (fchmod(to_fd, mode)) {
 			serrno =3D 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) !=3D to_sb.st_flags) &&
+	    fchflags(to_fd,
 	    flags & SETFLAGS ? fset : from_sb.st_flags & ~UF_NODUMP)) {
 		if (flags & SETFLAGS) {
 			if (errno =3D=3D EOPNOTSUPP)

--CdrF4e02JqNVZeln--

--adJ1OR3c6QgCpb/j
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)

iD8DBQE9tvFQUkv4P6juNwoRAptFAJ9evFm/Zt5ZBKtl5pBkiwLswG2h0wCeL3nk
KhEA4GzCdREL5R8hYcP/QBM=
=s4Mn
-----END PGP SIGNATURE-----

--adJ1OR3c6QgCpb/j--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021023185824.GB8656>