Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 283688 - sys-apps/coreutils-7.4: ln -s creates broken links when using relative paths for target and directory
Summary: sys-apps/coreutils-7.4: ln -s creates broken links when using relative paths ...
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: AMD64 Linux
: High normal (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-04 17:51 UTC by Lisa
Modified: 2009-09-06 12:50 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
'emerge --info' (emergeInfo.txt,3.30 KB, text/plain)
2009-09-05 08:26 UTC, Lisa
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lisa 2009-09-04 17:51:20 UTC
Hi,

basically, when I am in my home directory, making a symbolic link from any directory to any other directory, using relative paths, fails and gives a broken link.
I tried several different ways of creating symlinks and find out  one way where it fails.

Reproducible: Always

Steps to Reproduce:
1.from any non-root directory
2.nano test.txt && mkdir destFolder
3.ln -s test.txt destFolder/

Actual Results:  
This creates a broken link in destFolder.

Expected Results:  
A regular symlink ;)

Like I wrote, i tried several combination of paths. In fact these commands works:

in your home directory:
ln -s ~/test.txt ~/destFolder/

in any other directory:
ln -s ../test.txt ../currentDirectoryName/destFolder/

or any absolute paths...
Comment 1 Wormo (RETIRED) gentoo-dev 2009-09-04 19:05:00 UTC
Interesting problem... please post your 'emerge --info' to assist in reproducing it.
Comment 2 Lisa 2009-09-04 20:25:10 UTC
Hi,

I am very sorry but I don't have any 'emerge --info' since I didn't emerge ln. I am running a stage 3 gentoo and I do not remember having compiled ln as standalone.
Comment 3 Lisa 2009-09-04 21:25:35 UTC
Hi,

I am very sorry but I don't have any 'emerge --info' since I didn't emerge ln. I am running a stage 3 gentoo and I do not remember having compiled ln as standalone.
Comment 4 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2009-09-05 07:18:34 UTC
Please type into a root-console 

  emerge --info

and post the output of that command into this bug report.
Comment 5 Lisa 2009-09-05 08:26:51 UTC
Created attachment 203178 [details]
'emerge --info'
Comment 6 Lisa 2009-09-05 08:30:26 UTC
Comment on attachment 203178 [details]
'emerge --info'

Hi,

here it is...
Comment 7 Peter Alfredsen (RETIRED) gentoo-dev 2009-09-06 12:50:46 UTC
When creating relative symbolic links, the TARGET argument must contain the path of the file you want to point at, relative to the actual placement of the link. In this case, you want to use ln -s ../test.txt destFolder/

From 'man ln':
[...]
SYNOPSIS
       ln [OPTION]... [-T] TARGET LINK_NAME   (1st form)
       ln [OPTION]... TARGET                  (2nd form)
       ln [OPTION]... TARGET... DIRECTORY     (3rd form)
       ln [OPTION]... -t DIRECTORY TARGET...  (4th form)

DESCRIPTION
       In  the  1st  form,  create a link to TARGET with the name LINK_NAME.  In the 2nd form, create a link to TARGET in the current directory.  In the 3rd and 4th forms, create links to each TARGET in DIRECTORY.
       Create hard links by default, symbolic links with --symbolic.  When creating hard links, each TARGET must exist.  Symbolic links can hold arbitrary text; if later resolved, a relative link is interpreted in
       relation to its parent directory.
[...]
Works as designed, in other words.