Date: Fri, 1 Feb 2008 15:52:37 GMT From: Ighighi <ighighi@gmail.com> To: freebsd-gnats-submit@FreeBSD.org Subject: bin/120208: [patch]: gzip cannot preserve utimes() because it first sets chflags() Message-ID: <200802011552.m11FqbO4065813@www.freebsd.org> Resent-Message-ID: <200802011600.m11G05hB000913@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 120208 >Category: bin >Synopsis: [patch]: gzip cannot preserve utimes() because it first sets chflags() >Confidential: no >Severity: serious >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Feb 01 16:00:04 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Ighighi >Release: 6.3-STABLE >Organization: >Environment: FreeBSD orion 6.3-STABLE FreeBSD 6.3-STABLE #0: Fri Jan 25 17:39:39 VET 2008 root@orion.nebula.mil:/usr/obj/usr/src/sys/CUSTOM i386 >Description: gzip(1) cannot preserve file's times from input files because it first sets the file's flags. It happens with the immutable flag. >How-To-Repeat: $ /usr/bin/touch /tmp/foo $ /bin/chflags uchg /tmp/foo $ /usr/bin/gzip -v /tmp/foo gzip: couldn't utimes: /tmp/foo.gz: Operation not permitted /tmp/foo: -99.9% -- replaced with /tmp/foo.gz >Fix: Attached patch available Patch attached with submission follows: --- gzip.c.orig 2007-08-05 22:31:25.000000000 -0400 +++ gzip.c 2008-02-01 11:08:35.953127226 -0430 @@ -1075,14 +1077,14 @@ copymodes(int fd, const struct stat *sbp if (fchmod(fd, sb.st_mode) < 0) maybe_warn("couldn't fchmod: %s", file); - /* only try flags if they exist already */ - if (sb.st_flags != 0 && fchflags(fd, sb.st_flags) < 0) - maybe_warn("couldn't fchflags: %s", file); - TIMESPEC_TO_TIMEVAL(×[0], &sb.st_atimespec); TIMESPEC_TO_TIMEVAL(×[1], &sb.st_mtimespec); if (futimes(fd, times) < 0) maybe_warn("couldn't utimes: %s", file); + + /* only try flags if they exist already */ + if (sb.st_flags != 0 && fchflags(fd, sb.st_flags) < 0) + maybe_warn("couldn't fchflags: %s", file); } #endif >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200802011552.m11FqbO4065813>