🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.utils.bug
Article #844

tar-1.1 and SunOS4.1.2, Solaris 2.0, AIX 3.2, HPUX 8.07, ULTRIX, and IRIX 4.0.1

#844
From: J.T. Conklin
Date: Mon, 14 Sep 1992 04:30
1218 lines
33999 bytes
GENERAL:
	Curly braces are missing around a two statement if clause in both
	gnu.c and tar.c

	When a user invokes tar-1.11 with bad command line arguments, it
	instructs the user to use +help, rather than --help.

	fnmatch(), used by most of the other gnu utilities for file name
	globbing, allows both `!' and `^' to negate character classes.
	wildmat(), used by  tar-1.11, only allowed `!' until now...

AIX:
	Both <sys/time.h> and <time.h> need to be included for getdate.y.

	rindex and index are defined in <string.h>, so #undef them before
	redefining.

	NOT FIXED: complains about number of arguments to macro rindex() when
		   declaring function.

	NOT FIXED: won't link with provided malloc -- unresolved symbol etext.
		   works with AIX malloc.


HPUX:
	Doesn't handle files where '#' of a preprocessor directive is not the
	first character of a line.

	NOT FIXED: Linking with -lPW for alloca causes link errors with
		   unresolved external ``Error''.  Using alloca.c works.

IRIX:
	Compiler is not ansi, but understands prototypes and const.  The
	``#define const'' in several files confuses things.  Use autoconf's
	AC_CONST instead.

	utime is prototyped in unistd.h and the old way of using an array
	of longs conflicts with the prototype.  Using gnu fileutils as a
	guide, I converted the code to use struct utimbuf.

	The declarations of getgrgid() and getpwuid() in names.c conflict
	with the prototypes in <grp.h> and <pwd.h>.  This is because uid_t
	and gid_t are unsigned short and the normal promotion rules implied
	by the declarations conflict with the prototypes.  I added autoconf
	rules to check if these functions are declared.


SOLARIS:
	setsockopt in rmt.c needs cast to avoid prototype conflict.

	rmt needs to be linked with -lsocked and -lnsl.  I've added explict
	tests for /lib/libsocket.a and /lib/libnsl.a in autoconf.in...
	This may not be the way you want to do it...

	Makefile.in changed to add $(LIBS) to link of rmt.  See above.

	None of the contortions to find out the page size in getpagesize.h
	worked.  If _SC_PAGESIZE is defined, use sysconf(_SC_PAGESIZE)

diff -c tar/Makefile.in:1.1.1.1 tar/Makefile.in:1.2
*** tar/Makefile.in:1.1.1.1	Mon Sep 14 11:13:18 1992
--- tar/Makefile.in	Mon Sep 14 11:13:18 1992
***************
*** 117,123 ****
  	$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)

  rmt:	rmt.c
! 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(srcdir)/rmt.c

  tar.info: tar.texinfo
  	makeinfo $(srcdir)/tar.texinfo
--- 117,123 ----
  	$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)

  rmt:	rmt.c
! 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(srcdir)/rmt.c $(LIBS)

  tar.info: tar.texinfo
  	makeinfo $(srcdir)/tar.texinfo
diff -c tar/buffer.c:1.1.1.1 tar/buffer.c:1.2
*** tar/buffer.c:1.1.1.1	Mon Sep 14 11:13:19 1992
--- tar/buffer.c	Mon Sep 14 11:13:19 1992
***************
*** 1337,1345 ****
  			    break;

  		    case '!':
!     #ifdef __MSDOS__
  			    spawnl(P_WAIT,getenv("COMSPEC"),"-",0);
!     #else
  				    /* JF this needs work! */
  			    switch(fork()) {
  			    case -1:
--- 1337,1345 ----
  			    break;

  		    case '!':
! #ifdef __MSDOS__
  			    spawnl(P_WAIT,getenv("COMSPEC"),"-",0);
! #else
  				    /* JF this needs work! */
  			    switch(fork()) {
  			    case -1:
***************
*** 1355,1361 ****
  				    wait(0);
  				    break;
  			    }
!     #endif
  			    break;
  		  }
  		  }
--- 1355,1361 ----
  				    wait(0);
  				    break;
  			    }
! #endif
  			    break;
  		  }
  		  }
diff -c tar/configure:1.1.1.1 tar/configure:1.4
*** tar/configure:1.1.1.1	Mon Sep 14 11:13:20 1992
--- tar/configure	Mon Sep 14 11:13:20 1992
***************
*** 488,493 ****
--- 488,509 ----
  fi
  rm -f conftest*

+ echo checking for getgrgid declaration
+ echo '#include <grp.h>' > conftest.c
+ eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
+ if egrep "getgrgid" conftest.out >/dev/null 2>&1; then
+   DEFS="$DEFS -DHAVE_GETGRGID=1"
+ fi
+ rm -f conftest*
+
+ echo checking for getpwuid declaration
+ echo '#include <pwd.h>' > conftest.c
+ eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
+ if egrep "getpwuid" conftest.out >/dev/null 2>&1; then
+   DEFS="$DEFS -DHAVE_GETPWUID=1"
+ fi
+ rm -f conftest*
+
  echo checking for BSD string and memory functions
  echo "#include <strings.h>
  main() { exit(0); } t() { rindex(0, 0); bzero(0, 0); }" > conftest.c
***************
*** 613,618 ****
--- 629,646 ----
  echo checking for HP-UX
  test -f /hp-ux && test -f /vmunix || MALLOC=malloc.o

+ echo checking for working const
+ echo "
+ main() { exit(0); } t() { /* Ultrix mips cc rejects this.  */
+ typedef int charset[2]; const charset x;
+  }" > conftest.c
+ if eval $compile; then
+   :
+ else
+   DEFS="$DEFS -Dconst="
+ fi
+ rm -f conftest*
+
  echo checking for Xenix
  cat <<EOF > conftest.c

***************
*** 634,639 ****
--- 662,675 ----
    *SYSNDIR*) ;;
    *) LIBS="-ldir $LIBS" ;; # Make sure -ldir precedes any -lx.
    esac
+ fi
+
+ if test -f /lib/libsocket.a; then
+ 	LIBS="$LIBS -lsocket"
+ fi
+
+ if test -f /lib/libnsl.a; then
+ 	LIBS="$LIBS -lnsl"
  fi

  if test -n "$prefix"; then
diff -c tar/configure.in:1.1.1.1 tar/configure.in:1.4
*** tar/configure.in:1.1.1.1	Mon Sep 14 11:13:20 1992
--- tar/configure.in	Mon Sep 14 11:13:21 1992
***************
*** 24,29 ****
--- 24,33 ----
  AC_STDC_HEADERS
  AC_UNISTD_H
  AC_HEADER_CHECK(limits.h, AC_DEFINE(HAVE_LIMITS_H))
+ echo checking for getgrgid declaration
+ AC_HEADER_EGREP(getgrgid, grp.h, AC_DEFINE(HAVE_GETGRGID))
+ echo checking for getpwuid declaration
+ AC_HEADER_EGREP(getpwuid, pwd.h, AC_DEFINE(HAVE_GETPWUID))
  AC_USG
  echo checking default archive
  # This is likely to guess wrong, but it's not very important.
***************
*** 47,51 ****
--- 51,64 ----
  echo checking for HP-UX
  test -f /hp-ux && test -f /vmunix || MALLOC=malloc.o
  AC_SUBST(MALLOC)
+ AC_CONST
  AC_XENIX_DIR
+ if test -f /lib/libsocket.a; then
+ 	LIBS="$LIBS -lsocket"
+ fi
+
+ if test -f /lib/libnsl.a; then
+ 	LIBS="$LIBS -lnsl"
+ fi
+
  AC_OUTPUT(Makefile)
diff -c tar/create.c:1.1.1.1 tar/create.c:1.2
*** tar/create.c:1.1.1.1	Mon Sep 14 11:13:21 1992
--- tar/create.c	Mon Sep 14 11:13:21 1992
***************
*** 49,54 ****
--- 49,64 ----
  #include <grp.h>
  #endif

+ #ifdef _POSIX_VERSION
+ #include <utime.h>
+ #else /* not _POSIX_VERSION */
+ struct utimbuf
+ {
+   long actime;
+   long modtime;
+ };
+ #endif /* _POSIX_VERSION */
+
  #if defined(_POSIX_VERSION) || defined(DIRENT)
  #include <dirent.h>
  #ifdef direct
***************
*** 206,212 ****
  	char save_linkflag;
  	extern time_t new_time;
  	int critical_error = 0;
! 	time_t restore_times[2];
  /*	int sparse_ind = 0;*/


--- 216,222 ----
  	char save_linkflag;
  	extern time_t new_time;
  	int critical_error = 0;
! 	struct utimbuf restore_times;
  /*	int sparse_ind = 0;*/


***************
*** 234,241 ****
  		return;
  	}

! 	restore_times[0] = hstat.st_atime;
! 	restore_times[1] = hstat.st_mtime;

  #ifdef S_ISHIDDEN
  	if (S_ISHIDDEN (hstat.st_mode)) {
--- 244,251 ----
  		return;
  	}

! 	restore_times.actime  = hstat.st_atime;
! 	restore_times.modtime = hstat.st_mtime;

  #ifdef S_ISHIDDEN
  	if (S_ISHIDDEN (hstat.st_mode)) {
***************
*** 574,580 ****
  		      msg_perror ("cannot remove %s", p);
  		  }
  		if (f_atime_preserve)
! 		  utime (p, restore_times);
  		return;

  		/*
--- 584,590 ----
  		      msg_perror ("cannot remove %s", p);
  		  }
  		if (f_atime_preserve)
! 		  utime (p, &restore_times);
  		return;

  		/*
***************
*** 594,600 ****
  		if(f>=0)
  			(void)close(f);
  		if (f_atime_preserve)
! 		  utime (p, restore_times);
  	        return;
  	}

--- 604,610 ----
  		if(f>=0)
  			(void)close(f);
  		if (f_atime_preserve)
! 		  utime (p, &restore_times);
  	        return;
  	}

***************
*** 727,733 ****
  			if(f_multivol)
  				save_name = 0;
  			if (f_atime_preserve)
! 			  utime (p, restore_times);
   			return;
  		}

--- 737,743 ----
  			if(f_multivol)
  				save_name = 0;
  			if (f_atime_preserve)
! 			  utime (p, &restore_times);
   			return;
  		}

***************
*** 786,792 ****
  		closedir(dirp);
  		free(namebuf);
  		if (f_atime_preserve)
! 		  utime (p, restore_times);
  		return;
  	}

--- 796,802 ----
  		closedir(dirp);
  		free(namebuf);
  		if (f_atime_preserve)
! 		  utime (p, &restore_times);
  		return;
  	}

diff -c tar/extract.c:1.1.1.1 tar/extract.c:1.3
*** tar/extract.c:1.1.1.1	Mon Sep 14 11:13:22 1992
--- tar/extract.c	Mon Sep 14 11:13:23 1992
***************
*** 53,61 ****
  #include "tar.h"
  #include "port.h"

! #if defined(_POSIX_VERSION)
  #include <utime.h>
! #endif

  extern FILE *msg_file;

--- 53,67 ----
  #include "tar.h"
  #include "port.h"

! #ifdef _POSIX_VERSION
  #include <utime.h>
! #else /* not _POSIX_VERSION */
! struct utimbuf
! {
!   long actime;
!   long modtime;
! };
! #endif /* _POSIX_VERSION */

  extern FILE *msg_file;

***************
*** 102,108 ****
    int mtime;
    struct saved_dir_info *next;
  };
!
  struct saved_dir_info *saved_dir_info_head;

  /*
--- 108,114 ----
    int mtime;
    struct saved_dir_info *next;
  };
!
  struct saved_dir_info *saved_dir_info_head;

  /*
***************
*** 138,153 ****
  	register char *data;
  	int fd, check, namelen, written, openflag;
  	long size;
! 	time_t acc_upd_times[2];
  	register int skipcrud;
  	register int i;
  /*	int sparse_ind = 0;*/
! 	union record *exhdr;
  	struct saved_dir_info *tmp;
  /*	int end_nulls; */
  	char **longp;
  	char *bp;
!
  	saverec(&head);			/* Make sure it sticks around */
  	userec(head);			/* And go past it in the archive */
  	decode_header(head, &hstat, &head_standard, 1);	/* Snarf fields */
--- 144,159 ----
  	register char *data;
  	int fd, check, namelen, written, openflag;
  	long size;
! 	struct utimbuf acc_upd_times;
  	register int skipcrud;
  	register int i;
  /*	int sparse_ind = 0;*/
! 	union record *exhdr;
  	struct saved_dir_info *tmp;
  /*	int end_nulls; */
  	char **longp;
  	char *bp;
!
  	saverec(&head);			/* Make sure it sticks around */
  	userec(head);			/* And go past it in the archive */
  	decode_header(head, &hstat, &head_standard, 1);	/* Snarf fields */
***************
*** 190,196 ****
  			 head->header.linkflag, skipcrud+current_file_name);
  		 /* FALL THRU */

! 	 /*
  	  * JK - What we want to do if the file is sparse is loop through
  	  * the array of sparse structures in the header and read in
  	  * and translate the character strings representing  1) the offset
--- 196,202 ----
  			 head->header.linkflag, skipcrud+current_file_name);
  		 /* FALL THRU */

! 	 /*
  	  * JK - What we want to do if the file is sparse is loop through
  	  * the array of sparse structures in the header and read in
  	  * and translate the character strings representing  1) the offset
***************
*** 200,206 ****
  	  * the tar file that had to deal with a sparse file.
  	  *
  	  * After we read in the first five (at most) sparse structures,
! 	  * we check to see if the file has an extended header, i.e.,
  	  * if more sparse structures are needed to describe the contents
  	  * of the new file.  If so, we read in the extended headers
  	  * and continue to store their contents into the sparsearray.
--- 206,212 ----
  	  * the tar file that had to deal with a sparse file.
  	  *
  	  * After we read in the first five (at most) sparse structures,
! 	  * we check to see if the file has an extended header, i.e.,
  	  * if more sparse structures are needed to describe the contents
  	  * of the new file.  If so, we read in the extended headers
  	  * and continue to store their contents into the sparsearray.
***************
*** 209,217 ****
  		 sp_array_size = 10;
  		 sparsearray = (struct sp_array *) malloc(sp_array_size * sizeof(struct sp_array));
  		 for (i = 0; i < SPARSE_IN_HDR; i++) {
! 			 sparsearray[i].offset =
  				 from_oct(1+12, head->header.sp[i].offset);
! 			 sparsearray[i].numbytes =
  				 from_oct(1+12, head->header.sp[i].numbytes);
  			 if (!sparsearray[i].numbytes)
  				 break;
--- 215,223 ----
  		 sp_array_size = 10;
  		 sparsearray = (struct sp_array *) malloc(sp_array_size * sizeof(struct sp_array));
  		 for (i = 0; i < SPARSE_IN_HDR; i++) {
! 			 sparsearray[i].offset =
  				 from_oct(1+12, head->header.sp[i].offset);
! 			 sparsearray[i].numbytes =
  				 from_oct(1+12, head->header.sp[i].numbytes);
  			 if (!sparsearray[i].numbytes)
  				 break;
***************
*** 221,227 ****

  		 if (head->header.isextended) {
  			 /* read in the list of extended headers
! 			    and translate them into the sparsearray
  			    as before */

  			 /* static */ int ind = SPARSE_IN_HDR;
--- 227,233 ----

  		 if (head->header.isextended) {
  			 /* read in the list of extended headers
! 			    and translate them into the sparsearray
  			    as before */

  			 /* static */ int ind = SPARSE_IN_HDR;
***************
*** 236,242 ****
  					  * realloc the scratch area
  					  * since we've run out of room --
  					  */
! 						 sparsearray = (struct sp_array *)
  								 realloc(sparsearray,
  								 2 * sp_array_size * (sizeof(struct sp_array)));
  						 sp_array_size *= 2;
--- 242,248 ----
  					  * realloc the scratch area
  					  * since we've run out of room --
  					  */
! 						 sparsearray = (struct sp_array *)
  								 realloc(sparsearray,
  								 2 * sp_array_size * (sizeof(struct sp_array)));
  						 sp_array_size *= 2;
***************
*** 243,254 ****
  					 }
  					 if (!exhdr->ext_hdr.sp[i].numbytes)
  						 break;
! 					 sparsearray[i+ind].offset =
  						 from_oct(1+12, exhdr->ext_hdr.sp[i].offset);
! 					 sparsearray[i+ind].numbytes =
  						 from_oct(1+12, exhdr->ext_hdr.sp[i].numbytes);
  				 }
! 				 if (!exhdr->ext_hdr.isextended)
  					 break;
  				 else {
  					 ind += SPARSE_EXT_HDR;
--- 249,260 ----
  					 }
  					 if (!exhdr->ext_hdr.sp[i].numbytes)
  						 break;
! 					 sparsearray[i+ind].offset =
  						 from_oct(1+12, exhdr->ext_hdr.sp[i].offset);
! 					 sparsearray[i+ind].numbytes =
  						 from_oct(1+12, exhdr->ext_hdr.sp[i].numbytes);
  				 }
! 				 if (!exhdr->ext_hdr.isextended)
  					 break;
  				 else {
  					 ind += SPARSE_EXT_HDR;
***************
*** 275,281 ****
  		 openflag = (f_keep?
  			 O_BINARY|O_NDELAY|O_WRONLY|O_CREAT|O_EXCL:
  			 O_BINARY|O_NDELAY|O_WRONLY|O_CREAT|O_TRUNC)
! 			 | ((head->header.linkflag == LF_SPARSE) ? 0 : O_APPEND);
  			 /*
  			  * JK - The last | is a kludge to solve the problem
  			  * the O_APPEND flag  causes with files we are
--- 281,287 ----
  		 openflag = (f_keep?
  			 O_BINARY|O_NDELAY|O_WRONLY|O_CREAT|O_EXCL:
  			 O_BINARY|O_NDELAY|O_WRONLY|O_CREAT|O_TRUNC)
! 			 | ((head->header.linkflag == LF_SPARSE) ? 0 : O_APPEND);
  			 /*
  			  * JK - The last | is a kludge to solve the problem
  			  * the O_APPEND flag  causes with files we are
***************
*** 293,299 ****
  			 fd = 1;
  			 goto extract_file;
  		 }
!  #ifdef O_CTG
  		 /*
  		  * Contiguous files (on the Masscomp) have to specify
  		  * the size in the open call that creates them.
--- 299,305 ----
  			 fd = 1;
  			 goto extract_file;
  		 }
! #ifdef O_CTG
  		 /*
  		  * Contiguous files (on the Masscomp) have to specify
  		  * the size in the open call that creates them.
***************
*** 304,312 ****
  				   openflag | O_CTG,
  				   hstat.st_mode, hstat.st_size);
  		 else
!  #endif
  		 {
!  #ifdef NO_OPEN3
  			 /*
  			  * On raw V7 we won't let them specify -k (f_keep), but
  			  * we just bull ahead and create the files.
--- 310,318 ----
  				   openflag | O_CTG,
  				   hstat.st_mode, hstat.st_size);
  		 else
! #endif
  		 {
! #ifdef NO_OPEN3
  			 /*
  			  * On raw V7 we won't let them specify -k (f_keep), but
  			  * we just bull ahead and create the files.
***************
*** 313,327 ****
  			  */
  			 fd = creat((longname
  				     ? longname
! 				     : head->header.name) + skipcrud,
  				    hstat.st_mode);
!  #else
  			 /*
  			  * With 3-arg open(), we can do this up right.
  			  */
  			 fd = open(skipcrud + current_file_name,
  				   openflag, hstat.st_mode);
!  #endif
  		 }

  		 if (fd < 0) {
--- 319,333 ----
  			  */
  			 fd = creat((longname
  				     ? longname
! 				     : head->header.name) + skipcrud,
  				    hstat.st_mode);
! #else
  			 /*
  			  * With 3-arg open(), we can do this up right.
  			  */
  			 fd = open(skipcrud + current_file_name,
  				   openflag, hstat.st_mode);
! #endif
  		 }

  		 if (fd < 0) {
***************
*** 353,360 ****
  			 bcopy(skipcrud+current_file_name, name, namelen);
  			 size = hstat.st_size;
  			 extract_sparse_file(fd, &size, hstat.st_size, name);
! 		 }
! 		 else
  		   for (size = hstat.st_size;
  			size > 0;
  			size -= written) {
--- 359,366 ----
  			 bcopy(skipcrud+current_file_name, name, namelen);
  			 size = hstat.st_size;
  			 extract_sparse_file(fd, &size, hstat.st_size, name);
! 		 }
! 		 else
  		   for (size = hstat.st_size;
  			size > 0;
  			size -= written) {
***************
*** 474,480 ****

  		 /*
  		  * Set the modified time of the file.
! 		  *
  		  * Note that we set the accessed time to "now", which
  		  * is really "the time we started extracting files".
  		  * unless f_gnudump is used, in which case .st_atime is used
--- 480,486 ----

  		 /*
  		  * Set the modified time of the file.
! 		  *
  		  * Note that we set the accessed time to "now", which
  		  * is really "the time we started extracting files".
  		  * unless f_gnudump is used, in which case .st_atime is used
***************
*** 481,492 ****
  		  */
  		 if (!f_modified) {
  			 /* fixme if f_gnudump should set ctime too, but how? */
! 			if(f_gnudump)
! 				acc_upd_times[0]=hstat.st_atime;
! 			else acc_upd_times[0] = now;	         /* Accessed now */
! 			acc_upd_times[1] = hstat.st_mtime; /* Mod'd */
  			if (utime(skipcrud + current_file_name,
! 				  acc_upd_times) < 0) {
  			  msg_perror("couldn't change access and modification times of %s",skipcrud + current_file_name);
  			}
  		}
--- 487,501 ----
  		  */
  		 if (!f_modified) {
  			 /* fixme if f_gnudump should set ctime too, but how? */
! 			if (f_gnudump) {
! 				acc_upd_times.actime = hstat.st_atime;
! 		        } else {
! 				acc_upd_times.actime = now; /* Accessed now */
! 			}
! 			acc_upd_times.modtime = hstat.st_mtime;	/* Mod'd */
!
  			if (utime(skipcrud + current_file_name,
! 				  &acc_upd_times) < 0) {
  			  msg_perror("couldn't change access and modification times of %s",skipcrud + current_file_name);
  			}
  		}
***************
*** 610,620 ****
  		if(f_gnudump) {		/* Read the entry and delete files
  					   that aren't listed in the archive */
  			gnu_restore(skipcrud);
!
  		} else if(head->header.linkflag==LF_DUMPDIR)
  			skip_file((long)(hstat.st_size));

!
  	again_dir:
  		check = mkdir(skipcrud+current_file_name,
  			      (we_are_root ? 0 : 0300) | (int)hstat.st_mode);
--- 619,629 ----
  		if(f_gnudump) {		/* Read the entry and delete files
  					   that aren't listed in the archive */
  			gnu_restore(skipcrud);
!
  		} else if(head->header.linkflag==LF_DUMPDIR)
  			skip_file((long)(hstat.st_size));

!
  	again_dir:
  		check = mkdir(skipcrud+current_file_name,
  			      (we_are_root ? 0 : 0300) | (int)hstat.st_mode);
***************
*** 624,630 ****
  			if (make_dirs(skipcrud+current_file_name))
  				goto again_dir;
  			/* If we're trying to create '.', let it be. */
! 			if (current_file_name[skipcrud+namelen] == '.' &&
  			    (namelen==0 ||
  			     current_file_name[skipcrud+namelen-1]=='/'))
  				goto check_perms;
--- 633,639 ----
  			if (make_dirs(skipcrud+current_file_name))
  				goto again_dir;
  			/* If we're trying to create '.', let it be. */
! 			if (current_file_name[skipcrud+namelen] == '.' &&
  			    (namelen==0 ||
  			     current_file_name[skipcrud+namelen-1]=='/'))
  				goto check_perms;
***************
*** 635,641 ****
  			msg_perror("Could not create directory %s",skipcrud+current_file_name);
  			break;
  		}
!
  	check_perms:
  		if (!we_are_root && 0300 != (0300 & (int) hstat.st_mode)) {
  			hstat.st_mode |= 0300;
--- 644,650 ----
  			msg_perror("Could not create directory %s",skipcrud+current_file_name);
  			break;
  		}
!
  	check_perms:
  		if (!we_are_root && 0300 != (0300 & (int) hstat.st_mode)) {
  			hstat.st_mode |= 0300;
***************
*** 673,680 ****
  		 msg ("Visible long name error\n");
  		 skip_file ((long)hstat.st_size);
  		 break;
! 	}
!
  	/* We don't need to save it any longer. */
  	saverec((union record **) 0);	/* Unsave it */
  }
--- 682,689 ----
  		 msg ("Visible long name error\n");
  		 skip_file ((long)hstat.st_size);
  		 break;
! 	}
!
  	/* We don't need to save it any longer. */
  	saverec((union record **) 0);	/* Unsave it */
  }
***************
*** 737,749 ****
  	long	*sizeleft,
  		totalsize;
  	char	*name;
! {
  /*	register char	*data;*/
  	union record	*datarec;
  	int	sparse_ind = 0;
  	int	written,
  		count;
!
  	/* assuming sizeleft is initially totalsize */


--- 746,758 ----
  	long	*sizeleft,
  		totalsize;
  	char	*name;
! {
  /*	register char	*data;*/
  	union record	*datarec;
  	int	sparse_ind = 0;
  	int	written,
  		count;
!
  	/* assuming sizeleft is initially totalsize */


***************
*** 757,763 ****
  		written = sparsearray[sparse_ind++].numbytes;
  		while (written > RECORDSIZE) {
  			count = write(fd, datarec->charptr, RECORDSIZE);
! 			if (count < 0)
  				msg_perror("couldn't write to file %s", name);
  			written -= count;
  			*sizeleft -= count;
--- 766,772 ----
  		written = sparsearray[sparse_ind++].numbytes;
  		while (written > RECORDSIZE) {
  			count = write(fd, datarec->charptr, RECORDSIZE);
! 			if (count < 0)
  				msg_perror("couldn't write to file %s", name);
  			written -= count;
  			*sizeleft -= count;
***************
*** 766,772 ****
  		}

  		count = write(fd, datarec->charptr, written);
!
  		if (count < 0) {
  			msg_perror("couldn't write to file %s", name);
  		} else if (count != written) {
--- 775,781 ----
  		}

  		count = write(fd, datarec->charptr, written);
!
  		if (count < 0) {
  			msg_perror("couldn't write to file %s", name);
  		} else if (count != written) {
***************
*** 775,781 ****
  		}

  		written -= count;
! 		*sizeleft -= count;
  		userec(datarec);
  	}
  	free(sparsearray);
--- 784,790 ----
  		}

  		written -= count;
! 		*sizeleft -= count;
  		userec(datarec);
  	}
  	free(sparsearray);
***************
*** 792,808 ****
  /* Set back the utime and mode for all the extracted directories. */
  void restore_saved_dir_info ()
  {
!   time_t acc_upd_times[2];
    struct saved_dir_info *tmp;

    while (saved_dir_info_head != NULL)
      {
        /* fixme if f_gnudump should set ctime too, but how? */
!       if(f_gnudump)
! 	acc_upd_times[0]=saved_dir_info_head -> atime;
!       else acc_upd_times[0] = now; /* Accessed now */
!       acc_upd_times[1] = saved_dir_info_head -> mtime; /* Mod'd */
!       if (utime(saved_dir_info_head -> path, acc_upd_times) < 0) {
  	msg_perror("couldn't change access and modification times of %s",
  		   saved_dir_info_head -> path);
        }
--- 801,820 ----
  /* Set back the utime and mode for all the extracted directories. */
  void restore_saved_dir_info ()
  {
!   struct utimbuf acc_upd_times;
    struct saved_dir_info *tmp;

    while (saved_dir_info_head != NULL)
      {
        /* fixme if f_gnudump should set ctime too, but how? */
!       if(f_gnudump) {
! 	acc_upd_times.actime = saved_dir_info_head -> atime;
!       } else {
!         acc_upd_times.actime = now; /* Accessed now */
!       }
!       acc_upd_times.modtime = saved_dir_info_head -> mtime; /* Mod'd */
!
!       if (utime(saved_dir_info_head -> path, &acc_upd_times) < 0) {
  	msg_perror("couldn't change access and modification times of %s",
  		   saved_dir_info_head -> path);
        }
diff -c tar/getdate.y:1.1.1.1 tar/getdate.y:1.2
*** tar/getdate.y:1.1.1.1	Mon Sep 14 11:13:24 1992
--- tar/getdate.y	Mon Sep 14 11:13:24 1992
***************
*** 1,5 ****
  %{
! /* $Revision: 1.1.1.1 $
  **
  **  Originally written by Steven M. Bellovin <smb@research.att.com> while
  **  at the University of North Carolina at Chapel Hill.  Later tweaked by
--- 1,5 ----
  %{
! /* $Revision: 1.2 $
  **
  **  Originally written by Steven M. Bellovin <smb@research.att.com> while
  **  at the University of North Carolina at Chapel Hill.  Later tweaked by
***************
*** 53,59 ****
--- 53,64 ----
  #if	defined(BSD4_2) || defined(BSD4_1C)
  #include <sys/time.h>
  #else
+ #if	defined(_AIX)
+ #include <sys/time.h>
  #include <time.h>
+ #else
+ #include <time.h>
+ #endif	/* defined(_AIX) */
  #endif	/* defined(BSD4_2) */
  #endif	/* defined(vms) */

***************
*** 73,79 ****

  #if	!defined(lint) && !defined(SABER)
  static char RCS[] =
! 	"$Header: /tmp_mnt/home/vegas.c/CVSROOT/tar/getdate.y,v 1.1.1.1 1992/09/11 20:50:25 jtc Exp $";
  #endif	/* !defined(lint) && !defined(SABER) */


--- 78,84 ----

  #if	!defined(lint) && !defined(SABER)
  static char RCS[] =
! 	"$Header: /tmp_mnt/home/vegas.c/CVSROOT/tar/getdate.y,v 1.2 1992/09/11 20:54:52 jtc Exp $";
  #endif	/* !defined(lint) && !defined(SABER) */


diff -c tar/getopt.c:1.1.1.1 tar/getopt.c:1.2
*** tar/getopt.c:1.1.1.1	Mon Sep 14 11:13:25 1992
--- tar/getopt.c	Mon Sep 14 11:13:25 1992
***************
*** 51,60 ****
  #define	__alloca	alloca
  #endif	/* GNU C library.  */

- #if !__STDC__
- #define const
- #endif
-
  /* If GETOPT_COMPAT is defined, `+' as well as `--' can introduce a
     long-named option.  Because this is not POSIX.2 compliant, it is
     being phased out.  */
