Bug fix: -as mkisofs did not unescape "\=" in the source part of pathspecs
This commit is contained in:
@ -1132,6 +1132,74 @@ ex:;
|
||||
}
|
||||
|
||||
|
||||
/* Implementing mkisofs tendency to map single-path pathspecs to / */
|
||||
int Xorriso_graftable_pathspec(struct XorrisO *xorriso, char *in_pathspec,
|
||||
char *pathspec, int flag)
|
||||
{
|
||||
int ret, l;
|
||||
char *esc_wdx= NULL, *eff_path= NULL, *ept;
|
||||
|
||||
if((!xorriso->allow_graft_points) ||
|
||||
Fileliste__target_source_limit(in_pathspec, '=', &ept, 0) <= 0) {
|
||||
|
||||
Xorriso_alloc_meM(esc_wdx, char, SfileadrL);
|
||||
Xorriso_alloc_meM(eff_path, char, SfileadrL);
|
||||
|
||||
strcpy(esc_wdx, xorriso->wdx);
|
||||
if(!xorriso->allow_graft_points) {
|
||||
ret= Fileliste__escape_source_path(esc_wdx, SfileadrL, 0);
|
||||
if(ret <= 0) {
|
||||
Xorriso_msgs_submit(xorriso, 0,
|
||||
"Escaped -cdx directory gets much too long", 0, "FAILURE", 0);
|
||||
ret= 0; goto ex;
|
||||
}
|
||||
}
|
||||
ret= Xorriso_normalize_img_path(xorriso, esc_wdx, in_pathspec,
|
||||
eff_path, 2|4);
|
||||
if(ret <= 0)
|
||||
{ret= 0; goto ex;}
|
||||
ret= Sfile_type(eff_path,
|
||||
1 | ((xorriso->do_follow_param || xorriso->do_follow_links) << 2));
|
||||
if(ret == 2) {
|
||||
strcpy(pathspec, "/=");
|
||||
} else {
|
||||
pathspec[0]= '/';
|
||||
pathspec[1]= 0;
|
||||
ret= Sfile_leafname(eff_path, pathspec + 1, 0);
|
||||
if(ret>0) {
|
||||
if(!xorriso->allow_graft_points) {
|
||||
ret= Fileliste__escape_source_path(pathspec, SfileadrL, 0);
|
||||
if(ret <= 0) {
|
||||
Xorriso_msgs_submit(xorriso, 0,
|
||||
"Escaped leaf name gets much too long", 0, "FAILURE", 0);
|
||||
ret= 0; goto ex;
|
||||
}
|
||||
}
|
||||
strcat(pathspec, "=");
|
||||
} else
|
||||
pathspec[0]= 0;
|
||||
}
|
||||
l= strlen(pathspec);
|
||||
strcat(pathspec, eff_path);
|
||||
if(!xorriso->allow_graft_points) {
|
||||
ret= Fileliste__escape_source_path(pathspec + l, 2 * SfileadrL - l, 0);
|
||||
if(ret <= 0) {
|
||||
Xorriso_msgs_submit(xorriso, 0,
|
||||
"Escaped path gets much too long", 0, "FAILURE", 0);
|
||||
ret= 0; goto ex;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Sfile_str(pathspec, in_pathspec, 0);
|
||||
}
|
||||
ret= 1;
|
||||
ex:;
|
||||
Xorriso_free_meM(esc_wdx);
|
||||
Xorriso_free_meM(eff_path);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
int Xorriso_genisofs_path_pecul(struct XorrisO *xorriso, int *was_path,
|
||||
int with_emul_toc, int *allow_dir_id_ext,
|
||||
int *iso_level, int flag)
|
||||
@ -1673,7 +1741,7 @@ illegal_c:;
|
||||
goto problem_handler_2;
|
||||
|
||||
} else if(strcmp(argpt, "-graft-points")==0) {
|
||||
xorriso->allow_graft_points= 1;
|
||||
xorriso->allow_graft_points= 3;
|
||||
} else if(strcmp(argpt, "-path-list")==0 ||
|
||||
strcmp(argpt, "--quoted_path_list")==0) {
|
||||
if(i+1>=argc) {
|
||||
@ -1686,7 +1754,7 @@ not_enough_args:;
|
||||
i++;
|
||||
xorriso->pacifier_style= 1;
|
||||
ret= Xorriso_option_path_list(xorriso, argv[i],
|
||||
(strcmp(argpt, "--quoted_path_list")==0));
|
||||
(strcmp(argpt, "--quoted_path_list") == 0) | 2);
|
||||
if(ret<=0)
|
||||
goto problem_handler_2;
|
||||
ret = Xorriso_genisofs_path_pecul(xorriso, &was_path, with_emul_toc,
|
||||
@ -2135,36 +2203,9 @@ rr_reloc_dir:;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* implementing mkisofs tendency to map single-path pathspecs to / */
|
||||
if((!xorriso->allow_graft_points) ||
|
||||
Fileliste__target_source_limit(argv[i], '=', &ept, 0)<=0) {
|
||||
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, argv[i],
|
||||
eff_path, 2|4);
|
||||
if(ret<=0)
|
||||
goto problem_handler_2;
|
||||
ret= Sfile_type(eff_path,
|
||||
1|((xorriso->do_follow_param||xorriso->do_follow_links)<<2));
|
||||
if(ret==2) {
|
||||
strcpy(pathspec, "/=");
|
||||
} else {
|
||||
pathspec[0]= '/';
|
||||
pathspec[1]= 0;
|
||||
ret= Sfile_leafname(eff_path, pathspec+1, 0);
|
||||
if(ret>0) {
|
||||
ret= Fileliste__escape_source_path(pathspec, SfileadrL, 0);
|
||||
if(ret <= 0) {
|
||||
Xorriso_msgs_submit(xorriso, 0,
|
||||
"Escaped leaf name gets much too long",
|
||||
0, "FAILURE", 0);
|
||||
goto problem_handler_2;
|
||||
}
|
||||
strcat(pathspec, "=");
|
||||
} else
|
||||
pathspec[0]= 0;
|
||||
}
|
||||
strcat(pathspec, eff_path);
|
||||
} else
|
||||
Sfile_str(pathspec, argv[i], 0);
|
||||
ret= Xorriso_graftable_pathspec(xorriso, argv[i], pathspec, 0);
|
||||
if(ret <= 0)
|
||||
goto problem_handler_2;
|
||||
add_pt= pathspec;
|
||||
|
||||
if(old_root[0]) {
|
||||
@ -2205,10 +2246,10 @@ rr_reloc_dir:;
|
||||
ret= Xorriso_option_update(xorriso, disk_pt, iso_rr_pt, 1 | 8 | 32);
|
||||
} else {
|
||||
mem_graft_points= xorriso->allow_graft_points;
|
||||
xorriso->allow_graft_points= 1;
|
||||
xorriso->allow_graft_points= 3;
|
||||
zero= 0;
|
||||
ret= Xorriso_option_add(xorriso, 1, &add_pt, &zero,
|
||||
(was_path << 1) | (root_seen << 2) | 8);
|
||||
(was_path << 1) | (root_seen << 2));
|
||||
xorriso->allow_graft_points= mem_graft_points;
|
||||
}
|
||||
if(ret<=0)
|
||||
|
Reference in New Issue
Block a user