Removed old and new bugs

master
Thomas Schmitt 15 years ago
parent 2b48ad6f72
commit 90c129679a
  1. 117
      test/ng_xorrisoburn.c
  2. 95
      test/xorriso.c
  3. 2
      test/xorriso_timestamp.h
  4. 2
      test/xorrisoburn.c

@ -623,6 +623,31 @@ int Xorriso_get_volume(struct XorrisO *xorriso, IsoImage **volume,
}
/* @param flag bit0=do not complain about non existent node */
int Xorriso_node_from_path(struct XorrisO *xorriso, IsoImage *volume,
char *path, IsoNode **node, int flag)
{
int ret;
char sfe[5*SfileadrL], *path_pt;
path_pt= path;
if(path[0]==0)
path_pt= "/";
*node= NULL;
ret= iso_tree_path_to_node(volume, path_pt, node);
Xorriso_process_msg_queues(xorriso,0);
if(ret<=0) {
if(!(flag&1)) {
sprintf(xorriso->info_text, "Cannot find path %s in loaded ISO image",
Text_shellsafe(path_pt, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
}
return(0);
}
return(1);
}
/* @param eff_path returns resulting effective path.
Must provide at least SfileadrL bytes of storage.
@param flag bit0= do not produce problem events (unless faulty path format)
@ -696,11 +721,7 @@ bonked_root:;
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(-1);
}
/* >>> NG
dir= iso_tree_node_get_parent(node);
*/
dir= iso_node_get_parent(node);
}
/* truncate eff_path */;
cpt= strrchr(eff_path, '/');
@ -720,18 +741,11 @@ much_too_long:;
}
if(!(flag&2)) {
dir= (IsoDir *) node;
ret= iso_tree_path_to_node(volume, eff_path, &node);
if(ret<=0) {
sprintf(xorriso->info_text, "Cannot find in ISO image: %s",
Text_shellsafe(eff_path, sfe, 0));
if(!(flag&1))
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(0);
}
ret= Xorriso_node_from_path(xorriso, volume, eff_path, &node, flag&1);
if(ret<=0)
return(0);
if(dir==NULL) /* could be false with "/dir/.." */
/* >>> NG dir= iso_tree_node_get_parent(node) */ ;
dir= iso_node_get_parent(node);
is_dir= LIBISO_ISDIR(node);
}
}
@ -744,7 +758,7 @@ int Xorriso_get_node_by_path(struct XorrisO *xorriso,
IsoNode **node, int flag)
{
int ret;
char sfe[5*SfileadrL], path[SfileadrL];
char path[SfileadrL];
IsoImage *volume;
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, in_path, path, 0);
@ -755,13 +769,9 @@ int Xorriso_get_node_by_path(struct XorrisO *xorriso,
ret= Xorriso_get_volume(xorriso, &volume, 0);
if(ret<=0)
return(ret);
ret= iso_tree_path_to_node(volume,path,node);
if(ret<=0) {
sprintf(xorriso->info_text, "Not found in ISO image: %s",
Text_shellsafe(path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
ret= Xorriso_node_from_path(xorriso, volume, path, node, 0);
if(ret<=0)
return(0);
}
return(1);
}
@ -922,7 +932,7 @@ cannot_lstat:;
/* does a node exist with this name ? */
node= NULL;
ret= iso_tree_path_to_node(volume, img_path, &node);
ret= Xorriso_node_from_path(xorriso, volume, img_path, &node, 1);
if(ret>0) {
target_is_dir= LIBISO_ISDIR(node);
if(!(target_is_dir && source_is_dir)) {
@ -1125,10 +1135,8 @@ int Xorriso_graft_in(struct XorrisO *xorriso, char *disk_path, char *img_path,
continue;
}
source_is_dir= (is_dir || (flag&1) || !done);
ret= iso_tree_path_to_node(volume, path, &node);
if(ret<=0) {
node= NULL;
} else {
ret= Xorriso_node_from_path(xorriso, volume, path, &node, 0);
if(ret>0) {
target_is_dir= LIBISO_ISDIR(node);
if(!(target_is_dir && source_is_dir)) {
Xorriso_process_msg_queues(xorriso,0);
@ -1657,24 +1665,6 @@ int Xorriso_format_media(struct XorrisO *xorriso, int flag)
}
int Xorriso_node_from_path(struct XorrisO *xorriso, IsoImage *volume,
char *path, IsoNode **node, int flag)
{
int ret;
char sfe[5*SfileadrL];
ret= iso_tree_path_to_node(volume, path, node);
Xorriso_process_msg_queues(xorriso,0);
if(ret<=0) {
sprintf(xorriso->info_text, "Cannot find path %s in loaded ISO image",
Text_shellsafe(path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(0);
}
return(1);
}
/* @param boss_iter If not NULL then this is an iterator suitable for
iso_dir_iter_remove() which is then to be used instead
of iso_node_remove().
@ -1807,11 +1797,7 @@ dir_not_removed:;
if(xorriso->request_to_abort)
{ret= 3; goto ex;}
/* >>> NG
boss_node= iso_tree_node_get_parent(victim_node);
*/
boss_node= iso_node_get_parent(victim_node);
Xorriso_process_msg_queues(xorriso,0);
if(boss_node==NULL) {
sprintf(xorriso->info_text,
@ -2123,9 +2109,9 @@ int Xorriso_fake_stbuf(struct XorrisO *xorriso, char *path, struct stat *stbuf,
ret= Xorriso_get_volume(xorriso, &volume, 0);
if(ret<=0)
return(-1);
ret= iso_tree_path_to_node(volume, path, node);
ret= Xorriso_node_from_path(xorriso, volume, path, node, 1);
if(ret<=0)
node= NULL;
*node= NULL;
}
if(*node==NULL)
return(0);
@ -2266,12 +2252,12 @@ int Xorriso_ls_filev(struct XorrisO *xorriso, char *wd,
/* Count valid nodes, warn of invalid ones */
for(i= 0; i<filec; i++) {
ret= Xorriso_make_abs_adr(xorriso, wd, filev[i], path, 1|4);
ret= Xorriso_make_abs_adr(xorriso, wd, filev[i], path, 1|2|4);
if(ret<=0) {
was_error++;
continue;
}
ret= iso_tree_path_to_node(volume, path, &node);
ret= Xorriso_node_from_path(xorriso, volume, path, &node, 1);
if(ret<=0) {
sprintf(xorriso->info_text, "Not found in ISO image: %s",
Text_shellsafe(path, sfe, 0));
@ -2292,7 +2278,7 @@ int Xorriso_ls_filev(struct XorrisO *xorriso, char *wd,
for(pass= 0; pass<passes; pass++)
for(i= 0; i<filec && !(xorriso->request_to_abort); i++) {
rpt[0]= 0;
ret= Xorriso_make_abs_adr(xorriso, wd, filev[i], path, 1|4);
ret= Xorriso_make_abs_adr(xorriso, wd, filev[i], path, 1|2|4);
if(ret<=0)
continue;
ret= Xorriso_fake_stbuf(xorriso, path, &stbuf, &node, 0);
@ -2571,20 +2557,14 @@ int Xorriso_rename(struct XorrisO *xorriso, char *origin, char *dest, int flag)
ret= Xorriso_get_volume(xorriso, &volume, 0);
if(ret<=0)
return(ret);
ret= iso_tree_path_to_node(volume, dir_adr, (IsoNode **) &dest_dir);
if(ret<=0)
dest_dir= NULL;
Xorriso_node_from_path(xorriso, volume, dir_adr, (IsoNode **) &dest_dir, 0);
strcpy(dir_adr, eff_origin);
cpt= strrchr(dir_adr, '/');
if(cpt==NULL)
cpt= dir_adr+strlen(dir_adr);
*cpt= 0;
ret= iso_tree_path_to_node(volume, dir_adr, (IsoNode **) &origin_dir);
if(ret<=0)
origin_dir= NULL;
ret= iso_tree_path_to_node(volume, eff_origin, &node);
if(ret<=0)
node= NULL;
Xorriso_node_from_path(xorriso, volume, dir_adr, (IsoNode **) &origin_dir, 0);
Xorriso_node_from_path(xorriso, volume, eff_origin, &node, 0);
if(dest_dir==NULL || origin_dir==NULL || node==NULL) {
Xorriso_process_msg_queues(xorriso,0);
sprintf(xorriso->info_text,
@ -2790,8 +2770,9 @@ int Xorriso_expand_pattern(struct XorrisO *xorriso,
It is not an error if xorriso->wdi does not exist yet, but one may
not use it as base for relative address searches.
*/
ret= iso_tree_path_to_node(volume, xorriso->wdi, (IsoNode **) &dir);
if(ret<0) {
ret= Xorriso_node_from_path(xorriso, volume,
xorriso->wdi, (IsoNode **) &dir, 1);
if(ret<=0) {
Xorriso_process_msg_queues(xorriso,0);
sprintf(xorriso->info_text,
"While expanding pattern %s : Working directory does not exist in ISO image",
@ -3033,7 +3014,7 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job,
ret= Xorriso_make_abs_adr(xorriso, xorriso->wdi, dir_path, path, 1|2|4);
if(ret<=0)
goto ex;
ret= iso_tree_path_to_node(volume, path, (IsoNode **) &dir_node);
ret= Xorriso_node_from_path(xorriso, volume, path,(IsoNode **) &dir_node,0);
if(ret<=0)
{ret= 0; goto ex;}
ret= Xorriso_fake_stbuf(xorriso, "", dir_stbuf,

@ -3534,7 +3534,7 @@ no_regex_available:;
if(adr_part[0]==0)
goto next_adr_part;
if(adr_part[0]=='.' && adr_part[1]==0)
if(adr_part[0]=='.' && adr_part[1]==0 && count>1)
goto next_adr_part;
if(adr_part[0]=='.' && adr_part[1]=='.' && adr_part[2]==0) {
/* delete previous part */
@ -4681,7 +4681,7 @@ int Xorriso_end_idx(struct XorrisO *xorriso,
bit6= with bit allow 0 matches if pattern is a constant
bit8= free the eventually allocated sub_vector
*/
int Xorriso_opt_args(struct XorrisO *xorriso,
int Xorriso_opt_args(struct XorrisO *xorriso, char *cmd,
int argc, char **argv, int idx,
int *end_idx, int *optc, char ***optv, int flag)
{
@ -4702,7 +4702,9 @@ int Xorriso_opt_args(struct XorrisO *xorriso,
*end_idx= argc;
*optc= 0;
*optv= NULL;
return(-1);
sprintf(xorriso->info_text, "%s : Not enough arguments given", cmd);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(0);
}
*end_idx= Xorriso_end_idx(xorriso, argc, argv, idx, (flag&1) || do_expand);
if(*end_idx<0)
@ -4717,7 +4719,7 @@ int Xorriso_opt_args(struct XorrisO *xorriso,
if(patterns==NULL) {
no_memory:;
sprintf(xorriso->info_text,
"Cannot allocate enough memory for pattern expansion");
"%s : Cannot allocate enough memory for pattern expansion", cmd);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0);
{ret= -1; goto ex;}
}
@ -4916,6 +4918,8 @@ int Xorriso_eval_problem_status(struct XorrisO *xorriso, int ret, int flag)
ret= -1;
} else if(ret>0)
ret= 1;
else
ret= 2;
return(ret);
}
@ -5625,7 +5629,7 @@ int Xorriso_lsx_filev(struct XorrisO *xorriso, char *wd,
/* Count valid nodes, warn of invalid ones */
for(i= 0; i<filec; i++) {
ret= Xorriso_make_abs_adr(xorriso, wd, filev[i], path, 1|4);
ret= Xorriso_make_abs_adr(xorriso, wd, filev[i], path, 1|2|4);
if(ret<=0) {
was_error++;
continue;
@ -5650,7 +5654,7 @@ int Xorriso_lsx_filev(struct XorrisO *xorriso, char *wd,
passes= 1+!(flag&(4|8));
for(pass= 0; pass<passes; pass++)
for(i= 0; i<filec && !(xorriso->request_to_abort); i++) {
ret= Xorriso_make_abs_adr(xorriso, wd, filev[i], path, 1|4);
ret= Xorriso_make_abs_adr(xorriso, wd, filev[i], path, 1|2|4);
if(ret<=0)
continue;
ret= lstat(path, &stbuf);
@ -5893,12 +5897,13 @@ int Xorriso_cpmv_args(struct XorrisO *xorriso, char *cmd,
{ret= 0; goto ex;}
}
ret= Xorriso_opt_args(xorriso, argc, argv, *idx, &end_idx, optc, optv,
ret= Xorriso_opt_args(xorriso, cmd, argc, argv, *idx, &end_idx, optc, optv,
(flag&2)|16); /* ignore last argument */
if(ret<=0)
goto ex;
ret= Xorriso_opt_args(xorriso, argc, argv, end_idx, &end_idx, &destc, &destv,
32|64); /* demand one match, or 0 with a constant */
/* demand one match, or 0 with a constant */
ret= Xorriso_opt_args(xorriso, cmd, argc, argv, end_idx, &end_idx, &destc,
&destv, 32|64);
if(ret<=0)
goto ex;
@ -5923,7 +5928,8 @@ int Xorriso_cpmv_args(struct XorrisO *xorriso, char *cmd,
ret= 1+is_dir;
ex:;
Xorriso_opt_args(xorriso, argc, argv, *idx, &end_idx, &destc, &destv, 256);
Xorriso_opt_args(xorriso, cmd, argc, argv, *idx, &end_idx, &destc, &destv,
256);
(*idx)= end_idx;
return(ret);
}
@ -5962,8 +5968,8 @@ int Xorriso_option_add(struct XorrisO *xorriso, int argc, char **argv,
char target[SfileadrL], source[SfileadrL], *ept, eff_path[SfileadrL];
char **optv= NULL, *rpt, *wpt;
ret= Xorriso_opt_args(xorriso, argc, argv, *idx, &end_idx, &optc, &optv,
((!!xorriso->allow_graft_points)<<2)|2);
ret= Xorriso_opt_args(xorriso, "-add", argc, argv, *idx, &end_idx,
&optc, &optv, ((!!xorriso->allow_graft_points)<<2)|2);
if(ret<=0)
goto ex;
@ -6033,7 +6039,8 @@ problem_handler:;
ret= 1;
ex:;
(*idx)= end_idx;
Xorriso_opt_args(xorriso, argc, argv, *idx, &end_idx, &optc, &optv, 256);
Xorriso_opt_args(xorriso, "-add", argc, argv, *idx, &end_idx, &optc, &optv,
256);
if(ret<=0)
return(ret);
return(!was_failure);
@ -6054,13 +6061,14 @@ int Xorriso_option_alter_date(struct XorrisO *xorriso,
struct FindjoB *job= NULL;
struct stat dir_stbuf;
ret= Xorriso_opt_args(xorriso, "-alter_date", argc, argv, *idx, &end_idx,
&optc, &optv, 0);
if(ret<=0)
goto ex;
ret= Xorriso_convert_datestring(xorriso, "-alter_date", time_type, timestring,
&t_type, &t, 0);
if(ret<=0)
goto ex;
ret= Xorriso_opt_args(xorriso, argc, argv, *idx, &end_idx, &optc, &optv, 0);
if(ret<=0)
goto ex;
for(i= 0; i<optc; i++) {
if(flag&1) {
ret= Findjob_new(&job, optv[i], 0);
@ -6084,7 +6092,8 @@ int Xorriso_option_alter_date(struct XorrisO *xorriso,
ret= 1;
ex:;
(*idx)= end_idx;
Xorriso_opt_args(xorriso, argc, argv, *idx, &end_idx, &optc, &optv, 256);
Xorriso_opt_args(xorriso, "-alter_date", argc, argv, *idx, &end_idx, &optc,
&optv, 256);
Findjob_destroy(&job, 0);
if(ret<=0)
return(ret);
@ -6293,10 +6302,11 @@ int Xorriso_option_chgrpi(struct XorrisO *xorriso, char *gid,
struct FindjoB *job= NULL;
struct stat dir_stbuf;
ret= Xorriso_convert_gidstring(xorriso, gid, &gid_number, 0);
ret= Xorriso_opt_args(xorriso, "-chgrpi", argc, argv, *idx, &end_idx, &optc,
&optv, 0);
if(ret<=0)
goto ex;
ret= Xorriso_opt_args(xorriso, argc, argv, *idx, &end_idx, &optc, &optv, 0);
ret= Xorriso_convert_gidstring(xorriso, gid, &gid_number, 0);
if(ret<=0)
goto ex;
for(i= 0; i<optc; i++) {
@ -6322,7 +6332,8 @@ int Xorriso_option_chgrpi(struct XorrisO *xorriso, char *gid,
ret= 1;
ex:;
(*idx)= end_idx;
Xorriso_opt_args(xorriso, argc, argv, *idx, &end_idx, &optc, &optv, 256); /* clean up */
Xorriso_opt_args(xorriso, "-chgrpi", argc, argv, *idx, &end_idx, &optc, &optv,
256); /* clean up */
if(ret<=0)
return(ret);
Findjob_destroy(&job, 0);
@ -6343,13 +6354,14 @@ int Xorriso_option_chmodi(struct XorrisO *xorriso, char *mode,
struct FindjoB *job= NULL;
struct stat dir_stbuf;
ret= Xorriso_opt_args(xorriso, "-chmodi", argc, argv, *idx, &end_idx, &optc,
&optv, 0);
if(ret<=0)
goto ex;
ret= Xorriso_convert_modstring(xorriso, "-chmodi",
mode, &mode_and, &mode_or, 0);
if(ret<=0)
goto ex;
ret= Xorriso_opt_args(xorriso, argc, argv, *idx, &end_idx, &optc, &optv, 0);
if(ret<=0)
goto ex;
for(i= 0; i<optc; i++) {
if(flag&1) {
ret= Findjob_new(&job, optv[i], 0);
@ -6374,7 +6386,8 @@ int Xorriso_option_chmodi(struct XorrisO *xorriso, char *mode,
ret= 1;
ex:;
(*idx)= end_idx;
Xorriso_opt_args(xorriso, argc, argv, *idx, &end_idx, &optc, &optv, 256);
Xorriso_opt_args(xorriso, "-chmodi", argc, argv, *idx, &end_idx, &optc, &optv,
256);
Findjob_destroy(&job, 0);
if(ret<=0)
return(ret);
@ -6395,12 +6408,13 @@ int Xorriso_option_chowni(struct XorrisO *xorriso, char *uid,
struct FindjoB *job= NULL;
struct stat dir_stbuf;
ret= Xorriso_opt_args(xorriso, "-chowni", argc, argv, *idx, &end_idx,
&optc, &optv, 0);
if(ret<=0)
goto ex;
ret= Xorriso_convert_uidstring(xorriso, uid, &uid_number, 0);
if(ret<=0)
goto ex;
ret= Xorriso_opt_args(xorriso, argc, argv, *idx, &end_idx, &optc, &optv, 0);
if(ret<=0)
goto ex;
for(i= 0; i<optc; i++) {
if(flag&1) {
ret= Findjob_new(&job, optv[i], 0);
@ -6424,7 +6438,8 @@ int Xorriso_option_chowni(struct XorrisO *xorriso, char *uid,
ret= 1;
ex:;
(*idx)= end_idx;
Xorriso_opt_args(xorriso, argc, argv, *idx, &end_idx, &optc, &optv, 256);
Xorriso_opt_args(xorriso, "-chowni", argc, argv, *idx, &end_idx,
&optc, &optv, 256);
Findjob_destroy(&job, 0);
if(ret<=0)
return(ret);
@ -7329,7 +7344,10 @@ no_memory:;
{ret= -1; goto ex;}
}
nump= 1;
patterns[0]= "*";
if(flag&8)
patterns[0]= ".";
else
patterns[0]= "*";
flag&= ~2;
} else {
patterns= calloc(nump, sizeof(char *));
@ -7399,7 +7417,10 @@ no_memory:;
{ret= -1; goto ex;}
}
nump= 1;
patterns[0]= "*";
if(flag&8)
patterns[0]= ".";
else
patterns[0]= "*";
flag&= ~2;
} else {
patterns= calloc(nump, sizeof(char *));
@ -7414,7 +7435,7 @@ no_memory:;
}
if(flag&2) {
ret= Xorriso_lsx_filev(xorriso, xorriso->wdx,
nump, argv + (*idx), mem, flag&(1|4));
nump, argv + (*idx), mem, flag&(1|4|8));
#ifdef Not_yeT
} else if(nump==1 && strcmp(patterns[0],"*")==0 && !(flag&4)){
@ -7427,7 +7448,8 @@ no_memory:;
&mem, 0);
if(ret<=0)
{ret= 0; goto ex;}
ret= Xorriso_lsx_filev(xorriso, xorriso->wdx, filec, filev, mem,flag&(1|4));
ret= Xorriso_lsx_filev(xorriso, xorriso->wdx, filec, filev, mem,
flag&(1|4|8));
}
if(ret<=0)
{ret= 0; goto ex;}
@ -7572,7 +7594,8 @@ problem_handler:;
}
ret= !was_failure;
ex:;
Xorriso_opt_args(xorriso, argc, argv, *idx, &end_idx, &optc, &optv, 256);
Xorriso_opt_args(xorriso, "-mvi",
argc, argv, *idx, &end_idx, &optc, &optv, 256);
(*idx)= end_idx;
return(ret);
}
@ -7940,7 +7963,8 @@ int Xorriso_option_rmi(struct XorrisO *xorriso, int argc, char **argv,
int optc= 0;
char **optv= NULL;
ret= Xorriso_opt_args(xorriso, argc, argv, *idx, &end_idx, &optc, &optv, 0);
ret= Xorriso_opt_args(xorriso, "-rm*i",
argc, argv, *idx, &end_idx, &optc, &optv, 0);
if(ret<=0)
goto ex;
for(i= 0; i<optc; i++) {
@ -7976,7 +8000,8 @@ problem_handler:;
ret= 1;
ex:;
(*idx)= end_idx;
Xorriso_opt_args(xorriso, argc, argv, *idx, &end_idx, &optc, &optv, 256);
Xorriso_opt_args(xorriso, "-rm*i",
argc, argv, *idx, &end_idx, &optc, &optv, 256);
if(ret<=0)
return(ret);
return(!was_failure);

@ -1 +1 @@
#define Xorriso_timestamP "2008.01.11.133319"
#define Xorriso_timestamP "2008.01.11.133631"

@ -2164,7 +2164,7 @@ int Xorriso_ls_filev(struct XorrisO *xorriso, char *wd,
/* Count valid nodes, warn of invalid ones */
for(i= 0; i<filec; i++) {
ret= Xorriso_make_abs_adr(xorriso, wd, filev[i], path, 1|4);
ret= Xorriso_make_abs_adr(xorriso, wd, filev[i], path, 1|2|4);
if(ret<=0) {
was_error++;
continue;

Loading…
Cancel
Save