--- 51,56 ----
diff -c tar/getopt1.c:1.1.1.1 tar/getopt1.c:1.2
*** tar/getopt1.c:1.1.1.1	Mon Sep 14 11:13:25 1992
--- tar/getopt1.c	Mon Sep 14 11:13:26 1992
***************
*** 17,26 ****
  
  #include "getopt.h"

- #ifndef __STDC__
- #define const
- #endif
-
  #if defined(STDC_HEADERS) || defined(__GNU_LIBRARY__) || defined (LIBC)
  #include <stdlib.h>
  #else /* STDC_HEADERS or __GNU_LIBRARY__ */
--- 17,22 ----
diff -c tar/getpagesize.h:1.1.1.1 tar/getpagesize.h:1.2
*** tar/getpagesize.h:1.1.1.1	Mon Sep 14 11:13:26 1992
--- tar/getpagesize.h	Mon Sep 14 11:13:26 1992
***************
*** 6,13 ****

  #ifndef HAVE_GETPAGESIZE

! #include <sys/param.h>

  #ifdef EXEC_PAGESIZE
  #define getpagesize() EXEC_PAGESIZE
  #else
--- 6,19 ----

  #ifndef HAVE_GETPAGESIZE

! #ifdef HAVE_UNISTD_H
! #include <unistd.h>
! #endif

