Subject: Re: Unpacking src - permission denied

From: Andrew Innes <[email-masked]>
Date: Tue, 27 Aug 1996 17:52:43 +0100

On Thu, 15 Aug 96 11:29:58 EDT, "Robertson G Davenport" <[email-masked]> said:
>Hello all,
>
>This is probably a dufus-type question, but I just got the 19.33 src and 
>tried gunzip'ing|tar'ing it and got LOTS of:
>   could not change access or modification times : Permission denied

This message is produced because of a simple "bug" in GNU tar - when
unpacking, it assigns files their final attributes (mode bits) when
creating the file.  Problem is that Win32 will not change the file times
of a read-only file (this is okay on Unix).

I've put a simple fix (see below) in my copy of tar to make files
writable when created to avoid this (the final modes get set a second
time anyway after the file times have been changed).

AndrewI

-----------------------------------------------------------------
*** d:/progs/tar-1.11.2/extract.c.orig	Mon Nov 15 23:19:26 1993
--- d:/progs/tar-1.11.2/extract.c	Fri Mar 29 14:01:46 1996
***************
*** 357,363 ****
  			  * With 3-arg open(), we can do this up right.
  			  */
  	  fd = open (skipcrud + current_file_name,
! 		     openflag, hstat.st_mode);
  #endif
  	}
  
--- 357,370 ----
  			  * With 3-arg open(), we can do this up right.
  			  */
  	  fd = open (skipcrud + current_file_name,
! 		     openflag,
! #ifdef WINDOWSNT
! 		     /* utime fails if file is not writable */
! 		     hstat.st_mode | S_IWRITE
! #else
! 		     hstat.st_mode
! #endif
! 	    );
  #endif
  	}