分类: LINUX
2007-02-27 15:08:51
From: Daniel Hurtubise ()
Date: Thu Aug 20 1992 - 14:14:34 CDT
Here is the summary to my tar problem. First of all the "file name too
long" message is a known problem which is clearly mentioned in the
man pages for tar in the BUGS section:
"Files with names longer than 100 characters cannot be pro-
cessed."
Consequently, I'm sorry to have bothered everybody when I should have
thought of reading the man pages first.
In addition, here the file structure for tar found in "man 5 tar":
#define TBLOCK 512
#define NAMSIZ 100
union hblock {
char dummy[TBLOCK];
struct header {
char name[NAMSIZ];
char mode[8];
char uid[8];
char gid[8];
char size[12];
char mtime[12];
char chksum[8];
char linkflag;
char linkname[NAMSIZ];
} dbuf;
};
However, I did get some good information on alternatives to tar.
While waiting for you responses, I used dump/restore which is one
solution that most everybody mentioned. The other solutions are:
1) Use GNUtar which has a limit of around 255 characters, maybe more.
Here is an explanation of how GNUtar works from
(John Benjamins):
"My solution has been to use the GNU version of tar. When GNU tar gets
to a file with a "too long" name, it saves it as ./MaNgLeD.xxx where
xxx is an integer, unique to each file in the archive. It also
appends a file ././MaNgLeD_NaMeS at the end of the archive. This is
used by GNU tar to restore the file names when they are subsequently
extracted from the archive. Note that GNU tar is needed to get the
files back with the correct names, using ordinary tar will give you
files with the MaNgLeD names."
2) Use bar
3) Use /usr/5bin/pax under 4.1.1 (haven't checked for 4.1.2)
4) Use dump/restore, which can be used in a pipe as explained by
(Koper Jamgocyan):
"Use dump and restore in a pipe. Note that dump can also dump any
subfilesystem and not only the whole filesystem. That is:
mounted filesystem: ("4.2"): /mnt/test/from-dir (/mnt is the mount point)
you need the from-dir (recursively) somewhere else.
cd /mnt
dump 0f - test/from-dir | (cd /somewhere-else ; restore xf -)
The disadvantages: 1) you must be root
2) /somewhere-else/test/from-dir is created, you have
to move from-dir up."
5) Use cpio. Here is an interesting suggestion from
(Denis Faas):