[comp.unix.internals] Should find traverse symbolic links?

brnstnd@kramden.acf.nyu.edu (Dan Bernstein) (03/01/91)

In article <1991Feb27.223152.17677@convex.com> tchrist@convex.COM (Tom Christiansen) writes:
> Ug.  Just use -x and +x.  

Or, if you want to stick to getopt (and POSIX.2), use -x and -X.

---Dan

allbery@NCoast.ORG (Brandon S. Allbery KB8JRR) (03/03/91)

As quoted from <BZS.91Feb26172744@world.std.com> by bzs@world.std.com (Barry Shein):
+---------------
| Seems to me that find needs a flag which instructs it to follow
| symlinks and leave it to the user whether this is a good idea or not.
| It should be off by default, analogous to "ls"s -L flag (on BSD
| systems.)
| 
| For now you could probably kludge it with a "-type l" and -exec of
| another find on the real path if it's a dir, but i'll fully admit
| that's ugly and hairy.
+---------------

The Altos systems at work (aside from the 5000, which runs SCO Pseudnix and
therefore doesn't have symlinks... d*mmit) have a "find" which understands the
"-nosym" option.  It prevents traversal of symlinks --- the opposite of what
you're asking for.

It's notable that I don't use -nosym often, except for cpio backups.  That
means I use it about one day a week, and ignore the option the other 4 work
days....

++Brandon
-- 
Me: Brandon S. Allbery			    VHF/UHF: KB8JRR on 220, 2m, 440
Internet: allbery@NCoast.ORG		    Packet: KB8JRR @ WA8BXN
America OnLine: KB8JRR			    AMPR: KB8JRR.AmPR.ORG [44.70.4.88]
uunet!usenet.ins.cwru.edu!ncoast!allbery    Delphi: ALLBERY

rbj@uunet.UU.NET (Root Boy Jim) (03/05/91)

In article <1991Mar3.003300.23940@NCoast.ORG> allbery@ncoast.ORG (Brandon S. Allbery KB8JRR) writes:
>
>The Altos systems at work (aside from the 5000, which runs SCO Pseudnix and
>therefore doesn't have symlinks... d*mmit) have a "find" which understands the
>"-nosym" option.  It prevents traversal of symlinks --- the opposite of what
>you're asking for.

This is just plain wrong. Worse, it's dangerous.
What next, follow symlinks on rm -f?

Brandon, you are a glutton for punishment.
-- 
		[rbj@uunet 1] stty sane
		unknown mode: sane

allbery@NCoast.ORG (Brandon S. Allbery KB8JRR) (03/10/91)

As quoted from <124715@uunet.UU.NET> by rbj@uunet.UU.NET (Root Boy Jim):
+---------------
| In article <1991Mar3.003300.23940@NCoast.ORG> allbery@ncoast.ORG (Brandon S. Allbery KB8JRR) writes:
| >The Altos systems at work (aside from the 5000, which runs SCO Pseudnix and
| >therefore doesn't have symlinks... d*mmit) have a "find" which understands the
| >"-nosym" option.  It prevents traversal of symlinks --- the opposite of what
| >you're asking for.
| 
| This is just plain wrong. Worse, it's dangerous.
| What next, follow symlinks on rm -f?
| 
| Brandon, you are a glutton for punishment.
+---------------

No, Altos is.  I haven't decided yet which I prefer.  But 90% of my find's do
want to follow the symlinks... this probably depends on how one uses them.

Understand that Altos hacked symlinks in after the fact, originally intended
for their WorkNet setup.  But insofar as I'm concerned, symlinks are a kluge
anyway:  a useful kluge, but a kluge nonetheless.  Unfortunately, I don't have
the faintest idea what to replace them with.

++Brandon
-- 
Me: Brandon S. Allbery			    Ham: KB8JRR on 40m, 10m when time
Internet: allbery@NCoast.ORG		      permits; also 2m, 220, 440, 1200
America OnLine: KB8JRR // Delphi: ALLBERY   AMPR: kb8jrr.AmPR.ORG [44.70.4.88]
uunet!usenet.ins.cwru.edu!ncoast!allbery          KB8JRR @ WA8BXN.OH

rbj@uunet.UU.NET (Root Boy Jim) (03/12/91)

In article <1991Mar8.152932.5242@investor.pgh.pa.us> rbp@investor.pgh.pa.us (Bob Peirce #305) writes:
>Altos' find does traverse symbolic links...

Altos' find is broken.
-- 
		[rbj@uunet 1] stty sane
		unknown mode: sane

rbj@uunet.UU.NET (Root Boy Jim) (03/12/91)

In article <1991Mar9.213928.10943@NCoast.ORG> allbery@ncoast.ORG (Brandon S. Allbery KB8JRR) writes:
>As quoted from <124715@uunet.UU.NET> by rbj@uunet.UU.NET (Root Boy Jim):
>+---------------
>| Brandon, you are a glutton for punishment.
>+---------------
>
>No, Altos is.  I haven't decided yet which I prefer.  But 90% of my find's do
>want to follow the symlinks... this probably depends on how one uses them.

No you are if you continue to use those weird systems.

However one wants to use them, the default should be safely.
I agree that an override switch should be provided.

The standard has been set (for all those who cannot see what should
be painfully obvious). BSD find does not follow them. Neither
does tar, nor does rm -f. 

>Understand that Altos hacked symlinks in after the fact, originally intended
>for their WorkNet setup.  But insofar as I'm concerned, symlinks are a kluge
>anyway:  a useful kluge, but a kluge nonetheless.

Yes, symlinks have warts, but so do hard links.
	
>Unfortunately, I don't have
>the faintest idea what to replace them with.

Nor do I.

>++Brandon
>-- 
>Me: Brandon S. Allbery			    Ham: KB8JRR on 40m, 10m when time
>Internet: allbery@NCoast.ORG		      permits; also 2m, 220, 440, 1200
>America OnLine: KB8JRR // Delphi: ALLBERY   AMPR: kb8jrr.AmPR.ORG [44.70.4.88]
>uunet!usenet.ins.cwru.edu!ncoast!allbery          KB8JRR @ WA8BXN.OH


-- 
		[rbj@uunet 1] stty sane
		unknown mode: sane

brtmac@maverick.ksu.ksu.edu (Brett McCoy) (03/12/91)

In <125283@uunet.UU.NET> rbj@uunet.UU.NET (Root Boy Jim) writes:

>In article <1991Mar8.152932.5242@investor.pgh.pa.us> rbp@investor.pgh.pa.us (Bob Peirce #305) writes:
>>Altos' find does traverse symbolic links...

>Altos' find is broken.

My opinion is that there should be a flag much like the -xdev flag that
tells find whether or not to traverse symbolic links.  I have a lot of
symbolic link directories to allow directories to be in the correct place
in the hierarchy, but allows all of the data to be stashed on another
filesystem that has the room.  Not being able to do a find down into
these directories is a pain to say the least.

--
"I wrote a lisp program once...it wrote back to me." -- unknown
Reality is for people who can't deal with drugs.
Brett McCoy			Computing and Telecommunications Activities
brtmac@maverick.ksu.ksu.edu	Kansas State University

sef@kithrup.COM (Sean Eric Fagan) (03/12/91)

In article <125284@uunet.UU.NET> rbj@uunet.UU.NET (Root Boy Jim) writes:
>In article <1991Mar9.213928.10943@NCoast.ORG> allbery@ncoast.ORG (Brandon S. Allbery KB8JRR) writes:
>>Unfortunately, I don't have
>>the faintest idea what to replace them with.
>Nor do I.

Fine time to talk about Embos, the only OS I've preferred to use over UNIX
(note that that does not mean *program* in; it was written in Pascal, and
things were ugly [imho] because of that).

Embos had a neat filesystem.  Very nice ACL's, with lots of nice features.
They never struck me as being "tacked on," which many systems do.  Anyway,
line some unix systems, Embos had two kinds of links.  I think they were
"aliases" and "equates," although I'm not sure of the name.  Anyway:

One type of "link" was the equivalent of a Unix hard-link.  As files could
cross mount-points, as could links, there was no need for a symbolic link
(as most people use them in bsd unices).

The other type was, well, weird.  It was inheiritable.  That is, like
environment variables, all of your children saw this "link."  For example,
you could do the equivalent of

	% cd
	% csh
	% set termcap = /etc/termcap
	% ls -l termcap
	-rw-rw-r--   1 root     sys       120933 Jun 12 1990 termcap
	% cd /tmp
	% ls -l ~/termcap
	-rw-rw-r--   1 root     sys       120933 Jun 12 1990 ~/termcap
	% exit
	% ls -l termcap
	termcap not found

One of the uses for this was, if a program wanted to write to a logfile, you
could arrange for that logfile to actually be something completely
different.  (I think VMS has something like this, doesn't it?)

Note that one of the bits a program had associated with it (such as
'executable' and 'sticky-text') was 'overide alias' or somesuch:  the
program would get the actual filesystem, not the environment-links.

There have been times when I would have liked this feature in unix...

-- 
Sean Eric Fagan  | "I made the universe, but please don't blame me for it;
sef@kithrup.COM  |  I had a bellyache at the time."
-----------------+           -- The Turtle (Stephen King, _It_)
Any opinions expressed are my own, and generally unpopular with others.