Made -update_r and -compare_r obey disabling of -follow "mount"

This commit is contained in:
Thomas Schmitt 2008-03-07 22:04:58 +00:00
parent 955d08c735
commit 63c67bd1c1
5 changed files with 58 additions and 8 deletions

View File

@ -1325,6 +1325,12 @@ exist in the ISO image.
E.g.
.br
-find /home/thomas -exec add_missing /thomas_on_cd
.br
"is_full_in_iso" iso_rr_path_start reports if the counterpart in the ISO image
contains files. To be used with -type "m" to report mount points.
.br
"empty_iso_dir" iso_rr_path_start deletes all files from the counterpart
in the ISO image. To be used with -type "m" to truncate mount points.
.TP
\fB\-compare\fR disk_path iso_rr_path
Compare attributes and eventual data file content of a fileobject in the

View File

@ -2405,7 +2405,8 @@ struct FindjoB {
16= not_in_iso
17= update
18= add_missing
>>>19= empty_iso_dir
19= empty_iso_dir
20= is_full_in_iso
*/
int action;
char *target;
@ -6143,7 +6144,7 @@ int Xorriso_findx_action(struct XorrisO *xorriso, struct FindjoB *job,
action= 0;
if(action<0)
action= 0;
if(action==15 || action==16 || action==18 || action==19) {
if(action==15 || action==16 || action==18 || action==19 || action==20) {
/* in_iso , not_in_iso, add_missing */
Findjob_get_start_path(job, &disk_prefix, 0);
if(strncmp(abs_path, disk_prefix, strlen(disk_prefix))!=0)
@ -6197,6 +6198,23 @@ int Xorriso_findx_action(struct XorrisO *xorriso, struct FindjoB *job,
Text_shellsafe(iso_path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "UPDATE", 0);
}
} else if(action==20) { /* is_full_in_iso */
ret= Xorriso_iso_lstat(xorriso, iso_path, &stbuf, 0);
if(ret==-1)
return(1);
if(!S_ISDIR(stbuf.st_mode))
return(1);
strcpy(sfe, xorriso->wdi);
strcpy(xorriso->wdi, iso_path);
ret= Xorriso_ls(xorriso, 4|8);
strcpy(xorriso->wdi, sfe);
if(ret>0) {
sprintf(xorriso->result_line,
"d %s (ISO) : non-empty directory (would not match mount point)\n",
Text_shellsafe(iso_path, sfe, 0));
Xorriso_result(xorriso,0);
}
return(1);
} else {
sprintf(xorriso->result_line, "%s\n", Text_shellsafe(show_path, sfe, 0));
Xorriso_result(xorriso, 0);
@ -7925,7 +7943,7 @@ int Xorriso_option_compare(struct XorrisO *xorriso, char *disk_path,
{
int ret, mem_pci, zero= 0, result, follow_links;
double mem_lut= 0.0;
char *ipth, *argv[4];
char *ipth, *argv[6];
ipth= iso_path;
if(ipth[0]==0)
@ -7953,6 +7971,16 @@ int Xorriso_option_compare(struct XorrisO *xorriso, char *disk_path,
argv[3]= ipth;
zero= 0;
ret= Xorriso_option_find(xorriso, 4, argv, &zero, 1|2); /* -findx */
if(ret>0 && !xorriso->do_follow_mount) {
argv[0]= disk_path;
argv[1]= "-type";
argv[2]= "m";
argv[3]= "-exec";
argv[4]= "is_full_in_iso";
argv[5]= ipth;
zero= 0;
ret= Xorriso_option_find(xorriso, 6, argv, &zero, 1|2); /* -findx */
}
if(ret>0)
ret= xorriso->find_compare_result;
else
@ -8561,7 +8589,8 @@ not_enough_arguments:;
} else if(strcmp(cpt, "in_iso")==0 ||
strcmp(cpt, "not_in_iso")==0 ||
strcmp(cpt, "add_missing")==0 ||
strcmp(cpt, "empty_iso_dir")==0) {
strcmp(cpt, "empty_iso_dir")==0 ||
strcmp(cpt, "is_full_in_iso")==0) {
if(i+1>=end_idx)
goto not_enough_arguments;
i++;
@ -8575,6 +8604,8 @@ not_enough_arguments:;
action= 18;
else if(strcmp(cpt, "empty_iso_dir")==0)
action= 19;
else if(strcmp(cpt, "is_full_in_iso")==0)
action= 20;
else
action= 16;
Findjob_set_action_target(job, action, other_path_start, 0);
@ -10046,7 +10077,7 @@ int Xorriso_option_update(struct XorrisO *xorriso, char *disk_path,
{
int ret, mem_pci, zero= 0, result, uret, follow_links;
double mem_lut= 0.0, start_time;
char *ipth, *argv[4];
char *ipth, *argv[6];
struct stat stbuf;
start_time= Sfile_microtime(0);
@ -10083,6 +10114,16 @@ int Xorriso_option_update(struct XorrisO *xorriso, char *disk_path,
argv[3]= ipth;
zero= 0;
ret= Xorriso_option_find(xorriso, 4, argv, &zero, 1|2); /* -findx */
if(ret>0 && !xorriso->do_follow_mount) {
argv[0]= disk_path;
argv[1]= "-type";
argv[2]= "m";
argv[3]= "-exec";
argv[4]= "empty_iso_dir";
argv[5]= ipth;
zero= 0;
ret= Xorriso_option_find(xorriso, 6, argv, &zero, 1|2); /* -findx */
}
if(ret>0)
ret= xorriso->find_compare_result;
else

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.03.07.182411"
#define Xorriso_timestamP "2008.03.07.220442"

View File

@ -3414,6 +3414,7 @@ int Xorriso_ls_filev(struct XorrisO *xorriso, char *wd,
@param flag bit0= long format
bit1= only check for directory existence
bit2= do not apply search pattern but accept any file
bit3= just count nodes and return number
*/
int Xorriso_ls(struct XorrisO *xorriso, int flag)
{
@ -3468,7 +3469,8 @@ cannot_create_iter:;
iso_dir_iter_free(iter);
iter= NULL;
Xorriso_process_msg_queues(xorriso,0);
if(flag&8)
{ret= filec; goto ex;}
sprintf(xorriso->info_text, "Valid ISO nodes found: %d\n", filec);
Xorriso_info(xorriso,1);
@ -3530,7 +3532,7 @@ ex:;
Xorriso_process_msg_queues(xorriso,0);
if(node_array!=NULL)
free((char *) node_array);
return(1);
return(ret);
}
/* @param boss_iter Opaque handle to be forwarded to actions in ISO image

View File

@ -94,6 +94,7 @@ int Xorriso_ls_filev(struct XorrisO *xorriso, char *wd,
@param flag bit0= long format
bit1= only check for directory existence
bit2= do not apply search pattern but accept any file
bit3= just count nodes and return number
*/
int Xorriso_ls(struct XorrisO *xorriso, int flag);