[gnu.utils.bug] GNU tar socket special files

shaw@paralogics.UUCP (Guy Shaw) (02/20/90)

I have added recognition of sockets to my copy of tar 1.07.
I would like to know if there is some reason that sockets were not included.
If this was just an oversight, then I submit these 4 context diffs for your
consideration.  If support for sockets was considered and rejected for some
reason, I would appreciate it if someone would tell me what I am overlooking.
Also, if anyone else has claimed "#define LF_... '8'", I would like to know
if there is a preferred value or range of values which would be relatively
safe from conflicting with FSF maintainers' plans.
Meanwhile, I'm using my modified version of tar.  Works for me.

By the way.  I'm not saying this is a bug.  I posted to the Usenet newsgroup,
gnu.utils.bug, because I have never seen just plain gnu.utils.

*** tar.h.old	Thu Mar 23 15:01:20 1989
--- tar.h	Tue Feb 20 00:29:07 1990
***************
*** 92,97 ****
--- 92,98 ----
  #define	LF_DIR		'5'		/* Directory */
  #define	LF_FIFO		'6'		/* FIFO special file */
  #define	LF_CONTIG	'7'		/* Contiguous file */
+ #define	LF_SOCKET	'8'		/* Socket */
  /* Further link types may be defined later. */
  
  #define LF_DUMPDIR	'D'		/* This is a dir entry that contains


*** create.c.old	Thu Mar 23 15:01:22 1989
--- create.c	Tue Feb 20 00:32:07 1990
***************
*** 241,246 ****
--- 241,250 ----
  	case S_IFIFO:			/* Fifo      special file */
  #endif
  
+ #ifdef S_IFSOCK
+ 	case S_IFSOCK:			/* Socket    special file */
+ #endif
+ 
  		/* First quick and dirty.  Hashing, etc later FIXME */
  		for (lp = linklist; lp; lp = lp->next) {
  			if (lp->ino == hstat.st_ino &&
***************
*** 551,556 ****
--- 555,565 ----
  		type = LF_FIFO;
  #endif
  
+ #ifdef S_IFSOCK
+ 	case S_IFSOCK:			/* Socket    special file */
+ 		type = LF_SOCKET;
+ #endif
+ 
  	easy:
  		if (!f_standard) goto unknown;
  
***************
*** 559,565 ****
  		if (header == NULL) goto badfile;	/* eg name too long */
  
  		header->header.linkflag = type;
! 		if (type != LF_FIFO) {
  			to_oct((long) major(hstat.st_rdev), 8,
  				header->header.devmajor);
  			to_oct((long) minor(hstat.st_rdev), 8,
--- 568,574 ----
  		if (header == NULL) goto badfile;	/* eg name too long */
  
  		header->header.linkflag = type;
! 		if (type != LF_FIFO && type != LF_SOCKET) {
  			to_oct((long) major(hstat.st_rdev), 8,
  				header->header.devmajor);
  			to_oct((long) minor(hstat.st_rdev), 8,


*** extract.c.old	Thu Mar 23 15:01:21 1989
--- extract.c	Tue Feb 20 00:39:18 1990
***************
*** 382,387 ****
--- 382,395 ----
  		goto make_node;
  #endif
  
+ #ifdef S_IFSOCK
+ 	/* If local system doesn't support SOCKETs, use default case */
+ 	case LF_SOCKET:
+ 		hstat.st_mode |= S_IFSOCK;
+ 		hstat.st_rdev = 0;		/* FIXME, do we need this? */
+ 		goto make_node;
+ #endif
+ 
  	make_node:
  		check = mknod(skipcrud+head->header.name,
  			      (int) hstat.st_mode, (int) hstat.st_rdev);


*** diffarch.c.old	Thu Mar  2 09:58:09 1989
--- diffarch.c	Tue Feb 20 00:38:19 1990
***************
*** 257,262 ****
--- 257,270 ----
  		goto check_node;
  #endif
  
+ #ifdef S_IFSOCK
+ 	/* If local system doesn't support SOCKETs, use default case */
+ 	case LF_SOCKET:
+ 		hstat.st_mode |= S_IFSOCK;
+ 		hstat.st_rdev = 0;		/* FIXME, do we need this? */
+ 		goto check_node;
+ #endif
+ 
  	check_node:
  		/* FIXME, deal with umask */
  		if(do_stat(&filestat))

Aaaahhh, source code -- my favorite.
-- 
Guy Shaw
Paralogics
paralogics!shaw@uunet.uu.net  or  uunet!paralogics!shaw