Bug fix: -update_r and others did not work properly with relative paths

This commit is contained in:
Thomas Schmitt 2008-05-15 19:20:59 +00:00
parent cee91f4859
commit ac41f4cfd9
2 changed files with 41 additions and 24 deletions

View File

@ -5054,6 +5054,8 @@ int Xorriso_warn_of_wildcards(struct XorrisO *xorriso, char *path, int flag)
(flag&2) ? "-disk_pattern" : "-iso_rr_pattern");
}
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
sprintf(xorriso->info_text,"Pattern seen: %s\n", path);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
return(1);
}
return(0);
@ -8206,14 +8208,21 @@ 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[6];
char *ipth, *argv[6], eff_origin[SfileadrL], eff_dest[SfileadrL];
ipth= iso_path;
if(ipth[0]==0)
ipth= disk_path;
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, disk_path, eff_origin,
2|4);
if(ret<=0)
return(ret);
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, ipth, eff_dest, 2);
if(ret<=0)
return(ret);
if(xorriso->disk_excl_mode&8)
ret= Xorriso_path_is_excluded(xorriso, disk_path, 1);
ret= Xorriso_path_is_excluded(xorriso, eff_origin, 1);
else
ret= 0;
if(ret!=0)
@ -8227,26 +8236,26 @@ int Xorriso_option_compare(struct XorrisO *xorriso, char *disk_path,
if(flag&8) {
xorriso->find_compare_result= 1;
argv[0]= ipth;
argv[0]= eff_dest;
argv[1]= "-exec";
argv[2]= "compare";
argv[3]= disk_path;
argv[3]= eff_origin;
zero= 0;
ret= Xorriso_option_find(xorriso, 4, argv, &zero, 2); /* -findi */
if(ret>0) {
argv[0]= disk_path;
argv[0]= eff_origin;
argv[1]= "-exec";
argv[2]= "not_in_iso";
argv[3]= ipth;
argv[3]= eff_dest;
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[0]= eff_origin;
argv[1]= "-type";
argv[2]= "m";
argv[3]= "-exec";
argv[4]= "is_full_in_iso";
argv[5]= ipth;
argv[5]= eff_dest;
zero= 0;
ret= Xorriso_option_find(xorriso, 6, argv, &zero, 1|2); /* -findx */
}
@ -8258,7 +8267,7 @@ int Xorriso_option_compare(struct XorrisO *xorriso, char *disk_path,
ret= -1;
} else {
follow_links= (xorriso->do_follow_links || xorriso->do_follow_param) << 28;
ret= Xorriso_compare_2_files(xorriso, disk_path, ipth, "", &result,
ret= Xorriso_compare_2_files(xorriso, eff_origin, eff_dest, "", &result,
2 | follow_links | ((flag&4)<<27) | (1<<30));
}
@ -10775,6 +10784,7 @@ int Xorriso_option_update(struct XorrisO *xorriso, char *disk_path,
int not_in_iso= 0, not_on_disk= 0;
double mem_lut= 0.0, start_time;
char *ipth, *argv[6], sfe[5*SfileadrL];
char eff_origin[SfileadrL], eff_dest[SfileadrL];
struct stat stbuf;
start_time= Sfile_microtime(0);
@ -10782,6 +10792,13 @@ int Xorriso_option_update(struct XorrisO *xorriso, char *disk_path,
ipth= iso_path;
if(ipth[0]==0)
ipth= disk_path;
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, disk_path, eff_origin,
2|4);
if(ret<=0)
return(ret);
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, ipth, eff_dest, 2);
if(ret<=0)
return(ret);
if(!(flag&2)) {
Xorriso_pacifier_reset(xorriso, 0);
@ -10792,25 +10809,25 @@ int Xorriso_option_update(struct XorrisO *xorriso, char *disk_path,
if(flag&1) {
sprintf(xorriso->info_text, "Updating %s to",
Text_shellsafe(disk_path, sfe, 0));
Text_shellsafe(eff_origin, sfe, 0));
sprintf(xorriso->info_text+strlen(xorriso->info_text), " %s\n",
Text_shellsafe(ipth, sfe, 0));
Text_shellsafe(eff_dest, sfe, 0));
Xorriso_info(xorriso,0);
}
if(xorriso->disk_excl_mode&8)
ret= Xorriso_path_is_excluded(xorriso, disk_path, 1);
ret= Xorriso_path_is_excluded(xorriso, eff_origin, 1);
else
ret= 0;
if(ret!=0)
goto report_outcome;
if(flag&8) {
xorriso->find_compare_result= 1;
ret= Xorriso_iso_lstat(xorriso, ipth, &stbuf, 0);
ret= Xorriso_iso_lstat(xorriso, eff_dest, &stbuf, 0);
if(ret >= 0) {
argv[0]= ipth;
argv[0]= eff_dest;
argv[1]= "-exec";
argv[2]= "update";
argv[3]= disk_path;
argv[3]= eff_origin;
zero= 0;
ret= Xorriso_option_find(xorriso, 4, argv, &zero, 2); /* -findi */
} else if(ret==-2) { /* severe error (e.g. lack of image) */
@ -10821,21 +10838,21 @@ int Xorriso_option_update(struct XorrisO *xorriso, char *disk_path,
ret= 1;
}
if(ret>0) {
ret= lstat(disk_path, &stbuf);
ret= lstat(eff_origin, &stbuf);
if(ret != -1) {
argv[0]= disk_path;
argv[0]= eff_origin;
argv[1]= "-exec";
argv[2]= "add_missing";
argv[3]= ipth;
argv[3]= eff_dest;
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[0]= eff_origin;
argv[1]= "-type";
argv[2]= "m";
argv[3]= "-exec";
argv[4]= "empty_iso_dir";
argv[5]= ipth;
argv[5]= eff_dest;
zero= 0;
ret= Xorriso_option_find(xorriso, 6, argv, &zero, 1|2); /* -findx */
}
@ -10858,11 +10875,11 @@ int Xorriso_option_update(struct XorrisO *xorriso, char *disk_path,
} else {
/* compare ctime too, no filename reporting, eventually silent */
follow_links= (xorriso->do_follow_links || xorriso->do_follow_param) <<28;
ret= Xorriso_compare_2_files(xorriso, disk_path, ipth, "", &result,
ret= Xorriso_compare_2_files(xorriso, eff_origin, eff_dest, "", &result,
2 | follow_links | ((flag&4)<<27) | (3<<30));
if(ret==0) {
uret= Xorriso_update_interpreter(xorriso, NULL, result, disk_path, ipth,
0);
uret= Xorriso_update_interpreter(xorriso, NULL, result, eff_origin,
eff_dest, 0);
if(uret<=0)
ret= -1;
if(uret==3)

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.05.15.150041"
#define Xorriso_timestamP "2008.05.15.192118"