Added link hop limit to option -follow

This commit is contained in:
Thomas Schmitt 2007-12-16 10:36:04 +00:00
parent bcf31583c8
commit 995aad855b
3 changed files with 39 additions and 9 deletions

View File

@ -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 "December 15, 2007"
.TH XORRISO 1 "December 16, 2007"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@ -667,7 +667,7 @@ SORRY event occured.
.B Settings for data insertion:
.TP
\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
expansion.
.br
@ -678,11 +678,11 @@ If enabled then symbolic links are handled as their target file objects,
else symbolic links are handled as themselves.
.br
"mount" is the hop from one filesystem to another subordinate filesystem.
If enabled then mount point directories are handled as any other directory,
else mount points are handled as empty directories if they are encountered in
If enabled then mountpoint directories are handled as any other directory,
else mountpoints are handled as empty directories if they are encountered in
directory tree traversals.
.br
Less general then above occasions:
Less general than above occasions:
.br
"pattern" is mount and link hopping, but only during -disk_pattern expansion.
.br
@ -699,9 +699,26 @@ applies.
.br
Shortcuts:
.br
"default" is equivalent to "pattern:mount".
"default" is equivalent to "pattern:mount:limit=100".
.br
"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
\fB\-pathspecs\fR "on"|"off"
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);
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;
if(xorriso->do_follow_pattern)
strcat(mode,":pattern");
@ -3642,6 +3643,7 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
strcat(mode,":mount");
if(mode[0]==0)
strcpy(mode, ":off");
sprintf(mode+strlen(mode), ":limit=%d", xorriso->follow_link_limit);
sprintf(line,"-follow %s\n", mode+1);
if(!(is_default && no_defaults))
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 was_fl, was_fm, was_fpr, was_fpt, l;
double num;
char *cpt, *npt;
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_links= 0;
xorriso->do_follow_mount= 1;
xorriso->follow_link_limit= 100;
} else if(strncmp(cpt, "link", l)==0 || strncmp(cpt,"links", l)==0) {
xorriso->do_follow_links= 1;
} 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;
} else if(strncmp(cpt, "pattern", l)==0) {
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 {
unknown_mode:;
if(l<SfileadrL)
sprintf(xorriso->info_text, "-follow: unknown mode '%s'", cpt);
else
sprintf(xorriso->info_text, "-follow: oversized mode parameter (%d)",l);
sorry_ex:
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
xorriso->do_follow_pattern= was_fpt;
xorriso->do_follow_param= was_fpr;
@ -6084,7 +6097,7 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" Delete empty directories.",
" -- 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.",
"",
" -overwrite \"on\"|\"nondir\"|\"off\"",

View File

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