Re: Strange behaviour of ln

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

 



On 25Aug2015 08:34, Paolo Galtieri <pgaltieri@xxxxxxxxx> wrote:
On 08/24/2015 02:19 PM, Cameron Simpson wrote:
On 24Aug2015 13:55, Paolo Galtieri <pgaltieri@xxxxxxxxx> wrote:
Symlinks are strings resolved with respect to the directory in which
the symlink exists.

So the example above "Test/afile" => "Test/afile2" makes a symlink _in_ the directory "Test" named "afile2" pointing at "Test/afile". Therefore it tries to access the path "Test/Test/afile", which fails as one might expect.

When making a symbolic link it needs to either be (a) an absolute path or (b) relative WRT to the directory hodling the link. For the latter, the reliable way is to cd to the directory and make in from inside. That way command line filename completion prodcues working results.
[...]

 thank you for your reply.  As it turns out the ln command

ln -s Test/afile Test/afile1

does create the link.

Of course it does. It is just a string. You can put pretty much anything you like in there.

The problem as you noted is the ls command.

No, the problem is that the string in the symlink is _wrong_. "ls" is behaving correctly. What you have put in the symlink is wrong, because it does not correctly point at the target file.

You can either manually construct a correct symlink (suggestions above) or if you have GNU ln (true on Fedora) use the -r option to have it figure this out for you.

Cheers,
Cameron Simpson <cs@xxxxxxxxxx>
--
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux