From udo.schweigert@siemens.com  Sat Oct 18 13:25:03 2008
Return-Path: <udo.schweigert@siemens.com>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BC1A31065692
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 18 Oct 2008 13:25:03 +0000 (UTC)
	(envelope-from udo.schweigert@siemens.com)
Received: from david.siemens.de (david.siemens.de [192.35.17.14])
	by mx1.freebsd.org (Postfix) with ESMTP id 4864D8FC17
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 18 Oct 2008 13:25:03 +0000 (UTC)
	(envelope-from udo.schweigert@siemens.com)
Received: from mail2.siemens.de (localhost [127.0.0.1])
	by david.siemens.de (8.12.11.20060308/8.12.11) with ESMTP id m9IDP2Ws017870
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 18 Oct 2008 15:25:02 +0200
Received: from mars.cert.siemens.com (mars.cert.siemens.com [139.25.19.9])
	by mail2.siemens.de (8.12.11.20060308/8.12.11) with ESMTP id m9IDP2NU011359
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 18 Oct 2008 15:25:02 +0200
Received: from alaska.cert.siemens.com (alaska.cert.siemens.com [139.25.19.64])
	by mars.cert.siemens.com (8.14.2/8.14.2/$SiemensCERT: mail/cert.mc.pre,v 1.68 2006/12/29 07:12:05 mailadm Exp $) with ESMTP id m9IDP2UE004136
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 18 Oct 2008 15:25:02 +0200 (CEST)
	(envelope-from ust@cert.siemens.de)
Received: from alaska.cert.siemens.com (alaska.cert.siemens.com [139.25.19.64])
	by alaska.cert.siemens.com (8.14.3/8.14.3/$Ust: hosts/alaska/mail/config.mc,v 1.20 2006/06/21 05:39:02 ust Exp $) with ESMTP id m9IDP1K6066603
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 18 Oct 2008 15:25:01 +0200 (CEST)
	(envelope-from ust@alaska.cert.siemens.com)
Received: (from ust@localhost)
	by alaska.cert.siemens.com (8.14.3/8.14.3/$Ust: hosts/alaska/mail/submit.mc,v 1.6 2004/08/29 16:18:57 ust Exp $) id m9IDP1dF058039;
	Sat, 18 Oct 2008 15:25:01 +0200 (CEST)
	(envelope-from ust)
Message-Id: <200810181325.m9IDP1dF058039@alaska.cert.siemens.com>
Date: Sat, 18 Oct 2008 15:25:01 +0200 (CEST)
From: Udo Schweigert <udo.schweigert@siemens.com>
Reply-To: Udo Schweigert <udo.schweigert@siemens.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: libarchive (tar) not restoring modification time when file has acl
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         128203
>Category:       kern
>Synopsis:       libarchive(3) (tar) not restoring modification time when file has acl
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kientzle
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Oct 18 13:30:01 UTC 2008
>Closed-Date:    Thu Oct 23 04:52:01 UTC 2008
>Last-Modified:  Thu Oct 23 04:52:01 UTC 2008
>Originator:     Udo Schweigert
>Release:        FreeBSD 7.1-PRERELEASE i386
>Organization:
>Environment:
System: FreeBSD alaska.cert.siemens.com 7.1-PRERELEASE FreeBSD 7.1-PRERELEASE #143: Wed Oct 8 09:35:51 CEST 2008 ust@alaska.cert.siemens.com:/usr/obj/usr/src/sys/alaska i386


>Description:

When extracting a pax archive which was created with "tar" where files (not
directories) contain acls the "tar -xp" command will not restore the last 
modification time. Instead the time of the extraction shows up.

This is due to the fact that the particular routine in libarchive does
the acl-restoration after the time has been set. Unlike changing file
flags and access rights the setting of acls changes the last modification
time of a file.

>How-To-Repeat:

On an ACL-capable filesystem do:

# mkdir test-dir
# touch test-dir/test-file
# setfacl -m u::rwx,g:mail:rw test-dir/test-file
# touch -t 01011111 test-dir/test-file
# ls -al test-dir/
total 8
drwxr-xr-x  2 root  wheel  512 Oct 18 15:20 .
drwxrwxr-x+ 3 root  wheel  512 Oct 18 15:20 ..
-rwxrw-r--+ 1 root  wheel    0 Jan  1  2008 test-file
# tar -cvf test.tar test-dir
a test-dir
a test-dir/test-file
# mkdir test2
# cd test2
# tar -xvpf ../test.tar
x test-dir/
x test-dir/test-file
# ls -al test-dir/
total 6
drwxr-xr-x  2 root  wheel  512 Oct 18 15:20 .
drwxr-xr-x  3 root  wheel  512 Oct 18 15:20 ..
-rwxrw-r--+ 1 root  wheel    0 Oct 18 15:20 test-file

The test-file has not the January 1st date.

>Fix:

Apply this patch:
--- lib/libarchive/archive_write_disk.c.orig	2007-09-27 05:45:24.000000000 +0200
+++ lib/libarchive/archive_write_disk.c	2008-10-18 00:12:34.000000000 +0200
@@ -534,10 +534,6 @@
 		int r2 = set_mode(a, a->mode);
 		if (r2 < ret) ret = r2;
 	}
-	if (a->todo & TODO_TIMES) {
-		int r2 = set_time(a);
-		if (r2 < ret) ret = r2;
-	}
 	if (a->todo & TODO_ACLS) {
 		int r2 = set_acls(a);
 		if (r2 < ret) ret = r2;
@@ -550,6 +546,10 @@
 		int r2 = set_fflags(a);
 		if (r2 < ret) ret = r2;
 	}
+	if (a->todo & TODO_TIMES) {
+		int r2 = set_time(a);
+		if (r2 < ret) ret = r2;
+	}
 
 	/* If there's an fd, we can close it now. */
 	if (a->fd >= 0) {


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->kientzle 
Responsible-Changed-By: remko 
Responsible-Changed-When: Sat Oct 18 14:12:22 UTC 2008 
Responsible-Changed-Why:  
reassign to maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=128203 
State-Changed-From-To: open->patched 
State-Changed-By: kientzle 
State-Changed-When: Sun Oct 19 22:10:23 UTC 2008 
State-Changed-Why:  
Fixed in -CURRENT by r184038. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=128203 
State-Changed-From-To: patched->closed 
State-Changed-By: kientzle 
State-Changed-When: Thu Oct 23 04:51:30 UTC 2008 
State-Changed-Why:  
MFCed to STABLE-7, STABLE-6, and RELENG-6.4 

http://www.freebsd.org/cgi/query-pr.cgi?pr=128203 
>Unformatted:
