Bug fix: -findi operated on nodes which ceased existence shortly before

This commit is contained in:
Thomas Schmitt 2008-05-18 08:21:48 +00:00
parent a4615cff1a
commit 3760fe7f53
3 changed files with 51 additions and 15 deletions

View File

@ -7246,7 +7246,7 @@ ex:;
/* @param boss_iter Opaque handle to be forwarded to actions in ISO image
Set to NULL if calling this function from outside ISO world
@param flag bit2= -follow: this is not a command parameter
@return <=0 error, 1= ok , 2= iso_rr_path has been deleted ,
@return <=0 error, 1= ok , 2= iso_rr_path node object has been deleted ,
3= no action taken
*/
int Xorriso_update_interpreter(struct XorrisO *xorriso, void *boss_iter,
@ -7337,6 +7337,7 @@ delete:;
ret= Xorriso_rmi(xorriso, NULL, (off_t) 0, part_path, 1);
if(ret<=0)
goto ex;
deleted= 1;
} else {
partno= i+1;
offset= i*first_bytes;
@ -7359,9 +7360,12 @@ delete:;
ret= Xorriso_copy_properties(xorriso, disk_path, iso_rr_path, 2);
if(ret<=0)
goto ex;
} else
} else {
ret= Xorriso_graft_in(xorriso, boss_iter, disk_path, iso_rr_path,
(off_t) 0, (off_t) 0, 2|(flag&4));
if(ret>0 && !(compare_result&2))
deleted= 1;
}
sprintf(xorriso->info_text, "Added/overwrote ");
} else if(compare_result&(4|16|32|256|512|1024)) {
@ -8214,10 +8218,10 @@ int Xorriso_option_compare(struct XorrisO *xorriso, char *disk_path,
if(ipth[0]==0)
ipth= disk_path;
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, disk_path, eff_origin,
2|4);
2|4|8);
if(ret<=0)
return(ret);
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, ipth, eff_dest, 2);
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, ipth, eff_dest, 2|8);
if(ret<=0)
return(ret);
@ -10793,10 +10797,10 @@ int Xorriso_option_update(struct XorrisO *xorriso, char *disk_path,
if(ipth[0]==0)
ipth= disk_path;
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, disk_path, eff_origin,
2|4);
2|4|8);
if(ret<=0)
return(ret);
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, ipth, eff_dest, 2);
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, ipth, eff_dest, 2|8);
if(ret<=0)
return(ret);

View File

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

View File

@ -1329,6 +1329,7 @@ int Xorriso_node_from_path(struct XorrisO *xorriso, IsoImage *volume,
@param flag bit0= do not produce problem events (unless faulty path format)
bit1= work purely literally, do not use libisofs
bit2= (with bit1) this is an address in the disk world
bit3= return root directory as "/" and not as ""
@return -1 = faulty path format, 0 = not found ,
1 = found simple node , 2 = found directory
*/
@ -1342,8 +1343,11 @@ int Xorriso_normalize_img_path(struct XorrisO *xorriso, char *wd,
char path[SfileadrL], *apt, *npt, sfe[5*SfileadrL], *cpt;
eff_path[0]= 0;
if(img_path[0]==0)
if(img_path[0]==0) {
if(flag&8)
strcpy(eff_path, "/");
return(2); /* root directory */
}
if(!(flag&2)) {
ret= Xorriso_get_volume(xorriso, &volume, 0);
@ -1367,8 +1371,11 @@ int Xorriso_normalize_img_path(struct XorrisO *xorriso, char *wd,
img_path);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FATAL", 0);
return(-1);
} else if(path[1]==0)
} else if(path[1]==0) {
if(flag&8)
strcpy(eff_path, "/");
return(2); /* root directory */
}
for(npt= apt; !done; apt= npt+1) {
npt= strchr(apt, '/');
@ -4598,7 +4605,7 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job,
IsoDirIter *iter= NULL;
IsoDir *dir_node= NULL;
IsoNode *node, *iso_node;
IsoImage *volume;
IsoImage *volume= NULL;
struct stat stbuf;
char *name;
off_t mem;
@ -4634,7 +4641,6 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job,
if(ret<=0)
{ret= 0; goto ex;}
ret= Xorriso_fake_stbuf(xorriso, "", dir_stbuf, &iso_node, 1);
dir_node= (IsoDir *) iso_node;
if(ret<=0)
goto ex;
@ -4654,8 +4660,18 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job,
if(ret<=0)
goto ex;
if(ret==2) {
deleted= 1;
goto ex;
/* re-determine dir_node in case it has a new persona */
ret= Xorriso_node_from_path(xorriso, volume, path, &iso_node, 1);
if(ret==0) {
deleted= 1;
{ret= 2; goto ex;}
}
if(ret<0)
{ret= 0; goto ex;}
dir_node= (IsoDir *) iso_node;
ret= Xorriso_fake_stbuf(xorriso, "", dir_stbuf, &iso_node, 1);
if(ret<=0)
goto ex;
}
if(ret==3)
no_dive= 1;
@ -4666,7 +4682,7 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job,
mem= boss_mem;
hflag= 1;
if(action==1 || action==2 || action==3 || action==14)
if(action==1 || action==2 || action==3 || action==17)
hflag|= 2; /* need freedom to manipulate image */
if(action==14 || action==17)
hflag|= 4; /* need LBA sorted iteration for good data reading performance */
@ -4707,8 +4723,24 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job,
goto ex;
ret= Xorriso_findi_action(xorriso, job, iter, mem,
abs_path, path, node, depth, 1|(flag&2));
if(ret==2) /* node has been deleted */
if(ret==2) { /* node has been deleted */
/* re-determine node in case it has a new persona */
if(volume==NULL) {
ret= Xorriso_get_volume(xorriso, &volume, 0);
if(ret<=0)
{ret= -1; goto ex;}
}
ret= Xorriso_node_from_path(xorriso, volume, abs_path, &node, 1);
if(ret==0)
continue;
if(ret<0)
{ret= 0; goto ex;}
ret= Xorriso_fake_stbuf(xorriso, "", &stbuf, &node, 1);
if(ret<0)
goto ex;
if(ret==0)
continue;
}
no_dive= (ret==3);
if(ret<=0) {
if(Xorriso_eval_problem_status(xorriso, ret, 1|2)<0)