Bug#337474: coreutils: ln -s a b .. creates links to wrong files

2005-11-07 Thread Braun Gabor
On Sat, Nov 05, 2005 at 12:10:25PM -0700, Bob Proulx wrote:
 Thanks for the report.  But what you are seeing is not a bug.

Thanks for your long explanation.  I accept that the behaviour of 'ln -s' is as 
desired and I have misunderstood something.

However, I think that the info documentation should explicitly mention what 
name 
does the created symbolic link refers to.
The improved examples you mentioned suggest this but it would be better 
to also state it.

E.g. in the options section one can write something like:

`--symbolic'
  Make symbolic links instead of hard links.  The symbolic links refer to 
the
  exact name that appeared on the command line as TARGETs.  This option 
merely
  produces an error message on systems that do not support symbolic
  links.


 This new behavior that you are desiring has been suggested before
 and if someone were motivated to write the code, tests and docs for it
 then I am confident that it would be accepted in the upstream project.

I guess the main difficulty is what name should the link refer to.
I do not see any natural solution.

I am sorry for the trouble I have caused.

Best wishes,

Gabor


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#337474: coreutils: ln -s a b .. creates links to wrong files

2005-11-05 Thread Bob Proulx
Braun Gabor wrote:
 The info node ln invocation has this example at the end:
 
 ln -s a b ..  # creates links ../a and ../b pointing to ./a and ./b
 
 I have tried it.  The result: ../a pointing to itself and ../b 
 pointing to itself.  Such self-referencing links are totally 
 useless.

Thanks for the report.  But what you are seeing is not a bug.

Symbolic links are purely linked by name value and nothing more.  The
names in the examples are a and b.  Those are created in the
directory .. and they do point to ./a and ./b.  Not a useful example
but still illustrative of what the command does.  When the target is a
directory the new files (symlinks are special files) created will be
named the same as the source file names.  Each one will hold the value
of the source.

As you reported the example the result is not useful.  However it is
correct.  The upstream documentation that will be in the next Debian
release has been expanded to say this more explicitly.  Here is the
current documentation.

  Examples:

Bad Example:

  # Create link ../a pointing to a in that directory.
  # Not really useful because it points to itself.
  ln -s a ..

Better Example:

  # Change to the target before creating symlinks to avoid being
  # confused.
  cd ..
  ln -s adir/a .

Bad Example:

  # Hard coded file names don't move well.
  ln -s $(pwd)/a /some/dir/

Better Example:

  # Relative file names survive directory moves and also
  # work across networked file systems.
  ln -s afile anotherfile
  ln -s ../adir/afile yetanotherfile

 ln -s a b ..  # creates links ../a and ../b pointing to ./a and ./b
 ...
 I expected that the result is ../a pointing to a in the
 current directory, i.e the directory in which the command was issued.
 Similarly for ../b.

Your expectations were incorrect.  That is not what happens.  That
behavior would be completely different from the traditional behavior
for 'ln' creating symlinks.

This new behavior that you are desiring has been suggested before
and if someone were motivated to write the code, tests and docs for it
then I am confident that it would be accepted in the upstream project.
But until someone does those things it then it does not exist.  In any
case it is not a bug in the current code.  The program is behaving as
it should behave in your case.

 My general experience is that
 
 ln -s relative/path/to/target linkname
 
 interprets the path to target relative to the parent directory of 
 linkname and not relative to the working directory.

That is correct.  You have it the -s option which specifies this
behavior.  It is creating a symbolic (name) translation because of the
presence of the -s option.

 In contrast
 
 ln relative/path/to/file linkname
 
 interprets the path relative to the working directory.

That is correct.  You used it in the default mode which hard links
files.

You are confusing file name linking with file inode linking.  Those
are really to completely different things and are only vaguely
related.  In many ways it is unfortunate that the same 'ln' command
implements both operations.  Really for the jobs they are doing they
should be in two completely different commands.

'cp', 'mv', 'ln', 'rm', 'chmod', etc. all operate on files and the
source arg is relative to the current directory.  Those are the old
commands of the unix system.  They are all mostly consistent on how
they operate.

Symbolic links were developed at Berkeley and came much later.  They
were bolted onto the existing commands.  That is why it requires an
option to 'ln' to create symbolic links.  When the option is specified
it changes the behavior of ln and it now creates symbolic name links
between files instead of hard inode links between files.  The -s
option turns on this mode of operation.

Bob

-- 
Bob Proulx [EMAIL PROTECTED]
http://www.proulx.com/~bob/
CP-ASEL-IA-Tailwheel-Glider


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#337474: coreutils: ln -s a b .. creates links to wrong files

2005-11-04 Thread Braun Gabor
Package: coreutils
Version: 5.2.1-2
Severity: normal

*** Please type your report below this line ***

The info node ln invocation has this example at the end:

ln -s a b ..  # creates links ../a and ../b pointing to ./a and ./b

I have tried it.  The result: ../a pointing to itself and ../b 
pointing to itself.  Such self-referencing links are totally 
useless.

I expected that the result is ../a pointing to a in the
current directory, i.e the directory in which the command was issued.
Similarly for ../b.

My general experience is that

ln -s relative/path/to/target linkname

interprets the path to target relative to the parent directory of 
linkname and not relative to the working directory.
In contrast

ln relative/path/to/file linkname

interprets the path relative to the working directory.

This difference is not documented in the info page and I find it 
confusing and unexpected.

Best wishes,

Gabor Braun

-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (650, 'testing'), (600, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.9.20041228
Locale: LANG=hu_HU.iso88592, LC_CTYPE=hu_HU.iso88592 (charmap=ISO-8859-2) 
(ignored: LC_ALL set to hu_HU.iso88592)

Versions of packages coreutils depends on:
ii  libacl1   2.2.23-1   Access control list shared 
library
ii  libc6 2.3.5-6GNU C Library: Shared libraries 
an

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]