Mail Archives: djgpp-workers/2001/03/19/10:32:59
I do not know if this is already known but
if tar is invoked as:
tar -cvf foobar.tar --name-prefix=c:/foo/ z:/bar
both path strings, c:/foo and z:/bar will be concatenated
together like this:
foo/z:/bar
instead of:
foo/bar
as it should be. From both path strings, the drive spec
and the leading slash should be removed before concatenating
them . If no name-prefix is given at all the drive spec and
first slash will be removed from
z:/bar
in the correct way.
The patch below documents/fixes the issue.
Regards,
Guerrero, Juan Manuel
diff -acprNC5 tar-1.12a.orig/src/create.c tar-1.12a/src/create.c
*** tar-1.12a.orig/src/create.c Sat Mar 7 18:01:42 1998
--- tar-1.12a/src/create.c Mon Mar 19 16:09:42 2001
*************** start_header (const char *name, struct s
*** 140,149 ****
--- 140,155 ----
union block *header;
char *prefixed_name;
if (name_prefix_option)
{
+ #if DOSWIN
+ /* Remove drive spec and first slash from path name
+ before concatenating prefix and path name. */
+ if (name[0] >= 'A' && name[0] <= 'z' && name[1] == ':')
+ name = (name[2] == '/') ? name + 3 : name + 2;
+ #endif /* DOSWIN */
prefixed_name = (char *)
xmalloc (strlen (name_prefix_option) + strlen (name) + 1);
strcpy (stpcpy (prefixed_name, name_prefix_option), name);
name = prefixed_name;
}
- Raw text -