bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug #14376] -follow -type l returns no results (when it should)


From: James Youngman
Subject: Re: [bug #14376] -follow -type l returns no results (when it should)
Date: Fri, 2 Sep 2005 22:05:10 +0100
User-agent: Mutt/1.5.9i

On Fri, Sep 02, 2005 at 03:29:22PM -0400, Drew Van Zandt wrote:

> I would suggest adding a short sentence in the -type explanation
> pointing the user to -xtype if -follow is used, e.g.: If using
> -follow, see also -xtype.

The Texinfo documentation currently says this:

The following differences in behavior occur when the @samp{-L} option
is used:

  @itemize @bullet
  @item
  @code{find} follows symbolic links to directories when searching
  directory trees.
  @item
  @samp{-lname} and @samp{-ilname} always return false (unless they
  happen to match broken symbolic links).
  @item
  @samp{-type} reports the types of the files that symbolic links point
  to.
  @item
  Implies @samp{-noleaf} (@pxref{Directories}).
  @end itemize

I have enhanced the final item like so:

  @item
  @samp{-type} reports the types of the files that symbolic links point
  to.  This means that in combination with @samp{-L}, @samp{-type l}
  will be true only for broken symbolic links.  To check for symbolic
  links when @samp{-L} has been specified, use @samp{-xtype}.

I have also modified the description of -type and -xtype:

  @deffn Test -type c
  True if the file is of type @var{c}:
  
  @table @code
  @item b
  block (buffered) special
  @item c
  character (unbuffered) special
  @item d
  directory
  @item p
  named pipe (FIFO)
  @item f
  regular file
  @item l
  symbolic link; if @samp{-L} is in effect, this is true only for broken
  symbolic links.  If you want to search for symbolic links when
  @samp{-L} is in effect, use @samp{-xtype} instead of @samp{-type}.
  @item s
  socket
  @item D
  door (Solaris)
  @end table
  @end deffn

  @deffn Test -xtype c
  This test behaves the same as @samp{-type} unless the file is a
  symbolic link.  If the file is a symbolic link, the result is as
  follows (in the table below, @samp{X} should be understood to
  represent any letter except @samp{l}):
  
  @table @samp
  @item @samp{-P -xtype l}
  True if the symbolic link is broken
  @item @samp{-P -xtype X}
  True if the (ultimate) target file is of type @samp{X}.
  @item @samp{-L -xtype l}
  Always true
  @item @samp{-L -xtype X}
  False unless the symbolic link is broken
  @end table
  
  In other words, for symbolic links, @samp{-xtype} checks the type of
  the file that @samp{-type} does not check.  
  
  The @samp{-H} option also affects the behaviour of @samp{-xtype}.
  When @samp{-H} is in effect, @samp{-xtype} behaves as if @samp{-L} had
  been specified when examining files listed on the command line, and as
  if @samp{-P} had been specified otherwise.  If neither @samp{-H} nor
  @samp{-L} was specified, @samp{-xtype} behaves as if @samp{-P} had
  been specified.
  
  @xref{Symbolic Links}, for more information on @samp{-follow} and
  @samp{-L}.
  @end deffn


> It was not apparent until you pointed it out to me that -type l
> wouldn't count a dereferenced link as a link; would find -follow -type
> l EVER return anything?  If it doesn't ever return anything, it
> seems... awkward to have it at all, except for regularity in the
> command-line options.  Should it "complain" that -follow and -type l
> are incompatible?  (Note that I'm not saying it should, just raising
> the question.)

I hope that the above documentation improvements make the situation a
bit clearer.   I have also made a small change to the manpage:-

  .IP "\-type \fIc\fR"
  File is of type \fIc\fR:
  .RS
  .IP b
  block (buffered) special
  .IP c
  character (unbuffered) special
  .IP d
  directory
  .IP p
  named pipe (FIFO)
  .IP f
  regular file
  .IP l
  symbolic link; this is never true if the \-L option or the \-follow
  option is in effect, unless the symbolic link is broken.  If you want
  to search for symbolic links when \-L is in effect, use \-xtype. 

If you have any other suggested changes, please let me know.

Regards,
James.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]