Date: Sat, 18 Oct 2008 15:25:01 +0200 (CEST) From: Udo Schweigert <udo.schweigert@siemens.com> To: FreeBSD-gnats-submit@FreeBSD.org Subject: misc/128203: libarchive (tar) not restoring modification time when file has acl Message-ID: <200810181325.m9IDP1dF058039@alaska.cert.siemens.com> Resent-Message-ID: <200810181330.m9IDU129064859@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 128203 >Category: misc >Synopsis: libarchive (tar) not restoring modification time when file has acl >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Oct 18 13:30:01 UTC 2008 >Closed-Date: >Last-Modified: >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: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200810181325.m9IDP1dF058039>