delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/03/07/18:42:49

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
Message-ID: <4D756D66.5000403@cs.ucla.edu>
Date: Mon, 07 Mar 2011 15:42:30 -0800
From: Paul Eggert <eggert AT cs DOT ucla DOT edu>
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Thunderbird/3.1.7
MIME-Version: 1.0
To: Eric Blake <eblake AT redhat DOT com>
CC: cygwin AT cygwin DOT com, tar-list <bug-tar AT gnu DOT org>
Subject: Re: [Bug-tar] Re: tar --atime-preserve with an empty file triggers a warning
References: <20110307152005 DOT 17292u50da242vth AT messagerie DOT si DOT c-s DOT fr> <4D74EC98 DOT 7090803 AT redhat DOT com> <20110307144349 DOT GE18640 AT calimero DOT vinschen DOT de> <4D74F4A8 DOT 2080505 AT redhat DOT com>
In-Reply-To: <4D74F4A8.2080505@redhat.com>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Thanks for reporting that.  I installed the following
patch into GNU tar:

 From 24980ce3c6e01ce43cdccd5d1f693c9838e447ed Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert AT cs DOT ucla DOT edu>
Date: Mon, 7 Mar 2011 15:40:32 -0800
Subject: [PATCH] --atime-preserve=replace: fix correctness and performance bugs

reported by Eric Blake in
<http://lists.gnu.org/archive/html/bug-tar/2011-03/msg00000.html>.
* src/compare.c (diff_file): Do not restore atime of size-zero files.
* src/create.c (dump_file0): Likewise.  Also, do not restore atime
when fd is zero, because that indicates a file we haven't opened.
---
  src/compare.c |    5 +++--
  src/create.c  |    1 +
  2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/compare.c b/src/compare.c
index 91ced57..273269a 100644
--- a/src/compare.c
+++ b/src/compare.c
@@ -234,7 +234,8 @@ diff_file (void)
  	      else
  		read_and_process (&current_stat_info, process_rawdata);
  
-	      if (atime_preserve_option == replace_atime_preserve)
+	      if (atime_preserve_option == replace_atime_preserve
+		  && stat_data.st_size != 0)
  		{
  		  struct timespec atime = get_stat_atime (&stat_data);
  		  if (set_file_atime (diff_handle, chdir_fd, file_name, atime)
@@ -528,7 +529,7 @@ verify_volume (void)
    if (may_fail)
      WARN((0, 0,
  	  _("Verification may fail to locate original files.")));
-
+
    if (!diff_buffer)
      diff_init ();
  
diff --git a/src/create.c b/src/create.c
index e8de6b9..43b5a4c 100644
--- a/src/create.c
+++ b/src/create.c
@@ -1797,6 +1797,7 @@ dump_file0 (struct tar_stat_info *st, char const *name, char const *p)
  	      set_exit_status (TAREXIT_DIFFERS);
  	    }
  	  else if (atime_preserve_option == replace_atime_preserve
+		   && fd && (is_dir || original_size != 0)
  		   && set_file_atime (fd, parentfd, name, st->atime) != 0)
  	    utime_error (p);
  	}
-- 
1.7.4


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019