fts(3) typo

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

fts(3) typo

Nick Guenther
fts(3) says in the intro:

     It is possible to walk the hierarchy ``logically'' (ignoring symbolic
     links) or physically (visiting symbolic links), order the walk of the hi-
     erarchy, or prune and/or re-visit portions of the hierarchy.

Which struck me as backwards. And indeed later:

     FTS_LOGICAL   This option causes the fts routines to return FTSENT struc-
                   tures for the targets of symbolic links instead of the sym-
                   bolic links themselves.
     FTS_PHYSICAL  This option causes the fts routines to return FTSENT struc-
                   tures for symbolic links themselves instead of the target
                   files they point to.

Am I reading this wrong or is there a long-lost typo here?

-Nick

Reply | Threaded
Open this post in threaded view
|

Re: fts(3) typo

Martin Hedenfalk-4
26 nov 2009 kl. 07.26 skrev Nick Guenther:

> fts(3) says in the intro:
>
>     It is possible to walk the hierarchy ``logically'' (ignoring symbolic
>     links) or physically (visiting symbolic links), order the walk of the
hi-
>     erarchy, or prune and/or re-visit portions of the hierarchy.
>
> Which struck me as backwards. And indeed later:
>
>     FTS_LOGICAL   This option causes the fts routines to return FTSENT
struc-
>                   tures for the targets of symbolic links instead of the
sym-
>                   bolic links themselves.
>     FTS_PHYSICAL  This option causes the fts routines to return FTSENT
struc-
>                   tures for symbolic links themselves instead of the target
>                   files they point to.
>
> Am I reading this wrong or is there a long-lost typo here?

I think you're reading it wrong. If I we're to ignore that an entry was a
symbolic link, I would (logically) expect to get the target back, not the link
itself.

        -martin

Reply | Threaded
Open this post in threaded view
|

Re: fts(3) typo

Otto Moerbeek
On Thu, Nov 26, 2009 at 10:30:26AM +0100, Martin Hedenfalk wrote:

> 26 nov 2009 kl. 07.26 skrev Nick Guenther:
>
> > fts(3) says in the intro:
> >
> >     It is possible to walk the hierarchy ``logically'' (ignoring symbolic
> >     links) or physically (visiting symbolic links), order the walk of the
> hi-
> >     erarchy, or prune and/or re-visit portions of the hierarchy.
> >
> > Which struck me as backwards. And indeed later:
> >
> >     FTS_LOGICAL   This option causes the fts routines to return FTSENT
> struc-
> >                   tures for the targets of symbolic links instead of the
> sym-
> >                   bolic links themselves.
> >     FTS_PHYSICAL  This option causes the fts routines to return FTSENT
> struc-
> >                   tures for symbolic links themselves instead of the target
> >                   files they point to.
> >
> > Am I reading this wrong or is there a long-lost typo here?
>
> I think you're reading it wrong. If I we're to ignore that an entry was a
> symbolic link, I would (logically) expect to get the target back, not the link
> itself.
>
> -martin

It is at least confusing, and I think even wrong.

Take find. It will alsways do something with a symbolic link. It never
ignores them.

find(1) uses physical by default. It will list symbolic link info, but
skip them for traversal. In effetc, it does not look at the target of
the symbolic link, i.e. it ignores the (target of) the symlink.

Logically means following symbolic links, i.e. for files it will
display the target info, and it will continue traversing the target if
it is a dir.

        -Otto

Reply | Threaded
Open this post in threaded view
|

Re: fts(3) typo

Otto Moerbeek
On Thu, Nov 26, 2009 at 11:15:46AM +0100, Otto Moerbeek wrote:

> On Thu, Nov 26, 2009 at 10:30:26AM +0100, Martin Hedenfalk wrote:
>
> > 26 nov 2009 kl. 07.26 skrev Nick Guenther:
> >
> > > fts(3) says in the intro:
> > >
> > >     It is possible to walk the hierarchy ``logically'' (ignoring symbolic
> > >     links) or physically (visiting symbolic links), order the walk of the
> > hi-
> > >     erarchy, or prune and/or re-visit portions of the hierarchy.
> > >
> > > Which struck me as backwards. And indeed later:
> > >
> > >     FTS_LOGICAL   This option causes the fts routines to return FTSENT
> > struc-
> > >                   tures for the targets of symbolic links instead of the
> > sym-
> > >                   bolic links themselves.
> > >     FTS_PHYSICAL  This option causes the fts routines to return FTSENT
> > struc-
> > >                   tures for symbolic links themselves instead of the target
> > >                   files they point to.
> > >
> > > Am I reading this wrong or is there a long-lost typo here?
> >
> > I think you're reading it wrong. If I we're to ignore that an entry was a
> > symbolic link, I would (logically) expect to get the target back, not the link
> > itself.
> >
> > -martin
>
> It is at least confusing, and I think even wrong.
>
> Take find. It will alsways do something with a symbolic link. It never
> ignores them.
>
> find(1) uses physical by default. It will list symbolic link info, but
> skip them for traversal. In effetc, it does not look at the target of
> the symbolic link, i.e. it ignores the (target of) the symlink.
>
> Logically means following symbolic links, i.e. for files it will
> display the target info, and it will continue traversing the target if
> it is a dir.
>
> -Otto

And here's a diff.

Index: gen/fts.3
===================================================================
RCS file: /cvs/src/lib/libc/gen/fts.3,v
retrieving revision 1.26
diff -u -p -r1.26 fts.3
--- gen/fts.3 27 Aug 2009 16:19:27 -0000 1.26
+++ gen/fts.3 26 Nov 2009 10:20:41 -0000
@@ -78,8 +78,11 @@ of their descendants have been visited).
 Files are visited once.
 It is possible to walk the hierarchy
 .Dq logically
-(ignoring symbolic links)
-or physically (visiting symbolic links), order the walk of the hierarchy, or
+(visiting the target of symbolic links)
+or
+.Dq physically
+(ignoring the target of symbolic links),
+order the walk of the hierarchy, or
 prune and/or re-visit portions of the hierarchy.
 .Pp
 Two structures are defined (and typedef'd) in the include file