Added link hop limit to option -follow

This commit is contained in:
Thomas Schmitt 2007-12-16 10:36:04 +00:00
parent 20313a4654
commit 97dfff0371
3 changed files with 39 additions and 9 deletions

View File

@ -2,7 +2,7 @@
.\" First parameter, NAME, should be all caps .\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1) .\" other parameters are allowed: see man(7), man(1)
.TH XORRISO 1 "December 15, 2007" .TH XORRISO 1 "December 16, 2007"
.\" Please adjust this date whenever revising the manpage. .\" Please adjust this date whenever revising the manpage.
.\" .\"
.\" Some roff macros, for reference: .\" Some roff macros, for reference:
@ -667,7 +667,7 @@ SORRY event occured.
.B Settings for data insertion: .B Settings for data insertion:
.TP .TP
\fB\-follow\fR occasion[:occasion[...]] \fB\-follow\fR occasion[:occasion[...]]
Enable or disable resolution of symbolic links and mount points under Enable or disable resolution of symbolic links and mountpoints under
disk_paths. This applies to actions -add, -du*x, -ls*x and to -disk_pattern disk_paths. This applies to actions -add, -du*x, -ls*x and to -disk_pattern
expansion. expansion.
.br .br
@ -678,11 +678,11 @@ If enabled then symbolic links are handled as their target file objects,
else symbolic links are handled as themselves. else symbolic links are handled as themselves.
.br .br
"mount" is the hop from one filesystem to another subordinate filesystem. "mount" is the hop from one filesystem to another subordinate filesystem.
If enabled then mount point directories are handled as any other directory, If enabled then mountpoint directories are handled as any other directory,
else mount points are handled as empty directories if they are encountered in else mountpoints are handled as empty directories if they are encountered in
directory tree traversals. directory tree traversals.
.br .br
Less general then above occasions: Less general than above occasions:
.br .br
"pattern" is mount and link hopping, but only during -disk_pattern expansion. "pattern" is mount and link hopping, but only during -disk_pattern expansion.
.br .br
@ -699,9 +699,26 @@ applies.
.br .br
Shortcuts: Shortcuts:
.br .br
"default" is equivalent to "pattern:mount". "default" is equivalent to "pattern:mount:limit=100".
.br .br
"on" always decides positive. Equivalent to "link:mount". "on" always decides positive. Equivalent to "link:mount".
.br
Not an occasion but an optional setting is:
.br
"limit="<number> which sets the maximum number of link hops.
A link hop consists of a sequence of symbolic links and a final target
of different type. Nevertheless those hops can loop. Example:
.br
\fB$\fR ln -s .. uploop
.br
Link hopping has a builtin loop detection which stops hopping at the first
repetition of a link target. Then the repeated link is handled as itself
and not as its target.
Regrettably one can construct link networks which
cause exponential workload before their loops get detected.
The number given with "limit=" can curb this workload at the risk of truncating
an intentional sequence of link hops.
.TP .TP
\fB\-pathspecs\fR "on"|"off" \fB\-pathspecs\fR "on"|"off"
Control parameter interpretation with xorriso actions -add and -path_list. Control parameter interpretation with xorriso actions -add and -path_list.

View File

