unpacked sources and ln

Kevin Alm kevinalm at shenessex.heartland.net
Sat Nov 15 12:50:00 PST 2003

On Saturday 15 November 2003 12:05 pm, Richard A Downing FBCS wrote:
> On Sat, 15 Nov 2003 11:54:22 -0600
> <liquid.ism at verizon.net> wrote:
> > I've looked through the FAQ and I didnt see anything to help me
> > there(I think).  I want to know if its ok to delete the
> > unpacked sources after issuing the commands to install the
> > package.  But sometimes I see command to create symlinks that
> > "appear"(Im not completly sure)to link a file thats in the
> > source/build directory.  If I delete that, then it would work
> > right?  Heres an example... In the first pass of installing GCC
> > http://lfs.130th.net/lfs/view/stable/chapter05/gcc-pass1.html
> > 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.
> The book is good on this - trust the book.
> (Jeroen, I've had to explain this twice this week.  Can we put
> something in the FAQ? The other guy was a 20 year Unix vet!)
> --
> Cheers, Richard
> Richard A Downing FBCS
> Anyone  sending  unwanted  advertising   e-mail
> to this address will be charged $25 for network
> traffic and computing time.   By  extracting my
> address from  this  message or its  header, you
> agree to these terms.
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.

More information about the lfs-support mailing list