[net.bugs.2bsd] bug in 2.9BSD TAR

dan@sri-tsc.UUCP (Dan Chernikoff) (07/11/84)

Subject: tar won't tar symlinks
Index:	cmd/tar.c 2.9bsd

Description:
	When you try to tar a directory that contains symlinks, you get
	the error message "readlink: no such file or directory" for
	each symbolic link, and the link is not written on the tape.
	Note, this occurs only if the "-h" flag is NOT used, and you
	do NOT give an absolute pathname of the directory on the 
	command line.
Repeat-By:
	cd /usr
	tar c0 include
		(assuming your /usr/include has symlinks, e.g.
		 /usr/include/net slinked to /usr/src/net).
Fix:
	In the subroutine putfile, where tar is writing out the symlink,
	change the line

		i = readlink(longname, dblock.dbuf.linkname, NAMSIZ - 1);

	to be

		i = readlink(shortname, dblock.dbuf.linkname, NAMSIZ - 1);

	and all will be better.