NetBSD Problem Report #37944

From martin@duskware.de  Sun Feb  3 10:32:28 2008
Return-Path: <martin@duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id B8E0963B853
	for <gnats-bugs@gnats.netbsd.org>; Sun,  3 Feb 2008 10:32:27 +0000 (UTC)
Message-Id: <20080203102544.9389363B853@narn.NetBSD.org>
Date: Sun,  3 Feb 2008 10:25:44 +0000 (UTC)
From: ighighi@gmail.com
Reply-To: ighighi@gmail.com
To: netbsd-bugs-owner@NetBSD.org
Subject: [patch]: gzip cannot preserve utimes() because it first sets chflags()
X-Send-Pr-Version: www-1.0

>Number:         37944
>Category:       bin
>Synopsis:       [patch]: gzip cannot preserve utimes() because it first sets chflags()
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 03 10:35:00 +0000 2008
>Last-Modified:  Mon Feb 04 05:25:01 +0000 2008
>Originator:     Ighighi
>Release:        
>Organization:
>Environment:
>Description:
Both gzip & gunzip fail to preserve the input file's times on files with
the immutable and/or append flags because chflags() is called before utimes().

>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:
I sent a simple patch to FreeBSD, making it run utimes() / chflags()
http://www.freebsd.org/cgi/query-pr.cgi?pr=120208

Note that src/usr.bin/compress/compress.c does the right thing...

>Audit-Trail:
From: matthew green <mrg@eterna.com.au>
To: gnats-bugs@NetBSD.org
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: re: bin/37944: [patch]: gzip cannot preserve utimes() because it first sets chflags() 
Date: Mon, 04 Feb 2008 16:23:06 +1100


    >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:
    I sent a simple patch to FreeBSD, making it run utimes() / chflags()
    http://www.freebsd.org/cgi/query-pr.cgi?pr=120208

    Note that src/usr.bin/compress/compress.c does the right thing...


 interesting.... won't this have the problem of setting the
 file mod time to "now"?  i'm not sure how to avoid that,
 and also fix this bug... 

 ideas anyone?


 .mrg.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.