+ #ifdef _SC_PAGESIZE
+ #define getpagesize() sysconf(_SC_PAGESIZE)
+ #else
+ #include <sys/param.h>
  #ifdef EXEC_PAGESIZE
  #define getpagesize() EXEC_PAGESIZE
  #else
***************
*** 20,25 ****
--- 26,32 ----
  #define getpagesize() NBPC
  #endif /* no NBPG */
  #endif /* no EXEC_PAGESIZE */
+ #endif /* no _SC_PAGESIZE */

  #endif /* not HAVE_GETPAGESIZE */

diff -c tar/gnu.c:1.1.1.1 tar/gnu.c:1.2
*** tar/gnu.c:1.1.1.1	Mon Sep 14 11:13:27 1992
--- tar/gnu.c	Mon Sep 14 11:13:27 1992
***************
*** 126,134 ****
  	time(&this_time);
  	if(gnu_dumpfile[0]!='/') {
  #if defined(__MSDOS__) || defined(USG) || defined(_POSIX_VERSION)
! 			if(!getcwd(path,PATH_MAX))
  				msg("Couldn't get current directory.");
  				exit(EX_SYSTEM);
  #else
  			char *getwd();

--- 126,135 ----
  	time(&this_time);
  	if(gnu_dumpfile[0]!='/') {
  #if defined(__MSDOS__) || defined(USG) || defined(_POSIX_VERSION)
! 			if(!getcwd(path,PATH_MAX)) {
  				msg("Couldn't get current directory.");
  				exit(EX_SYSTEM);
+ 			}
  #else
  			char *getwd();

diff -c tar/names.c:1.1.1.1 tar/names.c:1.2
*** tar/names.c:1.1.1.1	Mon Sep 14 11:13:27 1992
--- tar/names.c	Mon Sep 14 11:13:28 1992
***************
*** 58,64 ****
--- 58,66 ----
  	int	uid;
  {
  	struct passwd	*pw;
+ #ifndef HAVE_GETPWUID
  	extern struct passwd *getpwuid ();
+ #endif

  	if (uid != saveuid) {
  		saveuid = uid;
***************
*** 97,103 ****
--- 99,107 ----
  	int	gid;
  {
  	struct group	*gr;
+ #ifndef HAVE_GETGRGID
  	extern struct group *getgrgid ();
+ #endif

  	if (gid != savegid) {
  		savegid = gid;
diff -c tar/port.h:1.1.1.1 tar/port.h:1.3
*** tar/port.h:1.1.1.1	Mon Sep 14 11:13:28 1992
--- tar/port.h	Mon Sep 14 11:13:28 1992
***************
*** 68,74 ****
  #define PTR void *
  #else
  #define PTR char *
- #define const
  #endif

  /* Since major is a function on SVR4, we can't just use `ifndef major'.  */
--- 68,73 ----
***************
*** 98,104 ****
--- 97,109 ----
  #if !defined(__MSDOS__) && !defined(STDC_HEADERS)
  #include <memory.h>
  #endif
+ #ifdef index
+ #undef index
+ #endif
  #define index strchr
+ #ifdef rindex
+ #undef rindex
+ #endif
  #define rindex strrchr
  #define bcopy(s, d, n) memcpy(d, s, n)
  #define bzero(s, n) memset(s, 0, n)
diff -c tar/regex.h:1.1.1.1 tar/regex.h:1.3
*** tar/regex.h:1.1.1.1	Mon Sep 14 11:13:29 1992
--- tar/regex.h	Mon Sep 14 11:13:29 1992
***************
*** 456,466 ****

  #else /* not __STDC__ */

- /* Support old C compilers.  */
- #define const
-
  extern reg_syntax_t re_set_syntax ();
! extern char *re_compile_pattern ();
  extern int re_search (), re_search_2 ();
  extern int re_match (), re_match_2 ();
  extern void re_set_registers ();
--- 456,463 ----

  #else /* not __STDC__ */

  extern reg_syntax_t re_set_syntax ();
! extern const char *re_compile_pattern ();
  extern int re_search (), re_search_2 ();
  extern int re_match (), re_match_2 ();
  extern void re_set_registers ();
diff -c tar/rmt.c:1.1.1.1 tar/rmt.c:1.2
*** tar/rmt.c:1.1.1.1	Mon Sep 14 11:13:30 1992
--- tar/rmt.c	Mon Sep 14 11:13:30 1992
***************
*** 252,258 ****
  	maxrecsize = size;
  #ifdef SO_RCVBUF
  	while (size > 1024 &&
! 	       setsockopt(0, SOL_SOCKET, SO_RCVBUF, &size, sizeof (size)) < 0)
  		size -= 1024;
  #else
  	size= 1+((size-1)%1024);
--- 252,258 ----
  	maxrecsize = size;
  #ifdef SO_RCVBUF
  	while (size > 1024 &&
! 	       setsockopt(0, SOL_SOCKET, SO_RCVBUF, (char *) &size, sizeof (size)) < 0)
  		size -= 1024;
  #else
  	size= 1+((size-1)%1024);
diff -c tar/tar.c:1.1.1.1 tar/tar.c:1.2
*** tar/tar.c:1.1.1.1	Mon Sep 14 11:13:31 1992
--- tar/tar.c	Mon Sep 14 11:13:31 1992
***************
*** 280,286 ****
  		break;
  	case CMD_NONE:
  		msg("you must specify exactly one of the r, c, t, x, or d options\n");
!  		fprintf(stderr,"For more information, type ``%s +help''.\n",tar);
  		exit(EX_ARGSBAD);
  	}
  	if (f_volno_file)
--- 280,286 ----
  		break;
  	case CMD_NONE:
  		msg("you must specify exactly one of the r, c, t, x, or d options\n");
!  		fprintf(stderr,"For more information, type ``%s --help''.\n",tar);
  		exit(EX_ARGSBAD);
  	}
  	if (f_volno_file)
***************
*** 616,622 ****

  		case '?':
  		badopt:
! 			msg("Unknown option.  Use '%s +help' for a complete list of options.", tar);
  			exit(EX_ARGSBAD);

  		}
--- 616,622 ----

  		case '?':
  		badopt:
! 			msg("Unknown option.  Use '%s --help' for a complete list of options.", tar);
  			exit(EX_ARGSBAD);

  		}
***************
*** 973,981 ****
  		if(chdir_name[0]!='/') {
  			char *path = ck_malloc(PATH_MAX);
  #if defined(__MSDOS__) || defined(USG) || defined(_POSIX_VERSION)
! 			if(!getcwd(path,PATH_MAX))
  				msg("Couldn't get current directory.");
  				exit(EX_SYSTEM);
  #else
  			char *getwd();

--- 973,982 ----
  		if(chdir_name[0]!='/') {
  			char *path = ck_malloc(PATH_MAX);
  #if defined(__MSDOS__) || defined(USG) || defined(_POSIX_VERSION)
! 			if(!getcwd(path,PATH_MAX)) {
  				msg("Couldn't get current directory.");
  				exit(EX_SYSTEM);
+ 			}
  #else
  			char *getwd();

diff -c tar/wildmat.c:1.1.1.1 tar/wildmat.c:1.2
*** tar/wildmat.c:1.1.1.1	Mon Sep 14 11:13:32 1992
--- tar/wildmat.c	Mon Sep 14 11:13:32 1992
***************
*** 104,110 ****
  		return(*++p ? Star(s, p) : TRUE);
  	    case '[':
  		/* [!....] means inverse character class. */
! 		if (reverse = p[1] == '!')
  		    p++;
  		for (last = 0400, matched = FALSE; *++p && *p != ']'; last = *p)
  		    /* This next line requires a good C compiler. */
--- 104,110 ----
  		return(*++p ? Star(s, p) : TRUE);
  	    case '[':
  		/* [!....] means inverse character class. */
! 		if (reverse = (p[1] == '!' || p[1] == '^'))
  		    p++;
  		for (last = 0400, matched = FALSE; *++p && *p != ']'; last = *p)
  		    /* This next line requires a good C compiler. */
Technical Details
Message-ID: <9209141830.AA00130@rangoon.gain.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!gain.COM!jtc

Show Full Headers
Complete Article Headers
Newsgroups: gnu.utils.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!gain.COM!jtc
From: jtc@gain.COM (J.T. Conklin)
Subject: tar-1.1 and SunOS4.1.2, Solaris 2.0, AIX 3.2, HPUX 8.07, ULTRIX, and IRIX 4.0.1
Message-ID: <9209141830.AA00130@rangoon.gain.com>
Sender: gnulists@ai.mit.edu
Reply-To: jtc@gain.com
Organization: GAIN Technology Inc., Palo Alto, CA
Distribution: gnu
Date: Mon, 14 Sep 1992 04:30:37 GMT
Approved: bug-gnu-utils@prep.ai.mit.edu
Lines: 1222