unpacked sources and ln

Bill's LFS Login lfsbill at nospam.dot
Sat Nov 15 13:55:38 PST 2003


On Sat, 15 Nov 2003, Kevin Alm wrote:

> On Saturday 15 November 2003 12:05 pm, Richard A Downing FBCS wrote:
> > On Sat, 15 Nov 2003 11:54:22 -0600
> ><snip>

> > > the last command says
> > > ln -sf gcc /tools/bin/cc
> > > I dont know that much about symlinks but it appears the me that
> > > if I delete the gcc-3.3.1 and the gcc-build directory, then the
> > > symlink will cease to exist.
> > >
> > > Can someone help me w/ this?
> >
> > Yes.
> > You need to read the 'man ln' carefully.  But it is a good
> > question.
> >
> > A symlink is just a piece of text that is interpreted by the
> > system in whatever context it's in at the time.  So if you put a
> > symlink in /tools/bin/cc containing the text 'gcc' it will
> > interpret that as /tools/bin/gcc since it will be 'looking' in
> > /tools/bin when it finds it. The context you are 'in' when you
> > create the link is not significant.  This is a hard one to grasp,
> > I agree.
> ><snip>

> That aspect of the ln command threw me too. Personally, I think it's a bad
> idea as it breaks with the linux convention of defaulting to the pwd. It
> looks like you're creating a link a file in the current directory. Instead
> you're linking to a file in the target directory. Confusing.

It's only a bad idea until you've used it a few times and 1) get
comfortable with it, and 2) see how much it can save you in "cd"
commands. As to "convention" of defaulting to the cwd, that always
depends on the command being issued. For example,

    ln -sf gcc cc

does default to the cwd. So nothing is broken re "conventions". But
another "convention" is that "full pathnames RULE". :)  Since we provide
a full path name for the *target* (the name being *created*) it would be
broken to force the created symlink to point to *somewhere else* unless
we specified it to be so.

All very "natural" to me (now), but I also "stumbled" on it when it was
first introduced to me (didn't everybody?).

-- 
Bill Maltby
lfsbillATwlmcsDOTcom
Fix line above & use it to mail me direct.



More information about the lfs-support mailing list