@ -3630,7 +3630,8 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
Xorriso_status_result(xorriso,filter,fp,flag&2); Xorriso_status_result(xorriso,filter,fp,flag&2);
is_default= (xorriso->do_follow_pattern && (!xorriso->do_follow_param) is_default= (xorriso->do_follow_pattern && (!xorriso->do_follow_param)
&& xorriso->do_follow_mount && !xorriso->do_follow_links); && xorriso->do_follow_mount && (!xorriso->do_follow_links)
&& xorriso->follow_link_limit==100);
mode[0]= 0; mode[0]= 0;
if(xorriso->do_follow_pattern) if(xorriso->do_follow_pattern)
strcat(mode,":pattern"); strcat(mode,":pattern");
@ -3642,6 +3643,7 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
strcat(mode,":mount"); strcat(mode,":mount");
if(mode[0]==0) if(mode[0]==0)
strcpy(mode, ":off"); strcpy(mode, ":off");
sprintf(mode+strlen(mode), ":limit=%d", xorriso->follow_link_limit);
sprintf(line,"-follow %s\n", mode+1); sprintf(line,"-follow %s\n", mode+1);
if(!(is_default && no_defaults)) if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2); Xorriso_status_result(xorriso,filter,fp,flag&2);
@ -5865,6 +5867,7 @@ int Xorriso_option_iso_rr_pattern(struct XorrisO *xorriso, char *mode,int flag)
int Xorriso_option_follow(struct XorrisO *xorriso, char *mode, int flag) int Xorriso_option_follow(struct XorrisO *xorriso, char *mode, int flag)
{ {
int was_fl, was_fm, was_fpr, was_fpt, l; int was_fl, was_fm, was_fpr, was_fpt, l;
double num;
char *cpt, *npt; char *cpt, *npt;
was_fpt= xorriso->do_follow_pattern; was_fpt= xorriso->do_follow_pattern;
@ -5899,6 +5902,7 @@ int Xorriso_option_follow(struct XorrisO *xorriso, char *mode, int flag)
xorriso->do_follow_param= 0; xorriso->do_follow_param= 0;
xorriso->do_follow_links= 0; xorriso->do_follow_links= 0;
xorriso->do_follow_mount= 1; xorriso->do_follow_mount= 1;
xorriso->follow_link_limit= 100;
} else if(strncmp(cpt, "link", l)==0 || strncmp(cpt,"links", l)==0) { } else if(strncmp(cpt, "link", l)==0 || strncmp(cpt,"links", l)==0) {
xorriso->do_follow_links= 1; xorriso->do_follow_links= 1;
} else if(strncmp(cpt, "mount", l)==0) { } else if(strncmp(cpt, "mount", l)==0) {
@ -5907,12 +5911,21 @@ int Xorriso_option_follow(struct XorrisO *xorriso, char *mode, int flag)
xorriso->do_follow_param= 1; xorriso->do_follow_param= 1;
} else if(strncmp(cpt, "pattern", l)==0) { } else if(strncmp(cpt, "pattern", l)==0) {
xorriso->do_follow_pattern= 1; xorriso->do_follow_pattern= 1;
} else if(strncmp(cpt, "limit=", 6)==0) {
sscanf(cpt+6, "%lf", &num);
if(num<=0 || num>1.0e6) {
sprintf(xorriso->info_text, "-follow: Value too %s with '%s'",
num<=0 ? "small" : "large", cpt+6);
goto sorry_ex;
}
xorriso->follow_link_limit= num;
} else { } else {
unknown_mode:; unknown_mode:;
if(l<SfileadrL) if(l<SfileadrL)
sprintf(xorriso->info_text, "-follow: unknown mode '%s'", cpt); sprintf(xorriso->info_text, "-follow: unknown mode '%s'", cpt);
else else
sprintf(xorriso->info_text, "-follow: oversized mode parameter (%d)",l); sprintf(xorriso->info_text, "-follow: oversized mode parameter (%d)",l);
sorry_ex:
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
xorriso->do_follow_pattern= was_fpt; xorriso->do_follow_pattern= was_fpt;
xorriso->do_follow_param= was_fpr; xorriso->do_follow_param= was_fpr;
@ -6084,7 +6097,7 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" Delete empty directories.", " Delete empty directories.",
" -- Mark end of particular action argument list.", " -- Mark end of particular action argument list.",
"", "",
" -follow \"on\"|\"pattern:param:link:mount\"|\"default\"|\"off\"", " -follow \"on\"|\"pattern:param:link:mount:limit=#\"|\"default\"|\"off\"",
" Follow symbolic links and mount points within disk_path.", " Follow symbolic links and mount points within disk_path.",
"", "",
" -overwrite \"on\"|\"nondir\"|\"off\"", " -overwrite \"on\"|\"nondir\"|\"off\"",

View File

@ -1 +1 @@
#define Xorriso_timestamP "2007.12.15.183022" #define Xorriso_timestamP "2007.12.16.103456"