From owner-cvs-src@FreeBSD.ORG Fri Jan 18 05:05:58 2008 Return-Path: Delivered-To: cvs-src@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B3E6D16A417; Fri, 18 Jan 2008 05:05:58 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 82BC713C458; Fri, 18 Jan 2008 05:05:58 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m0I55wiL042845; Fri, 18 Jan 2008 05:05:58 GMT (envelope-from kientzle@repoman.freebsd.org) Received: (from kientzle@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m0I55woO042844; Fri, 18 Jan 2008 05:05:58 GMT (envelope-from kientzle) Message-Id: <200801180505.m0I55woO042844@repoman.freebsd.org> From: Tim Kientzle Date: Fri, 18 Jan 2008 05:05:58 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Cc: Subject: cvs commit: src/lib/libarchive archive_write_disk.c src/lib/libarchive/test Makefile test_write_disk_hardlink.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jan 2008 05:05:58 -0000 kientzle 2008-01-18 05:05:58 UTC FreeBSD src repository Modified files: lib/libarchive archive_write_disk.c lib/libarchive/test Makefile Added files: lib/libarchive/test test_write_disk_hardlink.c Log: Issues with hardlinks in newc-format files prompted me to write a new test to exercise the hardlink strategies used by different archive formats (tar, old cpio, new cpio). This uncovered two problems, both fixed by this commit: 1) Enforce file size when writing files to disk. 2) When restoring hardlink entries, if they have data associated, go ahead and open the file so we can write the data. In particular, this fixes bsdtar/bsdcpio extraction of new cpio formats where the "original" is empty and the subsequent "hardlink" entry actually carries the data. It also provides correct behavior for old cpio archives where hardlinked entries have their bodies stored multiple times in the archive; the last body should always be the one that ends up in the final file. The new pax format also permits (but does not require) hardlinks to carry file data; again, the last contents should always win. Note that with any of these, a size of zero on a hardlink simply means that the hardlink carries no data; it does not mean that the file has zero size. A non-zero size on a hardlink does provide the file size. Thanks to: John Baldwin, for reminding me about this long-standing bug and sending me a simple example archive that prompted this test case Revision Changes Path 1.19 +32 -6 src/lib/libarchive/archive_write_disk.c 1.13 +1 -0 src/lib/libarchive/test/Makefile 1.1 +165 -0 src/lib/libarchive/test/test_write_disk_hardlink.c (new)