Bug fix: -not_leaf and -not_paths were not applied to -extract and alike

This commit is contained in:
2021-09-13 17:12:34 +02:00
parent 358262818e
commit b5a33c3418
6 changed files with 227 additions and 125 deletions

View File

@ -2,7 +2,7 @@
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
Copyright 2007-2020 Thomas Schmitt, <scdbackup@gmx.net>
Copyright 2007-2021 Thomas Schmitt, <scdbackup@gmx.net>
Provided under GPL version 2 or later.
@ -1591,7 +1591,6 @@ ex:;
/* @param flag bit0= recursion is active
bit1= do not report restored files
bit6= this is a copy action: do not fake times and ownership
bit8= only register non-directory nodes in xorriso->node_array
bit7+8=
0= direct operation
1= create only directories,
@ -1731,9 +1730,14 @@ much_too_long:;
{ret= 0; goto was_problem;}
if(Xorriso_much_too_long(xorriso, len_ip + strlen(leaf_name)+1, 0)<=0)
{ret= 0; goto was_problem;}
/* name is a pointer into img_path */
/* name and disk_name are pointers into img_path and disk_path */
strcpy(name, leaf_name);
strcpy(disk_name, leaf_name);
ret= Xorriso_path_is_excluded(xorriso, disk_path, 2);
if(ret < 0)
goto was_problem;
if(ret > 0)
continue;
stbuf_src= srcpt;
ret= Xorriso_fake_stbuf(xorriso, img_path, &stbuf, &node, 1);
@ -1811,6 +1815,8 @@ much_too_long:;
} else {
ret= Xorriso_restore_disk_object(xorriso, img_path, node, disk_path,
(off_t) 0, (off_t) 0, hflag);
if(ret == 3) /* intentionally not restored */
do_not_dive= 1;
}
if(ret<=0)
goto was_problem;
@ -1923,11 +1929,18 @@ int Xorriso_restore(struct XorrisO *xorriso,
goto ex;
}
ret= Xorriso_path_is_excluded(xorriso, disk_path, !(flag&4));
if(ret<0)
goto ex;
if(ret>0)
ret= Xorriso_path_is_excluded(xorriso, disk_path, 4 | 2 | !(flag & 4));
if(ret < 0)
{ret= 0; goto ex;}
if(ret > 0) {
if(!(flag & 4)) {
strcpy(xorriso->info_text,
"Excluded from restoring by -not_path or -not_leaf :");
Text_shellsafe(disk_path, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
}
{ret= 3*!!(flag&16); goto ex;}
}
ret= Xorriso_get_volume(xorriso, &volume, 0);
if(ret<=0)
@ -2126,7 +2139,11 @@ int Xorriso_restore_node_array(struct XorrisO *xorriso, int flag)
img_path, disk_path, hflag);
if(ret<=0)
goto was_problem;
/* (Exclusion must already be handled when the node array gets filled,
because of no distinction between parameter and tree passenger here.)
*/
ret= Xorriso_handle_collision(xorriso, node, img_path, disk_path, disk_path,
&stbuf_ret, 64);
if(ret<=0 || ret==3)
@ -2213,9 +2230,16 @@ int Xorriso_paste_in(struct XorrisO *xorriso, char *disk_path,
2|4);
if(ret<=0)
goto ex;
ret= Xorriso_path_is_excluded(xorriso, disk_path, !(flag&1));
ret= Xorriso_path_is_excluded(xorriso, disk_path, 4 | 2 | !(flag & 1));
if(ret > 0 && !(flag & 1)) {
strcpy(xorriso->info_text,
"Excluded from restoring by -not_path or -not_leaf :");
Text_shellsafe(disk_path, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
}
if(ret!=0)
{ret= 0; goto ex;}
ret= stat(eff_dest, &stbuf);
if(ret!=-1 && !S_ISREG(stbuf.st_mode)) {
Xorriso_msgs_submit(xorriso, 0, eff_dest, 0, "ERRFILE", 0);
@ -2279,13 +2303,16 @@ int Xorriso_extract_cut(struct XorrisO *xorriso,
disk_path, eff_disk_path, 2 | 4);
if(ret<=0)
goto ex;
Xorriso_pacifier_reset(xorriso, 0);
mem_lut= xorriso->last_update_time;
ret= Xorriso_handle_collision(xorriso, node, img_path, eff_disk_path,
disk_path, &stbuf_ret, 0);
if(ret<=0 || ret==3)
ret= Xorriso_path_is_excluded(xorriso, eff_disk_path, 1 | 2 | 4);
if(ret < 0)
goto ex;
if(ret > 0) {
strcpy(xorriso->info_text,
"Excluded from restoring by -not_path or -not_leaf :");
Text_shellsafe(eff_disk_path, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
{ret= 0; goto ex;}
}
/* If it is a non-filtered stream from the ISO image
and img_offset is a multiple of 2048
@ -2299,6 +2326,13 @@ int Xorriso_extract_cut(struct XorrisO *xorriso,
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
{ret= 0; goto ex;}
}
ret= Xorriso_handle_collision(xorriso, node, img_path, eff_disk_path,
disk_path, &stbuf_ret, 0);
if(ret<=0 || ret==3)
{ret= 0; goto ex;}
Xorriso_pacifier_reset(xorriso, 0);
mem_lut= xorriso->last_update_time;
read_raw= 0;
if((img_offset % 2048) == 0) {
ret= Xorriso_is_plain_image_file(xorriso, node, "", 0);