bug-coreutils
[Top][All Lists]
Advanced

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

Re: ln -s Bug?


From: Andreas Schwab
Subject: Re: ln -s Bug?
Date: Thu, 01 Nov 2007 18:27:17 +0100
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.1 (gnu/linux)

Marcus Nutzinger <address@hidden> writes:

> But if I do the same, just with the -s option to create a symlink, the
> following happens:
>
> $ ls -l
> drwx------ 2 nuuz nuuz 4,0K 2007-11-01 15:13 dir
> -rw------- 1 nuuz nuuz    0 2007-11-01 15:13 file
> $ ln -s file dir/
> $ ls -l dir
> lrwxrwxrwx 1 nuuz nuuz 1 2007-11-01 15:14 file -> file
>
> So "file" points to itself and not to "../file" as I would expect it
> after creating the link.

A symbolic link is just that: symbolic.  The symlink target is merely a
string that is interpreted only at the time the symlink is followed,
other than that it has no inherent meaning at all.  It does not even
have to point to a valid file name, if you never try to follow the
symlink you can put any kind of interpretation on the name of the
target.  For example, you can use a symlink as a kind of lock, encoding
the owner pid into its target name.

Andreas.

-- 
Andreas Schwab, SuSE Labs, address@hidden
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




reply via email to

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