diff --git a/libisoburn/trunk/xorriso/xorriso.c b/libisoburn/trunk/xorriso/xorriso.c index 7b84e41a..53ef267a 100644 --- a/libisoburn/trunk/xorriso/xorriso.c +++ b/libisoburn/trunk/xorriso/xorriso.c @@ -1975,7 +1975,7 @@ int Lstring_append_binary(struct LstrinG **entry, char *data, int data_len, for(target= *entry; target->next!=NULL; target= target->next); if(Lstring_new_binary(&newby, data, data_len, target, 0)<=0) return(-1); - if(*entry!=NULL) + if(*entry==NULL) *entry= newby; return(1); } @@ -2696,7 +2696,7 @@ int Exclusions_match(struct ExclusionS *o, char *abs_path, int flag) /* determine leafname */ was_non_slash= 0; - for(leaf_pt= abs_path+strlen(abs_path); leaf_pt>leaf; leaf_pt--) { + for(leaf_pt= abs_path+strlen(abs_path); leaf_pt>abs_path; leaf_pt--) { if(*leaf_pt=='/') { if(was_non_slash) { leaf_pt++; @@ -2818,6 +2818,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag) m->do_disk_pattern= 2; m->temp_mem_limit= 16*1024*1024; m->disk_exclusions= NULL; + m->disk_excl_mode= 1; m->use_stdin= 0; m->result_page_length= 0; m->result_page_width= 80; @@ -3960,6 +3961,14 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag) } } + is_default= (xorriso->disk_excl_mode==1); + sprintf(line, "-not_mgt %s:%s:%s\n", + (xorriso->disk_excl_mode&1 ? "on" : "off"), + (xorriso->disk_excl_mode&2 ? "param_on" : "param_off"), + (xorriso->disk_excl_mode&4 ? "subtree_on" : "subtree_off")); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + is_default= (xorriso->do_iso_rr_pattern==1); sprintf(line,"-iso_rr_pattern %s\n", (xorriso->do_iso_rr_pattern == 1 ? "on" : @@ -4655,7 +4664,7 @@ int Xorriso_find_compare(struct XorrisO *xorriso, void *boss_iter, return(ret); /* compare exclusions against disk_path resp. leaf name */ - ret= Xorriso_path_is_excluded(xorriso, disk_path, 0); + ret= Xorriso_path_is_excluded(xorriso, disk_path, !(flag&2)); if(ret<0) return(ret); if(ret>0) @@ -5431,7 +5440,7 @@ int Xorriso_eval_problem_status(struct XorrisO *xorriso, int ret, int flag) ret= 2; } else if(xorriso->problem_status > 0) { sprintf(xorriso->info_text, - "xorriso : aborting : -abort_on '%s' encountered '%s'", + "xorriso : aborting : -abort_on '%s' encountered '%s'\n", xorriso->abort_on_text, xorriso->problem_status_text); if(!(flag&1)) Xorriso_info(xorriso, 0);/* submit not as problem event */ @@ -6386,7 +6395,7 @@ int Xorriso_findx(struct XorrisO *xorriso, struct FindjoB *job, if(ret<=0) goto ex; abs_dir_path= abs_dir_path_data; - ret= Xorriso_path_is_excluded(xorriso, abs_dir_path, 0); + ret= Xorriso_path_is_excluded(xorriso, abs_dir_path, !(flag&1)); if(ret<0) goto ex; if(ret>0) @@ -6450,7 +6459,7 @@ int Xorriso_findx(struct XorrisO *xorriso, struct FindjoB *job, ret= Xorriso_make_abs_adr(xorriso, dir_path, name, path, 4); if(ret<=0) goto ex; - ret= Xorriso_path_is_excluded(xorriso, abs_path, 0); + ret= Xorriso_path_is_excluded(xorriso, abs_path, 0); /* (is never param) */ if(ret<0) goto ex; if(ret>0) @@ -7254,7 +7263,8 @@ 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 has been deleted , + 3= no action taken */ int Xorriso_update_interpreter(struct XorrisO *xorriso, void *boss_iter, int compare_result, char *disk_path, @@ -7269,9 +7279,17 @@ int Xorriso_update_interpreter(struct XorrisO *xorriso, void *boss_iter, int partno, total_parts, new_total_parts; off_t offset, bytes, total_bytes, disk_size, first_bytes; + if((compare_result&3)==3) { + sprintf(xorriso->info_text, "Missing on disk and in ISO: disk_path %s", + Text_shellsafe(disk_path, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 1); + xorriso->find_compare_result= -1; + ret= 3; goto ex; + } + if(compare_result&((1<<11)|(1<<13))) { /* cannot open regular disk file, early eof of disk file */ - sprintf(xorriso->info_text, "Problems with reading disk file %s\n", + sprintf(xorriso->info_text, "Problems with reading disk file %s", Text_shellsafe(disk_path, sfe, 0)); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 1); xorriso->find_compare_result= -1; @@ -7406,7 +7424,7 @@ ex:; return(ret); if(deleted) return(2); - return(1); + return(ret); } @@ -7441,16 +7459,28 @@ int Xorriso_write_session_log(struct XorrisO *xorriso, int flag) } +/* @param flag bit0= path is a command parameter +*/ int Xorriso_path_is_excluded(struct XorrisO *xorriso, char *path, int flag) { int ret; + char sfe[5*SfileadrL]; + if(!(xorriso->disk_excl_mode&1)) /* exclusion is off */ + return(0); + if((flag&1) && !(xorriso->disk_excl_mode&2)) /* params are exempted */ + return(0); ret= Exclusions_match(xorriso->disk_exclusions, path, 0); if(ret<0) { sprintf(xorriso->info_text, "Error during disk file exclusion decision"); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); } + if(ret>0 && (flag&1)) { + sprintf(xorriso->info_text, "Disk path parameter excluded by %s : %s", + (ret==1 ? "-not_paths" : "-not_leaf"), Text_shellsafe(path, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + } return(ret); } @@ -8173,6 +8203,9 @@ int Xorriso_option_compare(struct XorrisO *xorriso, char *disk_path, if(ipth[0]==0) ipth= disk_path; + ret= Xorriso_path_is_excluded(xorriso, disk_path, 1); + if(ret!=0) + goto report_outcome; if(!(flag&2)) { Xorriso_pacifier_reset(xorriso, 0); mem_lut= xorriso->last_update_time; @@ -8214,13 +8247,14 @@ int Xorriso_option_compare(struct XorrisO *xorriso, char *disk_path, } else { follow_links= (xorriso->do_follow_links || xorriso->do_follow_param) << 28; ret= Xorriso_compare_2_files(xorriso, disk_path, ipth, "", &result, - 2 | follow_links | ((flag&4)<<27) | (1<<30)); + 2 | follow_links | ((flag&4)<<27) | (1<<30)); } xorriso->pacifier_interval= mem_pci; if(mem_lut!=xorriso->last_update_time && !(flag&2)) Xorriso_pacifier_callback(xorriso, "content bytes read", xorriso->pacifier_count, 0, "", 1); +report_outcome:; if(ret>0) { sprintf(xorriso->result_line, "Both file objects match as far as expectable.\n"); @@ -9668,7 +9702,7 @@ int Xorriso_option_not_leaf(struct XorrisO *xorriso, char *pattern, int flag) Xorriso__bourne_to_reg(pattern, regexpr, 0); if(regcomp(&re, regexpr, 0)!=0) - goto cannot_add; + {ret= 0; goto cannot_add;} ret= Exclusions_add_not_leafs(xorriso->disk_exclusions, pattern, &re, 0); if(ret<=0) { cannot_add:; @@ -9681,6 +9715,57 @@ cannot_add:; } +/* Option -not_mgt */ +int Xorriso_option_not_mgt(struct XorrisO *xorriso, char *setting, int flag) +{ + int ret; + char what_data[SfileadrL], *what, *what_next; + + if(Sfile_str(what_data, setting, 0)<=0) { + sprintf(xorriso->info_text, + "-not_mgt: setting string is much too long (%d)", + (int) strlen(setting)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + for(what= what_data; what!=NULL; what= what_next) { + what_next= strchr(what, ':'); + if(what_next!=NULL) { + *what_next= 0; + what_next++; + } + + if(strcmp(what, "reset")==0 || strcmp(what, "erase")==0) { + if(strcmp(what, "reset")==0) + xorriso->disk_excl_mode= 1; + Exclusions_destroy(&(xorriso->disk_exclusions), 0); + ret= Exclusions_new(&(xorriso->disk_exclusions), 0); + if(ret<=0) { + Xorriso_no_malloc_memory(xorriso, NULL, 0); + return(ret); + } + } else if(strcmp(what, "on")==0) { + xorriso->disk_excl_mode|= 1; + } else if(strcmp(what, "off")==0) { + xorriso->disk_excl_mode&= ~1; + } else if(strcmp(what, "param_on")==0) { + xorriso->disk_excl_mode|= 2; + } else if(strcmp(what, "param_off")==0) { + xorriso->disk_excl_mode&= ~2; + } else if(strcmp(what, "subtree_on")==0) { + xorriso->disk_excl_mode|= 4; + } else if(strcmp(what, "subtree_off")==0) { + xorriso->disk_excl_mode&= ~4; + } else { + sprintf(xorriso->info_text, "-not_mgt: unknown setting '%s'", what); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + } + return(1); +} + + /* Option -not_paths */ int Xorriso_option_not_paths(struct XorrisO *xorriso, int argc, char **argv, int *idx, int flag) @@ -10170,17 +10255,6 @@ int Xorriso_option_return_with(struct XorrisO *xorriso, char *severity, } -/* Option -revoke_exclusions */ -int Xorriso_option_revoke_exclusions(struct XorrisO *xorriso, int flag) -{ - int ret; - - Exclusions_destroy(&(xorriso->disk_exclusions), 0); - ret= Exclusions_new(&(xorriso->disk_exclusions), 0); - return(ret); -} - - /* Options -rm alias -rmi , -rm_r alias -rm_ri , -rmdir alias -rmdiri */ /* @param flag bit0=recursive , bit1= remove empty directory: rmdir */ int Xorriso_option_rmi(struct XorrisO *xorriso, int argc, char **argv, @@ -10474,6 +10548,7 @@ int Xorriso_option_update(struct XorrisO *xorriso, char *disk_path, char *iso_path, int flag) { int ret, mem_pci, zero= 0, result, uret, follow_links; + int not_in_iso= 0, not_on_disk= 0; double mem_lut= 0.0, start_time; char *ipth, *argv[6], sfe[5*SfileadrL]; struct stat stbuf; @@ -10498,6 +10573,9 @@ int Xorriso_option_update(struct XorrisO *xorriso, char *disk_path, Text_shellsafe(ipth, sfe, 0)); Xorriso_info(xorriso,0); } + ret= Xorriso_path_is_excluded(xorriso, disk_path, 1); + if(ret!=0) + goto report_outcome; if(flag&8) { xorriso->find_compare_result= 1; ret= Xorriso_iso_lstat(xorriso, ipth, &stbuf, 0); @@ -10508,8 +10586,10 @@ int Xorriso_option_update(struct XorrisO *xorriso, char *disk_path, argv[3]= disk_path; zero= 0; ret= Xorriso_option_find(xorriso, 4, argv, &zero, 2); /* -findi */ - } else + } else { + not_in_iso= 1; ret= 1; + } if(ret>0) { ret= lstat(disk_path, &stbuf); if(ret != -1) { @@ -10533,10 +10613,18 @@ int Xorriso_option_update(struct XorrisO *xorriso, char *disk_path, ret= xorriso->find_compare_result; else ret= -1; - } else + } else { ret= xorriso->find_compare_result; + not_on_disk= 1; + } } else ret= -1; + if(not_on_disk && not_in_iso) { + sprintf(xorriso->info_text, "Missing on disk and in ISO: disk_path %s", + Text_shellsafe(disk_path, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 1); + ret= -1; + } } else { /* compare ctime too, no filename reporting, eventually silent */ follow_links= (xorriso->do_follow_links || xorriso->do_follow_param) <<28; @@ -10547,12 +10635,15 @@ int Xorriso_option_update(struct XorrisO *xorriso, char *disk_path, 0); if(uret<=0) ret= -1; + if(uret==3) + ret= -1; } } xorriso->pacifier_interval= mem_pci; if(mem_lut!=xorriso->last_update_time && !(flag&2)) Xorriso_pacifier_callback(xorriso, "content bytes read", xorriso->pacifier_count, 0, "", 1); +report_outcome:; if(ret>0) { sprintf(xorriso->info_text, "No file object needed update."); @@ -10919,6 +11010,14 @@ next_command:; } else if(strcmp(cmd,"no_rc")==0) { ret= Xorriso_option_no_rc(xorriso, 0); + } else if(strcmp(cmd,"not_leaf")==0) { + (*idx)++; + ret= Xorriso_option_not_leaf(xorriso, arg1, 0); + + } else if(strcmp(cmd,"not_mgt")==0) { + (*idx)++; + ret= Xorriso_option_not_mgt(xorriso, arg1, 0); + } else if(strcmp(cmd,"not_paths")==0) { ret= Xorriso_option_not_paths(xorriso, argc, argv, idx, 0); @@ -10994,9 +11093,6 @@ next_command:; (*idx)++; ret= Xorriso_option_reassure(xorriso, arg1, 0); - } else if(strcmp(cmd,"revoke_exclusions")==0) { - ret= Xorriso_option_revoke_exclusions(xorriso, 0); - } else if(strcmp(cmd,"report_about")==0) { (*idx)++; ret= Xorriso_option_report_about(xorriso, arg1, 0); diff --git a/libisoburn/trunk/xorriso/xorriso_private.h b/libisoburn/trunk/xorriso/xorriso_private.h index 4be95496..f6f04f3f 100644 --- a/libisoburn/trunk/xorriso/xorriso_private.h +++ b/libisoburn/trunk/xorriso/xorriso_private.h @@ -167,6 +167,10 @@ struct XorrisO { /* the global context of xorriso */ int temp_mem_limit; struct ExclusionS *disk_exclusions; + int disk_excl_mode; /* bit0= on (else off) + bit1= parameter too (else rekursion only) + >>> bit2= whole subtree banned (else only exact path) + */ int use_stdin; /* use raw stdin even if readline support is compiled */ int result_page_length; diff --git a/libisoburn/trunk/xorriso/xorriso_timestamp.h b/libisoburn/trunk/xorriso/xorriso_timestamp.h index 267af300..8b12c624 100644 --- a/libisoburn/trunk/xorriso/xorriso_timestamp.h +++ b/libisoburn/trunk/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2008.05.02.204942" +#define Xorriso_timestamP "2008.05.03.151106" diff --git a/libisoburn/trunk/xorriso/xorrisoburn.c b/libisoburn/trunk/xorriso/xorrisoburn.c index ef172fcf..8a5212f9 100644 --- a/libisoburn/trunk/xorriso/xorrisoburn.c +++ b/libisoburn/trunk/xorriso/xorrisoburn.c @@ -1639,7 +1639,7 @@ cannot_open_dir:; } /* compare exclusions against disk_path resp. name */ - ret= Xorriso_path_is_excluded(xorriso, disk_path, 0); + ret= Xorriso_path_is_excluded(xorriso, disk_path, 0); /* (is never param) */ if(ret<0) {ret= -1; goto ex;} if(ret>0) @@ -1888,9 +1888,11 @@ int Xorriso_copy_properties(struct XorrisO *xorriso, Set to NULL if calling this function from outside ISO world @param flag bit0= mkdir: graft in as empty directory, not as copy from disk bit1= do not report added files - bit2= -follow: this is not a command parameter + bit2= -follow, -not_*: this is not a command parameter bit3= use offset and cut_size for cut_out_node - @return <=0 = error , 1 = added simple node , 2 = added directory + bit4= return 3 on rejection by exclusion or user + @return <=0 = error , 1 = added simple node , 2 = added directory , + 3 = rejected */ int Xorriso_graft_in(struct XorrisO *xorriso, void *boss_iter, char *disk_path, char *img_path, @@ -1905,12 +1907,11 @@ int Xorriso_graft_in(struct XorrisO *xorriso, void *boss_iter, int target_is_split; struct stat stbuf; - - /* compare exclusions against disk_path resp. name */ - /* >>> ??? why not !(flag&4) ? : "but no leaf patter if flag&4 */; - ret= Xorriso_path_is_excluded(xorriso, disk_path, 0); - if(ret!=0) + ret= Xorriso_path_is_excluded(xorriso, disk_path, !(flag&4)); + if(ret<0) return(ret); + if(ret>0) + return(3*!!(flag&16)); for(cpt= img_path; 1; cpt++) { cpt= strstr(cpt,"/."); @@ -2026,7 +2027,7 @@ int Xorriso_graft_in(struct XorrisO *xorriso, void *boss_iter, sprintf(xorriso->info_text, "User revoked adding of: %s", Text_shellsafe(disk_path, sfe, 0)); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); - return(0); + return(3*!!(flag&16)); } node= NULL; goto handle_path_node;