Producing ERRFILE messages where appropriate

This commit is contained in:
Thomas Schmitt 2008-02-22 11:49:57 +00:00
parent 1f01e954d4
commit 5fe8ac9f7f
4 changed files with 76 additions and 18 deletions

View File

@ -833,6 +833,9 @@ int isoburn_report_iso_error(int iso_error_code, char msg_text[], int os_errno,
if(iso_sev==LIBDAX_MSGS_SEV_MISHAP) {
iso_sev= LIBDAX_MSGS_SEV_SORRY;
error_code= 0x0005ff73;
} else if(iso_sev==LIBDAX_MSGS_SEV_ERRFILE) { /* same with ERRFILE */
iso_sev= LIBDAX_MSGS_SEV_DEBUG;
error_code= 0x00051001;
}
if(min_sev < iso_sev) {

View File

@ -3650,6 +3650,7 @@ int Xorriso_resolve_link(struct XorrisO *xorriso,
l= readlink(lpt, buf, SfileadrL-1);
if(l==-1) {
handle_error:;
Xorriso_msgs_submit(xorriso, 0, link_path, 0, "ERRFILE", 0);
sprintf(xorriso->info_text, "Cannot obtain link target of : %s",
Text_shellsafe(link_path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",0);
@ -3664,6 +3665,7 @@ handle_abort:;
}
buf[l]= 0;
if(l==0) {
Xorriso_msgs_submit(xorriso, 0, link_path, 0, "ERRFILE", 0);
sprintf(xorriso->info_text, "Empty link target with : %s",
Text_shellsafe(link_path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",0);
@ -3702,6 +3704,7 @@ handle_abort:;
link_count++;
if(link_count>link_limit) {
too_many_hops:;
Xorriso_msgs_submit(xorriso, 0, link_path, 0, "ERRFILE", 0);
sprintf(xorriso->info_text, "Too many link hops with : %s",
Text_shellsafe(link_path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, show_errno,
@ -4621,6 +4624,7 @@ int Xorriso_expand_disk_pattern(struct XorrisO *xorriso,
strcpy(dir_adr, "/");
ret= Sfile_type(dir_adr, 1|4);
if(ret!=2) {
Xorriso_msgs_submit(xorriso, 0, dir_adr, 0, "ERRFILE", 0);
sprintf(xorriso->info_text,
"Address set by -cdx is not a directory: %s",
Text_shellsafe(dir_adr, sfe, 0));
@ -5975,7 +5979,7 @@ int Xorriso_cpmv_args(struct XorrisO *xorriso, char *cmd,
int *optc, char ***optv, char eff_dest[SfileadrL],
int flag)
{
int destc= 0, is_dir=0, end_idx, ret;
int destc= 0, is_dir=0, end_idx, ret, i;
char **destv= NULL;
char sfe[5*SfileadrL];
@ -6004,6 +6008,8 @@ int Xorriso_cpmv_args(struct XorrisO *xorriso, char *cmd,
if(ret==2 || ((flag&1) && *optc > 1 && ret==0)) {
is_dir= 1;
} else if(*optc > 1) {
for(i= 0; i<*optc; i++)
Xorriso_msgs_submit(xorriso, 0, (*optv)[i], 0, "ERRFILE", 0);
sprintf(xorriso->info_text,
"%s: more than one origin given, destination is a non-directory: %s",
cmd, Text_shellsafe(destv[0], sfe, 0));
@ -7186,12 +7192,14 @@ int Xorriso_option_cdx(struct XorrisO *xorriso, char *disk_path, int flag)
if(eff_path[0]) {
ret= Sfile_type(eff_path,1|4|8);
if(ret<0) {
Xorriso_msgs_submit(xorriso, 0, eff_path, 0, "ERRFILE", 0);
sprintf(xorriso->info_text,"-cdx: file not found : %s",
Text_shellsafe(eff_path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
}
if(ret!=2) {
Xorriso_msgs_submit(xorriso, 0, eff_path, 0, "ERRFILE", 0);
sprintf(xorriso->info_text,
"-cdx: not a directory : %s",
Text_shellsafe(eff_path, sfe, 0));
@ -8805,6 +8813,7 @@ int Xorriso_option_page(struct XorrisO *xorriso, int len, int width, int flag)
int Xorriso_option_path_list(struct XorrisO *xorriso, char *adr, int flag)
{
int ret,linecount= 0, insertcount= 0, null= 0, was_failure= 0, fret= 0;
int was_ferror= 0, list_errfile= 0;
FILE *fp= NULL;
char *argpt, sfe[5*SfileadrL],line[SfileadrL];
@ -8821,9 +8830,21 @@ int Xorriso_option_path_list(struct XorrisO *xorriso, char *adr, int flag)
if(Sfile_fgets(line,sizeof(line),fp)==NULL) {
ret= 1;
if(ferror(fp))
ret= 0;
was_ferror= 1;
break;
}
/* <<< disabled for now: list all files which get not processed after
the problem evaluator decided to abort. Actually the whole program
will abort and thus further commands will not report their omitted
files.
*/
if(list_errfile) {
if(line[0])
Xorriso_msgs_submit(xorriso, 0, line, 0, "ERRFILE", 0);
continue;
}
linecount++;
if(line[0]==0)
continue;
@ -8840,18 +8861,25 @@ problem_handler:;
fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
if(fret>=0)
continue;
#ifdef NIX
list_errfile= 1; /* <<< disabled : see above */
#else
goto ex;
#endif
}
Xorriso_pacifier_callback(xorriso, "files added", xorriso->pacifier_count,
xorriso->pacifier_total, "", 1);
ret= 1;
ex:;
if(ret<=0) {
Xorriso_pacifier_callback(xorriso, "files added", xorriso->pacifier_count,
xorriso->pacifier_total, "", 1);
if(ret<=0 || list_errfile) {
sprintf(xorriso->info_text, "Aborted reading of file %s in line number %d",
Text_shellsafe(adr, sfe, 0), linecount);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0,
(fret==-2 ? "NOTE" : "FAILURE"), 0);
}
ret= !(was_ferror || list_errfile);
sprintf(xorriso->info_text, "Added %d items from file %s\n",
insertcount, Text_shellsafe(adr, sfe, 0));
Xorriso_info(xorriso,0);

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.02.21.211101"
#define Xorriso_timestamP "2008.02.22.114917"

View File

@ -316,7 +316,9 @@ int Xorriso__text_to_sev(char *severity_name, int *severity_number, int flag)
}
/* @param flag bit0=report libisofs error text */
/* @param flag bit0= report libisofs error text
bit1= victim is disk_path
*/
int Xorriso_report_iso_error(struct XorrisO *xorriso, char *victim,
int iso_error_code, char msg_text[], int os_errno,
char min_severity[], int flag)
@ -324,6 +326,10 @@ int Xorriso_report_iso_error(struct XorrisO *xorriso, char *victim,
int error_code, iso_sev, min_sev, ret;
char *sev_text_pt, *msg_text_pt= NULL;
char sfe[6*SfileadrL];
static int sorry_sev= -1;
if(sorry_sev<0)
Xorriso__text_to_sev("SORRY", &sorry_sev, 0);
error_code= iso_error_get_code(iso_error_code);
if(error_code < 0x00030000 || error_code >= 0x00040000)
@ -334,6 +340,9 @@ int Xorriso_report_iso_error(struct XorrisO *xorriso, char *victim,
if(msg_text_pt==NULL)
msg_text_pt= msg_text;
iso_sev= iso_error_get_severity(iso_error_code);
if(iso_sev >= sorry_sev && (flag & 2) && victim[0])
Xorriso_msgs_submit(xorriso, 0, victim, 0, "ERRFILE", 0);
sev_text_pt= min_severity;
Xorriso__text_to_sev(min_severity, &min_sev, 0);
if(min_sev < iso_sev)
@ -1449,6 +1458,7 @@ int Xorriso_add_tree(struct XorrisO *xorriso, IsoDir *dir,
}
if(ret==0) {
cannot_open_dir:;
Xorriso_msgs_submit(xorriso, 0, disk_dir_path, 0, "ERRFILE", 0);
sprintf(xorriso->info_text,"Cannot open as source directory: %s",
Text_shellsafe(disk_dir_path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
@ -1487,6 +1497,7 @@ cannot_open_dir:;
stbuf_src= srcpt;
if(lstat(srcpt, &stbuf)==-1) {
cannot_lstat:;
Xorriso_msgs_submit(xorriso, 0, srcpt, 0, "ERRFILE", 0);
sprintf(xorriso->info_text,
"Cannot determine attributes of source file %s",
Text_shellsafe(srcpt, sfe, 0));
@ -1525,8 +1536,9 @@ cannot_lstat:;
#ifdef NIX
} else if(!(S_ISREG(stbuf.st_mode) || S_ISLNK(stbuf.st_mode))) {
Xorriso_msgs_submit(xorriso, 0, stbuf_src, 0, "ERRFILE", 0);
sprintf(xorriso->info_text,"Source file %s %s non-supported file type",
Text_shellsafe(disk_path, sfe, 0),
Text_shellsafe(srcpt, sfe, 0),
source_is_link ? "leads to" : "is of");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
ret= 0; goto was_problem;
@ -1556,9 +1568,10 @@ cannot_lstat:;
}
node= NULL;
} else {
Xorriso_msgs_submit(xorriso, 0, srcpt, 0, "ERRFILE", 0);
sprintf(xorriso->info_text,
"While grafting %s : file object exists and may not be overwritten",
Text_shellsafe(img_path,sfe,0));
"While grafting %s : file object exists and may not be overwritten by %s",
Text_shellsafe(img_path,sfe,0), Text_shellsafe(stbuf_src,sfe2,0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
ret= 0; goto was_problem;
}
@ -1580,22 +1593,23 @@ cannot_lstat:;
goto was_problem;
} else {
Xorriso_report_iso_error(xorriso, stbuf_src, ret,
"Cannot create symbolic link", 0, "FAILURE", 1);
"Cannot create symbolic link", 0, "FAILURE", 1|2);
{ret= 0; goto was_problem;}
}
} else {
ret= iso_tree_add_node(volume, dir, srcpt, &node);
if(ret<0) {
Xorriso_report_iso_error(xorriso, stbuf_src, ret,
"Cannot add node to tree", 0, "FAILURE", 1);
"Cannot add node to tree", 0, "FAILURE", 1|2);
goto was_problem;
}
}
}
if(node==NULL) {
Xorriso_process_msg_queues(xorriso,0);
Xorriso_msgs_submit(xorriso, 0, stbuf_src, 0, "ERRFILE", 0);
sprintf(xorriso->info_text, "Grafting failed: %s = %s",
Text_shellsafe(img_path,sfe,0), Text_shellsafe(disk_path,sfe2,0));
Text_shellsafe(img_path,sfe,0), Text_shellsafe(stbuf_src,sfe2,0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
ret=0; goto was_problem;
}
@ -1726,8 +1740,10 @@ int Xorriso_graft_in(struct XorrisO *xorriso, char *disk_path, char *img_path,
break;
}
if(cpt!=NULL) {
Xorriso_msgs_submit(xorriso, 0, disk_path, 0, "ERRFILE", 0);
sprintf(xorriso->info_text,
"Unsupported relative addressing in iso_rr_path '%s'", img_path);
"Unsupported relative addressing in iso_rr_path %s (disk: %s)",
Text_shellsafe(img_path, sfe, 0), Text_shellsafe(disk_path, sfe2, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0);
return(0);
}
@ -1747,8 +1763,10 @@ int Xorriso_graft_in(struct XorrisO *xorriso, char *disk_path, char *img_path,
ret= lstat(disk_path, &stbuf);
if(ret == -1) {
Xorriso_process_msg_queues(xorriso,0);
Xorriso_msgs_submit(xorriso, 0, disk_path, 0, "ERRFILE", 0);
sprintf(xorriso->info_text,
"Cannot determine attributes of source file '%s'",disk_path);
"Cannot determine attributes of source file %s",
Text_shellsafe(disk_path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0);
return(0);
}
@ -1758,6 +1776,7 @@ int Xorriso_graft_in(struct XorrisO *xorriso, char *disk_path, char *img_path,
#ifdef NIX
} else if(!(S_ISREG(stbuf.st_mode) || S_ISLNK(stbuf.st_mode))) {
Xorriso_process_msg_queues(xorriso,0);
Xorriso_msgs_submit(xorriso, 0, disk_path, 0, "ERRFILE", 0);
sprintf(xorriso->info_text,
"Source file '%s' is of non-supported file type", disk_path);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
@ -1770,9 +1789,10 @@ int Xorriso_graft_in(struct XorrisO *xorriso, char *disk_path, char *img_path,
if(img_path[l-1]=='/')
l= 0;
if(l==0) {
Xorriso_msgs_submit(xorriso, 0, disk_path, 0, "ERRFILE", 0);
sprintf(xorriso->info_text,
"Source '%s' is not a directory. Target '%s' would be.",
disk_path, img_path);
"Source '%s' is not a directory. Target '%s' would be.",
Text_shellsafe(disk_path, sfe, 0), Text_shellsafe(img_path, sfe2, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
}
@ -1824,6 +1844,7 @@ int Xorriso_graft_in(struct XorrisO *xorriso, char *disk_path, char *img_path,
goto handle_path_node;
}
Xorriso_msgs_submit(xorriso, 0, disk_path, 0, "ERRFILE", 0);
sprintf(xorriso->info_text,
"While grafting '%s' : '%s' exists and may not be overwritten",
img_path, path);
@ -1838,6 +1859,7 @@ handle_path_node:;
ret= iso_tree_add_new_dir(dir, apt, &hdir);
if(ret<0) {
Xorriso_process_msg_queues(xorriso,0);
Xorriso_msgs_submit(xorriso, 0, disk_path, 0, "ERRFILE", 0);
Xorriso_report_iso_error(xorriso, img_path, ret,
"Cannot create directory", 0, "FAILURE", 1);
sprintf(xorriso->info_text,
@ -1878,6 +1900,7 @@ attach_source:;
ret= iso_tree_add_node(volume, dir, disk_path, &node);
if(ret<0) {
Xorriso_process_msg_queues(xorriso,0);
Xorriso_msgs_submit(xorriso, 0, disk_path, 0, "ERRFILE", 0);
Xorriso_report_iso_error(xorriso, img_path, ret, "Cannot create node",
0, "FAILURE", 1);
sprintf(xorriso->info_text, "Grafting failed: %s = %s",
@ -1927,6 +1950,8 @@ int Xorriso_process_msg_queues(struct XorrisO *xorriso, int flag)
if(error_code==0x5ff73 || error_code==0x3ff73 ||
error_code==0x3feb9 || error_code==0x3feb2)
strcpy(severity, "MISHAP");
else if(error_code==0x51001)
strcpy(severity, "ERRFILE");
Xorriso_msgs_submit(xorriso, error_code, xorriso->info_text, os_errno,
severity, ((pass+tunneled)+1)<<2);
@ -3873,14 +3898,16 @@ int Xorriso_set_abort_severity(struct XorrisO *xorriso, int flag)
int ret;
/* <<< On MISHAP use FAILURE as abort severity known to libisofs.
On ERRFILE use NEVER.
The pacifier loop will care for canceling libburn on MISHAP
and thus also cancel the image generation.
with libisofs-0.6.4 this should not be necessary
*/
if((flag&1) && strcmp(xorriso->abort_on_text, "MISHAP")==0)
ret= iso_set_abort_severity("FAILURE");
else if((flag&1) && strcmp(xorriso->abort_on_text, "ERRFILE")==0)
ret= iso_set_abort_severity("NEVER");
else
ret= iso_set_abort_severity(xorriso->abort_on_text);
return(ret>=0);
}