Bug 120208

Summary: [patch]: gzip(1) cannot preserve utimes() because it first sets chflags()
Product: Base System Reporter: Ighighi <ighighi>
Component: binAssignee: Robert Watson <rwatson>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 6.3-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Ighighi 2008-02-01 16:00:04 UTC
gzip(1) cannot preserve file's times from input files because it first sets the file's flags.  It happens with the immutable flag.

Fix: Attached patch available

Patch attached with submission follows:
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
Comment 1 dfilter service freebsd_committer freebsd_triage 2008-03-09 11:16:47 UTC
rwatson     2008-03-09 11:16:42 UTC

  FreeBSD src repository

  Modified files:
    usr.bin/gzip         gzip.c 
  Log:
  When gzipping to a target file, only set the source file flags on the
  target file after the timestamp has been set; otherwise setting the
  timestamp will fail if the flags don't permit it (i.e., uchg).
  
  MFC after:      1 week
  PR:             120208
  Submitted by:   Ighighi <ighighi at gmail.com>
  
  Revision  Changes    Path
  1.5       +4 -4      src/usr.bin/gzip/gzip.c
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 2 Robert Watson freebsd_committer freebsd_triage 2008-03-09 11:19:16 UTC
Responsible Changed
From-To: freebsd-bugs->rwatson

Take ownership of this PR.
Comment 3 Robert Watson freebsd_committer freebsd_triage 2008-03-09 11:22:06 UTC
State Changed
From-To: open->patched

Transition to patched state while awaiting MFC.
Comment 4 dfilter service freebsd_committer freebsd_triage 2008-03-16 18:53:22 UTC
rwatson     2008-03-16 18:53:17 UTC

  FreeBSD src repository

  Modified files:        (Branch: RELENG_7)
    usr.bin/gzip         gzip.c 
  Log:
  Merge gzip.c:1.5 from HEAD to RELENG_7:
  
    When gzipping to a target file, only set the source file flags on the
    target file after the timestamp has been set; otherwise setting the
    timestamp will fail if the flags don't permit it (i.e., uchg).
  
    PR:             120208
    Submitted by:   Ighighi <ighighi at gmail.com>
  
  Revision  Changes    Path
  1.4.2.2   +4 -4      src/usr.bin/gzip/gzip.c
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 5 Robert Watson freebsd_committer freebsd_triage 2009-02-10 09:39:08 UTC
State Changed
From-To: patched->closed

Close following MFC.  This fix appeared in FreeBSD 7.1.