NetBSD Problem Report #46786
From simonb@thistledown.com.au Thu Aug 9 03:52:41 2012
Return-Path: <simonb@thistledown.com.au>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
by www.NetBSD.org (Postfix) with ESMTP id 38FD663B85F
for <gnats-bugs@gnats.NetBSD.org>; Thu, 9 Aug 2012 03:52:41 +0000 (UTC)
Message-Id: <20120809035237.1AEE25989B@thoreau.thistledown.com.au>
Date: Thu, 9 Aug 2012 13:52:37 +1000 (EST)
From: Simon Burge <simonb@NetBSD.org>
Reply-To: Simon Burge <simonb@NetBSD.org>
To: gnats-bugs@gnats.NetBSD.org
Subject: tar can not archive "old" files
X-Send-Pr-Version: 3.95
>Number: 46786
>Category: bin
>Synopsis: tar can not archive "old" files
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Aug 09 03:55:00 +0000 2012
>Last-Modified: Thu Aug 09 08:10:03 +0000 2012
>Originator: Simon Burge
>Release: NetBSD 6.0_BETA2 from July 16
>Environment:
System: NetBSD silmech.thistledown.com.au 6.0_BETA2 NetBSD 6.0_BETA2 (GENERIC) #0: Mon Jul 16 23:29:03 EST 2012 simonb@silmech.thistledown.com.au:/home/simonb/netbsd/build6/amd64/obj/home/simonb/netbsd/src6/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
tar give a "Ustar MTIME header field is too small for <file>"
message when trying to archive a "old" file (in my case a file
with a timestamp from 1937), then appears to create an invalid
archive that doesn't include the file.
A tar binary from an NetBSD 4.0 system will successfully archive
and an extract the same old file.
I've marked this PR as serious/high as it is both a regression
and also because a standard way of backing up files doesn't
work.
>How-To-Repeat:
silmech 1035> echo hi > foo
silmech 1036> tar cvf foo.tar foo
foo
tar: ustar vol 1, 1 files, 0 bytes read, 10240 bytes written in 1 secs (10240 bytes/sec)
silmech 1037> tar tvf foo.tar
-rw-r--r-- 1 simonb wheel 3 Aug 9 13:34 foo
tar: ustar vol 1, 1 files, 10240 bytes read, 0 bytes written in 1 secs (10240 bytes/sec)
silmech 1038> touch -t 193712070238.22 foo
silmech 1039> rm foo.tar
silmech 1040> tar cvf foo.tar foo
tar: Ustar MTIME header field is too small for foo
tar: ustar vol 1, 1 files, 0 bytes read, 10240 bytes written in 1 secs (10240 bytes/sec)
fooExit 1
silmech 1041> tar tvf foo.tar
tar: Cannot identify format. Searching...
tar: End of archive volume 1 reached
tar: Sorry, unable to determine archive format.
Exit 1
silmech 1042> ls -l foo.tar
-rw-r--r-- 1 simonb wheel 10240 Aug 9 13:35 foo.tar
silmech 1043> od -x foo.tar
0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
0024000
>Fix:
Non given. Or grab a tar binary from an older NetBSD release.
>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/46786 CVS commit: src/bin/pax
Date: Thu, 9 Aug 2012 04:09:22 -0400
Module Name: src
Committed By: christos
Date: Thu Aug 9 08:09:22 UTC 2012
Modified Files:
src/bin/pax: cpio.c extern.h gen_subs.c pax.h tar.c
Log Message:
PR/46786: Simon Burge: After conversion to 64 bit time_t, tar/pax/cpio
erroneously think that negative time_t's never fit in 32 bits. Rework
conversion code to always use uintmax_t, and detect negative values.
XXX[1]: Perhaps we should do the same (use a signed conversion) for all
fields not just for time_t
XXX[2]: pullup for 6
To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/bin/pax/cpio.c
cvs rdiff -u -r1.58 -r1.59 src/bin/pax/extern.h
cvs rdiff -u -r1.35 -r1.36 src/bin/pax/gen_subs.c
cvs rdiff -u -r1.30 -r1.31 src/bin/pax/pax.h
cvs rdiff -u -r1.69 -r1.70 src/bin/pax/tar.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
(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.