GNU bug report logs - #13742
Is this soft link directory bug?

Previous Next

Package: coreutils;

Reported by: Taroe90 <taroe90 <at> gmail.com>

Date: Mon, 18 Feb 2013 05:37:02 UTC

Severity: normal

Tags: moreinfo, notabug

Done: Bob Proulx <bob <at> proulx.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 13742 in the body.
You can then email your comments to 13742 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#13742; Package coreutils. (Mon, 18 Feb 2013 05:37:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Taroe90 <taroe90 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Mon, 18 Feb 2013 05:37:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Taroe90 <taroe90 <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: Is this soft link directory bug?
Date: Mon, 18 Feb 2013 11:26:42 +0800
[Message part 1 (text/plain, inline)]
Hi,
sorry for my poor english

ping <at> ping-kubuntu:~/mywork/test/shell/ln/a$ ll
总用量 8
drwxrwxr-x 2 ping ping 4096 2月 18 11:23 ./
drwxrwxr-x 3 ping ping 4096 2月 18 11:22 ../
ping <at> ping-kubuntu:~/mywork/test/shell/ln/a$ ln -fs
/home/ping/mywork/test/shell/ln/a /home/ping/mywork/test/shell/ln/b
ping <at> ping-kubuntu:~/mywork/test/shell/ln/a$ ll
总用量 8
drwxrwxr-x 2 ping ping 4096 2月 18 11:23 ./
drwxrwxr-x 3 ping ping 4096 2月 18 11:22 ../
lrwxrwxrwx 1 ping ping 33 2月 18 11:23 a ->
/home/ping/mywork/test/shell/ln/a/
ping <at> ping-kubuntu:~/mywork/test/shell/ln/a$ cd ..
ping <at> ping-kubuntu:~/mywork/test/shell/ln$ ll
总用量 12
drwxrwxr-x 3 ping ping 4096 2月 18 11:22 ./
drwxr-xr-x 9 ping ping 4096 2月 18 10:57 ../
drwxrwxr-x 2 ping ping 4096 2月 18 11:23 a/
lrwxrwxrwx 1 ping ping 33 2月 18 11:22 b ->
/home/ping/mywork/test/shell/ln/a/
ping <at> ping-kubuntu:~/mywork/test/shell/ln$

Why in a directory will appear a soft link?
using absolute path.



[Message part 2 (text/html, inline)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#13742; Package coreutils. (Mon, 18 Feb 2013 18:20:02 GMT) Full text and rfc822 format available.

Message #8 received at 13742 <at> debbugs.gnu.org (full text, mbox):

From: Bob Proulx <bob <at> proulx.com>
To: Taroe90 <taroe90 <at> gmail.com>
Cc: 13742 <at> debbugs.gnu.org
Subject: Re: bug#13742: Is this soft link directory bug?
Date: Mon, 18 Feb 2013 11:18:20 -0700
tag 13742 + moreinfo notabug
close 13742
thanks

Taroe90 wrote:
> sorry for my poor english

Please do not worry.  But there are questions.

> ping <at> ping-kubuntu:~/mywork/test/shell/ln/a$ ll

What is the "ll" command?  And alias for "ls -l"?  Or an alias for
"ls -lF"?  Or something different?

> 总用量 8
> drwxrwxr-x 2 ping ping 4096 2月 18 11:23 ./
> drwxrwxr-x 3 ping ping 4096 2月 18 11:22 ../
> ping <at> ping-kubuntu:~/mywork/test/shell/ln/a$ ln -fs /home/ping/mywork/test/shell/ln/a /home/ping/mywork/test/shell/ln/b

What is the value of /home/ping/mywork/test/shell/ln/b before this
command?

If /home/ping/mywork/test/shell/ln/b does not exist then this will
create a symlink.

If /home/ping/mywork/test/shell/ln/b is a directory then it will
create a symlink within the target directory.

If /home/ping/mywork/test/shell/ln/b is itself already a symink then
if it already points to an existing directory then it will create a
new symlink within the existing directory.

If /home/ping/mywork/test/shell/ln/b exists then an error message will
be produce saying that the file exists and the command will exit non-zero.

> ping <at> ping-kubuntu:~/mywork/test/shell/ln/a$ ll
> 总用量 8
> drwxrwxr-x 2 ping ping 4096 2月 18 11:23 ./
> drwxrwxr-x 3 ping ping 4096 2月 18 11:22 ../
> lrwxrwxrwx 1 ping ping 33 2月 18 11:23 a -> /home/ping/mywork/test/shell/ln/a/

The above symlink value ends with a trailing "/".  The "ll" command is
not known.  If it is "ls -lF" then the trailing slash is produced by
the -F part.  If not then it is part of the value.  And if so then the
above "a" symlink was not produced by the previous "ln" command shown
but was created using a different command.

It is no problem to have /home/ping/mywork/test/shell/ln/a/a be a
symlink to /home/ping/mywork/test/shell/ln/a.  This is allowed.

It is no problem to have /home/ping/mywork/test/shell/ln/a/a be a
symlink to /home/ping/mywork/test/shell/ln/a/.  This is allowed.  The
trailing slash forces the value to be interpreted as a directory.

> ping <at> ping-kubuntu:~/mywork/test/shell/ln/a$ cd ..
> ping <at> ping-kubuntu:~/mywork/test/shell/ln$ ll
> 总用量 12
> drwxrwxr-x 3 ping ping 4096 2月 18 11:22 ./
> drwxr-xr-x 9 ping ping 4096 2月 18 10:57 ../
> drwxrwxr-x 2 ping ping 4096 2月 18 11:23 a/
> lrwxrwxrwx 1 ping ping 33 2月 18 11:22 b -> /home/ping/mywork/test/shell/ln/a/

The "b" symlink points to "a".  Creating a new symlink with a target
directory of "b" will follow the symlink into the "a" directory.

Simpler with shorter paths.

  $ mkdir a
  $ ln -s a b     # <-- Creates "b" symink to "a"
  $ ln -s a b     # <-- Creates "a/a" symlink due to existence of "b"

To avoid using portable syntax.  (Okay for System V systems [HP-UX, others].)

  $ mkdir a
  $ ln -s a b     # <-- Creates "b" symink to "a"
  $ rm -f b       # <-- Removes "b" before creating second symlink
  $ ln -s a b     # <-- Creates "a/a" symlink due to existence of "b"

To avoid using BSD or GNU specific syntax.

  $ mkdir a
  $ ln -s a b     # <-- Creates "b" symink to "a"
  $ ln -sfn a b   # <-- Creates "b" ignoring existing, ignoring symlink

> Why in a directory will appear a soft link?
> using absolute path.

It will appear because the existing symlink points to an existing
directory.

Please see the -n option.  Here is the documentation from the ln command.

  `-n'
  `--no-dereference'
     Do not treat the last operand specially when it is a symbolic link
     to a directory.  Instead, treat it as if it were a normal file.

     When the destination is an actual directory (not a symlink to one),
     there is no ambiguity.  The link is created in that directory.
     But when the specified destination is a symlink to a directory,
     there are two ways to treat the user's request.  `ln' can treat
     the destination just as it would a normal directory and create the
     link in it.  On the other hand, the destination can be viewed as a
     non-directory--as the symlink itself.  In that case, `ln' must
     delete or backup that symlink before creating the new link.  The
     default is to treat a destination that is a symlink to a directory
     just like a directory.

     This option is weaker than the `--no-target-directory' (`-T')
     option, so it has no effect if both options are given.

