From owner-freebsd-bugs Sun Jul 16 13:20:12 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id D085D37B681 for ; Sun, 16 Jul 2000 13:20:00 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id NAA78089; Sun, 16 Jul 2000 13:20:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from news.IAEhv.nl (news.IAE.nl [194.151.64.4]) by hub.freebsd.org (Postfix) with ESMTP id CEA6E37B5AD for ; Sun, 16 Jul 2000 13:11:08 -0700 (PDT) (envelope-from Arjan.deVet@adv.iae.nl) Received: (from uucp@localhost) by news.IAEhv.nl (8.9.1/8.9.1) with IAEhv.nl id WAA22948 for FreeBSD-gnats-submit@freebsd.org; Sun, 16 Jul 2000 22:11:08 +0200 (MET DST) Received: by adv.iae.nl (Postfix, from userid 100) id 9F4BB22E6; Sun, 16 Jul 2000 22:10:30 +0200 (CEST) Message-Id: <20000716201030.9F4BB22E6@adv.iae.nl> Date: Sun, 16 Jul 2000 22:10:30 +0200 (CEST) From: Arjan de Vet Reply-To: Arjan.deVet@adv.iae.nl To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/19973: restore does not set access/modification times correctly for immutable files Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 19973 >Category: bin >Synopsis: restore does not set access/modification times correctly for immutable files >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Jul 16 13:20:00 PDT 2000 >Closed-Date: >Last-Modified: >Originator: Arjan de Vet >Release: FreeBSD 4.0-STABLE i386 >Organization: >Environment: FreeBSD adv.iae.nl 4.0-STABLE FreeBSD 4.0-STABLE #23: Sat Jul 15 17:20:14 CEST 2000 root@adv.iae.nl:/usr/src/sys/compile/ADV i386 >Description: When restoring some tapes I noticed that some files did not get their original access and modification timestamps but the current time instead. I found out that these were all immutable files. The restore program sets the file flags on restored files with (f)chflags before setting the times with utimes, causing the utimes call to fail. By reversing these calls the times get set correctly for immutable files. >How-To-Repeat: Dump the root fs to a file or tape and restore it somewhere else. The restored kernel file (normally immutable) will have different access and modification times when compared with the original /kernel file. >Fix: Index: dirs.c =================================================================== RCS file: /home/freebsd/CVS/src/sbin/restore/dirs.c,v retrieving revision 1.14 diff -u -r1.14 dirs.c --- dirs.c 1999/08/28 00:14:05 1.14 +++ dirs.c 2000/07/15 14:33:15 @@ -631,8 +631,8 @@ cp = myname(ep); (void) chown(cp, node.uid, node.gid); (void) chmod(cp, node.mode); - (void) chflags(cp, node.flags); utimes(cp, node.timep); + (void) chflags(cp, node.flags); ep->e_flags &= ~NEW; } } Index: tape.c =================================================================== RCS file: /home/freebsd/CVS/src/sbin/restore/tape.c,v retrieving revision 1.16 diff -u -r1.16 tape.c --- tape.c 1999/08/28 00:14:08 1.16 +++ tape.c 2000/07/15 14:33:15 @@ -581,9 +581,9 @@ } (void) chown(name, curfile.dip->di_uid, curfile.dip->di_gid); (void) chmod(name, mode); + utimes(name, timep); (void) chflags(name, flags); skipfile(); - utimes(name, timep); return (GOOD); case IFCHR: @@ -603,9 +603,9 @@ } (void) chown(name, curfile.dip->di_uid, curfile.dip->di_gid); (void) chmod(name, mode); + utimes(name, timep); (void) chflags(name, flags); skipfile(); - utimes(name, timep); return (GOOD); case IFREG: @@ -625,10 +625,10 @@ } (void) fchown(ofile, curfile.dip->di_uid, curfile.dip->di_gid); (void) fchmod(ofile, mode); - (void) fchflags(ofile, flags); getfile(xtrfile, xtrskip); (void) close(ofile); utimes(name, timep); + (void) chflags(name, flags); return (GOOD); } /* NOTREACHED */ >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message