New option -error_behavior with a first occasion image_loading
This commit is contained in:
parent
8e4787ee35
commit
3df489fa36
@ -200,6 +200,11 @@ int isoburn_read_image(struct burn_drive *d,
|
||||
iso_read_opts_set_default_uid(ropts, read_opts->uid);
|
||||
iso_read_opts_set_default_gid(ropts, read_opts->gid);
|
||||
iso_read_opts_set_input_charset(ropts, read_opts->input_charset);
|
||||
|
||||
/* <<< experimental API call of libisofs
|
||||
iso_read_opts_set_error_behavior(ropts, 1);
|
||||
*/
|
||||
|
||||
ds = isoburn_data_source_new(d);
|
||||
iso_image_attach_data(o->image, o->read_pacifier_handle,
|
||||
isoburn_idle_free_function);
|
||||
|
@ -2,7 +2,7 @@
|
||||
.\" First parameter, NAME, should be all caps
|
||||
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
||||
.\" other parameters are allowed: see man(7), man(1)
|
||||
.TH XORRISO 1 "April, 3, 2008"
|
||||
.TH XORRISO 1 "May, 1, 2008"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.\" Some roff macros, for reference:
|
||||
@ -212,7 +212,8 @@ Growing is achieved by option -dev.
|
||||
The write method of \fBmodifying\fR produces compact filesystem
|
||||
images with no outdated files or directory trees. Modifying can write its
|
||||
images to target media which are completely unsuitable for multi-session
|
||||
operations. E.g. fast blanked DVD-RW, named pipes, character devices, sockets.
|
||||
operations. E.g. DVD-RW which were treated with -blank deformat_quickest,
|
||||
named pipes, character devices, sockets.
|
||||
On the other hand modified sessions cannot be written to appendable media
|
||||
but to blank media only.
|
||||
.br
|
||||
@ -285,7 +286,7 @@ among the start arguments. Do not try to fool this ban via backdoor addresses
|
||||
to stdout.
|
||||
.br
|
||||
If stdout is used as drive, then -use_readline is permanently disabled.
|
||||
Use of backdoors will cause severe memory and/or terminal corruption.
|
||||
Use of backdoors will cause severe memory and/or tty corruption.
|
||||
.PP
|
||||
Be aware that especially the superuser can write into any accessible file or
|
||||
device by using its path with the "stdio:" prefix. Addresses without prefix
|
||||
@ -1183,6 +1184,21 @@ A special property of this option is that the first -report_about setting
|
||||
among the start arguments is in effect already when the first operations
|
||||
of xorriso begin. Only "-report_about" with dash "-" is recognized that way.
|
||||
.TP
|
||||
\fB\-error_behavior\fR occasion behavior
|
||||
Control the program behavior at problem event occasions.
|
||||
.br
|
||||
For now this applies only to occasion "image_loading" which is given while
|
||||
an image tree is read from the input device. There are three behaviors
|
||||
available:
|
||||
.br
|
||||
"best_effort" goes on with reading after events with severity below FAILURE
|
||||
.br
|
||||
"failure" aborts image tree reading on first event of at least SORRY.
|
||||
It issues an own FAILURE event.
|
||||
.br
|
||||
"fatal" acts like "failure" but issues the own event as FATAL.
|
||||
This is the default.
|
||||
.TP
|
||||
.B Dialog mode control:
|
||||
.TP
|
||||
\fB\-dialog\fR "on"|"off"
|
||||
|
@ -2445,6 +2445,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
|
||||
m->problem_status_text[0]= 0;
|
||||
m->errfile_log[0]= 0;
|
||||
m->errfile_fp= NULL;
|
||||
m->img_read_error_mode= 2; /* abort faulty image reading with FATAL */
|
||||
strcpy(m->return_with_text, "SORRY");
|
||||
Xorriso__text_to_sev(m->return_with_text, &m->return_with_severity, 0);
|
||||
m->return_with_value= 32;
|
||||
@ -3537,6 +3538,16 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
|
||||
if(!(is_default && no_defaults))
|
||||
Xorriso_status_result(xorriso,filter,fp,flag&2);
|
||||
|
||||
is_default= (xorriso->img_read_error_mode==2);
|
||||
treatment= "best_effort";
|
||||
if(xorriso->img_read_error_mode==1)
|
||||
treatment= "failure";
|
||||
else if(xorriso->img_read_error_mode==2)
|
||||
treatment= "fatal";
|
||||
sprintf(line,"-error_behavior image_loading %s\n", treatment);
|
||||
if(!(is_default && no_defaults))
|
||||
Xorriso_status_result(xorriso,filter,fp,flag&2);
|
||||
|
||||
is_default= (xorriso->mark_text[0]==0);
|
||||
sprintf(line,"-mark %s\n",Text_shellsafe(xorriso->mark_text,sfe,0));
|
||||
if(!(is_default && no_defaults))
|
||||
@ -8224,6 +8235,34 @@ int Xorriso_option_errfile_log(struct XorrisO *xorriso,
|
||||
}
|
||||
|
||||
|
||||
/* Option -error_behavior */
|
||||
int Xorriso_option_error_behavior(struct XorrisO *xorriso,
|
||||
char *occasion, char *behavior, int flag)
|
||||
{
|
||||
if(strcmp(occasion, "image_loading")==0) {
|
||||
if(strcmp(behavior, "best_effort")==0)
|
||||
xorriso->img_read_error_mode= 0;
|
||||
else if(strcmp(behavior, "failure")==0 || strcmp(behavior, "FAILURE")==0)
|
||||
xorriso->img_read_error_mode= 1;
|
||||
else if(strcmp(behavior, "fatal")==0 || strcmp(behavior, "FATAL")==0)
|
||||
xorriso->img_read_error_mode= 2;
|
||||
else {
|
||||
sprintf(xorriso->info_text,
|
||||
"-error_behavior: with 'image_loading': unknown behavior '%s'",
|
||||
behavior);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
return(0);
|
||||
}
|
||||
} else {
|
||||
sprintf(xorriso->info_text, "-error_behavior: unknown occasion '%s'",
|
||||
occasion);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
return(0);
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
/* Option -follow */
|
||||
int Xorriso_option_follow(struct XorrisO *xorriso, char *mode, int flag)
|
||||
{
|
||||
@ -10336,6 +10375,10 @@ next_command:;
|
||||
(*idx)+= 2;
|
||||
ret= Xorriso_option_errfile_log(xorriso, arg1, arg2, 0);
|
||||
|
||||
} else if(strcmp(cmd,"error_behavior")==0) {
|
||||
(*idx)+= 2;
|
||||
ret= Xorriso_option_error_behavior(xorriso, arg1, arg2, 0);
|
||||
|
||||
} else if(strcmp(cmd,"iso_rr_pattern")==0) {
|
||||
(*idx)++;
|
||||
ret= Xorriso_option_iso_rr_pattern(xorriso, arg1, 0);
|
||||
|
@ -268,6 +268,14 @@ int Xorriso_option_eject(struct XorrisO *xorriso, char *which, int flag);
|
||||
*/
|
||||
int Xorriso_option_end(struct XorrisO *xorriso, int flag);
|
||||
|
||||
/* Option -errfile_log marked|plain path|-|"" */
|
||||
int Xorriso_option_errfile_log(struct XorrisO *xorriso,
|
||||
char *mode, char *path, int flag);
|
||||
|
||||
/* Option -error_behavior */
|
||||
int Xorriso_option_error_behavior(struct XorrisO *xorriso,
|
||||
char *occasion, char *behavior, int flag);
|
||||
|
||||
/* Option -iso_rr_pattern "on"|"ls"|"off" */
|
||||
int Xorriso_option_iso_rr_pattern(struct XorrisO *xorriso, char *mode,
|
||||
int flag);
|
||||
|
@ -184,6 +184,8 @@ struct XorrisO { /* the global context of xorriso */
|
||||
int errfile_mode; /* bit0= marked */
|
||||
FILE *errfile_fp;
|
||||
|
||||
int img_read_error_mode; /* 0=best_effort , 1=failure , 2=fatal */
|
||||
|
||||
char return_with_text[20];
|
||||
int return_with_severity;
|
||||
int return_with_value;
|
||||
|
@ -1 +1 @@
|
||||
#define Xorriso_timestamP "2008.04.28.122244"
|
||||
#define Xorriso_timestamP "2008.05.01.124248"
|
||||
|
@ -506,7 +506,7 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
|
||||
enum burn_disc_status state;
|
||||
IsoImage *volset = NULL;
|
||||
struct isoburn_read_opts *ropts= NULL;
|
||||
char adr_data[SfileadrL], *libburn_adr, *boot_fate;
|
||||
char adr_data[SfileadrL], *libburn_adr, *boot_fate, *sev;
|
||||
|
||||
if((flag&3)==0) {
|
||||
sprintf(xorriso->info_text,
|
||||
@ -625,11 +625,32 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
|
||||
Xorriso_set_image_severities(xorriso, 1); /* No DEBUG messages */
|
||||
Xorriso_pacifier_reset(xorriso, 0);
|
||||
isoburn_set_read_pacifier(drive, Xorriso__read_pacifier, (void *) xorriso);
|
||||
if(isoburn_read_image(drive, ropts, &volset) <= 0) {
|
||||
|
||||
/* <<< Trying to work around too much tolerance on bad image trees.
|
||||
Better would be a chance to instruct libisofs what to do in
|
||||
case of image read errors. There is a risk to mistake other SORRYs.
|
||||
*/
|
||||
if(xorriso->img_read_error_mode>0)
|
||||
iso_set_abort_severity("SORRY");
|
||||
|
||||
ret= isoburn_read_image(drive, ropts, &volset);
|
||||
|
||||
/* <<< Resetting to normal thresholds */
|
||||
if(xorriso->img_read_error_mode>0)
|
||||
Xorriso_set_abort_severity(xorriso, 0);
|
||||
|
||||
if(ret<=0) {
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
Xorriso_set_image_severities(xorriso, 0);
|
||||
sprintf(xorriso->info_text,"Cannot read ISO image volset");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
Xorriso_give_up_drive(xorriso, 1);
|
||||
sprintf(xorriso->info_text,"Cannot read ISO image tree");
|
||||
sev= "FAILURE";
|
||||
if(xorriso->img_read_error_mode==2)
|
||||
sev= "FATAL";
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, sev, 0);
|
||||
if(xorriso->img_read_error_mode!=0)
|
||||
Xorriso_msgs_submit(xorriso, 0, "You might get a partial or altered ISO image tree by option -error_behavior 'image_loading' 'best_effort'",
|
||||
0, "HINT", 0);
|
||||
ret= 3; goto ex;
|
||||
}
|
||||
Xorriso_pacifier_callback(xorriso, "nodes read", xorriso->pacifier_count, 0,
|
||||
@ -4397,21 +4418,23 @@ int Xorriso_set_publisher(struct XorrisO *xorriso, char *name, int flag)
|
||||
/* @param flag bit0=prepare for a burn run */
|
||||
int Xorriso_set_abort_severity(struct XorrisO *xorriso, int flag)
|
||||
{
|
||||
int ret;
|
||||
int ret, abort_on_number;
|
||||
char *sev_text;
|
||||
static int note_number= -1, failure_number= -1;
|
||||
|
||||
/* ??? <<< 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
|
||||
Shall it be uphold anyway ?
|
||||
*/
|
||||
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);
|
||||
if(note_number==-1)
|
||||
Xorriso__text_to_sev("NOTE", ¬e_number, 0);
|
||||
if(failure_number==-1)
|
||||
Xorriso__text_to_sev("FAILURE", &failure_number, 0);
|
||||
sev_text= xorriso->abort_on_text;
|
||||
ret= Xorriso__text_to_sev(xorriso->abort_on_text, &abort_on_number, 0);
|
||||
if(ret<=0)
|
||||
return(ret);
|
||||
if(abort_on_number<note_number)
|
||||
sev_text= "NOTE";
|
||||
else if(abort_on_number>failure_number)
|
||||
sev_text= "FAILURE";
|
||||
ret= iso_set_abort_severity(sev_text);
|
||||
return(ret>=0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user