Bob




Added tag(s) notabug and moreinfo. Request was from Bob Proulx <bob <at> proulx.com> to control <at> debbugs.gnu.org. (Mon, 18 Feb 2013 18:20:03 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 13742 <at> debbugs.gnu.org and Taroe90 <taroe90 <at> gmail.com> Request was from Bob Proulx <bob <at> proulx.com> to control <at> debbugs.gnu.org. (Mon, 18 Feb 2013 18:20:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-coreutils <at> gnu.org:
bug#13742; Package coreutils. (Mon, 18 Feb 2013 18:47:01 GMT) Full text and rfc822 format available.

Message #15 received at 13742 <at> debbugs.gnu.org (full text, mbox):

From: Bob Proulx <bob <at> proulx.com>
To: Taroe90 <taroe90 <at> gmail.com>
Cc: 13742 <at> debbugs.gnu.org
Subject: Re: bug#13742: Is this soft link directory bug?
Date: Mon, 18 Feb 2013 11:44:58 -0700
Bob Proulx wrote:
> Simpler with shorter paths.
> 
>   $ mkdir a
>   $ ln -s a b     # <-- Creates "b" symink to "a"
>   $ ln -s a b     # <-- Creates "a/a" symlink due to existence of "b"
> 
> To avoid using portable syntax.  (Okay for System V systems [HP-UX, others].)
> 
>   $ mkdir a
>   $ ln -s a b     # <-- Creates "b" symink to "a"
>   $ rm -f b       # <-- Removes "b" before creating second symlink
>   $ ln -s a b     # <-- Creates "a/a" symlink due to existence of "b"

My comment above is a mistake.  This following comment is wrong.

>   $ ln -s a b     # <-- Creates "a/a" symlink due to existence of "b"

That should read:

  $ mkdir a
  $ ln -s a b     # <-- Creates "b" symink to "a"
  $ rm -f b       # <-- Removes "b" before creating second symlink
  $ ln -s a b     # <-- Creates "b" symlink to "a" due to no prior "b"

Sorry for the mistake in that comment.

Bob




Information forwarded to bug-coreutils <at> gnu.org:
bug#13742; Package coreutils. (Tue, 19 Feb 2013 07:52:02 GMT) Full text and rfc822 format available.

Message #18 received at 13742 <at> debbugs.gnu.org (full text, mbox):

From: Bob Proulx <bob <at> proulx.com>
To: Taroe90 <taroe90 <at> gmail.com>
Cc: 13742 <at> debbugs.gnu.org
Subject: Re: bug#13742: Is this soft link directory bug?
Date: Tue, 19 Feb 2013 00:49:57 -0700
Taroe90 wrote:
> 于 2013年02月19日 02:18, Bob Proulx 写道:
> >>ping <at> ping-kubuntu:~/mywork/test/shell/ln/a$ ll
> >
> >What is the "ll" command?  And alias for "ls -l"?  Or an alias for
> >"ls -lF"?  Or something different?
>
> alias ll='ls -alF'

Okay.  The -F is what added that trailing '/' and now we know it
wasn't part of the symlink value.  Thanks!

> thx for you help, now I know how to do it!

Very good.  Thanks for letting us know!

Bob




Information forwarded to bug-coreutils <at> gnu.org:
bug#13742; Package coreutils. (Wed, 20 Feb 2013 06:11:01 GMT) Full text and rfc822 format available.

Message #21 received at 13742 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Taroe90 <taroe90 <at> gmail.com>
Cc: 13742 <at> debbugs.gnu.org
Subject: Re: bug#13742: Is this soft link directory bug?
Date: Tue, 19 Feb 2013 22:09:15 -0800
I don't know why you got the behavior you describe.
My guess is that you have a command 'ln' that is
not exactly the same as GNU coreutils 'ln'.  The
fact that you have a command 'll' suggests that you
have wrappers or aliases or something, and 'ln' may
be one of those.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 20 Mar 2013 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 97 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.