From: Sergey Poznyakoff Date: Fri, 1 Jun 2007 21:24:30 +0000 (+0000) Subject: (decode_xform): Exempt symbolic links from component X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=fe576585e617e3149a72fce79713dd2912f93e11;p=chaz%2Ftar (decode_xform): Exempt symbolic links from component stripping and name suffix normalization. --- diff --git a/src/list.c b/src/list.c index 8a97b03..75837f6 100644 --- a/src/list.c +++ b/src/list.c @@ -472,9 +472,27 @@ read_header (bool raw_extended_headers) static char * decode_xform (char *file_name, void *data) { - bool link_target = *(bool*)data; - file_name = safer_name_suffix (file_name, link_target, - absolute_names_option); + xform_type type = *(xform_type*)data; + + switch (type) + { + case xform_symlink: + /* FIXME: It is not quite clear how and to which extent are the symbolic + links subject to filename transformation. In the absence of another + solution, symbolic links are exempt from component stripping and + name suffix normalization, but subject to filename transformation + proper. */ + return file_name; + + case xform_link: + file_name = safer_name_suffix (file_name, true, absolute_names_option); + break; + + case xform_regfile: + file_name = safer_name_suffix (file_name, false, absolute_names_option); + break; + } + if (strip_name_components) { size_t prefix_len = stripped_prefix_len (file_name, @@ -487,9 +505,9 @@ decode_xform (char *file_name, void *data) } bool -transform_member_name (char **pinput, bool lnk) +transform_member_name (char **pinput, xform_type type) { - return transform_name_fp (pinput, decode_xform, &lnk); + return transform_name_fp (pinput, decode_xform, &type); } #define ISOCTAL(c) ((c)>='0'&&(c)<='7') @@ -610,7 +628,7 @@ decode_header (union block *header, struct tar_stat_info *stat_info, stat_info->is_dumpdir = true; } - transform_member_name (&stat_info->file_name, false); + transform_member_name (&stat_info->file_name, xform_regfile); } /* Convert buffer at WHERE0 of size DIGS from external format to