Bug 15776 – symlink documentation wrong: "Relative paths are relative to the current working directory"

Status
NEW
Severity
enhancement
Priority
P4
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-03-07T06:42:30Z
Last change time
2024-12-01T16:26:14Z
Assigned to
No Owner
Creator
Timothee Cour
Moved to GitHub: phobos#10165 →

Comments

Comment #0 by timothee.cour2 — 2016-03-07T06:42:30Z
doc says, for symlink(original, link): Relative paths are relative to the current working directory, not the files being linked to or from. it should be: link is relative to cwd (if relative), original is relative to link (if relative), so that in the example below: buildPath(link.dirName, original).buildNormalizedPath =buildPath(`d01/pz2.txt`.dirName, `../z2.txt`).buildNormalizedPath =`z2.txt` = actual location of original wrt cwd, which is != original. (and this is still valid for directory symlinks) Perhaps renaming original to original_wrt_link would make this more obvious tree . ├── d01 └── z2.txt std.file.symlink(`../z2.txt`, `d01/pz2.txt`) . ├── d01 │   └── pz2.txt -> ../z2.txt └── z2.txt
Comment #1 by timothee.cour2 — 2016-03-07T07:21:22Z
(In reply to Timothee Cour from comment #0) > doc says, for symlink(original, link): > > Relative paths are relative to the current working directory, not the files > being linked to or from. > > it should be: > link is relative to cwd (if relative), original is relative to link (if > relative), so that in the example below: > > buildPath(link.dirName, original).buildNormalizedPath > =buildPath(`d01/pz2.txt`.dirName, `../z2.txt`).buildNormalizedPath > =`z2.txt` = actual location of original wrt cwd, which is != original. > (and this is still valid for directory symlinks) > Perhaps renaming original to original_wrt_link would make this more obvious > > > tree > . > ├── d01 > └── z2.txt > > std.file.symlink(`../z2.txt`, `d01/pz2.txt`) > > . > ├── d01 > │   └── pz2.txt -> ../z2.txt > └── z2.txt Also, docs should specify precisely what happens when link ends with a '/'
Comment #2 by ag0aep6g — 2016-03-07T10:05:49Z
(In reply to Timothee Cour from comment #0) > doc says, for symlink(original, link): > > Relative paths are relative to the current working directory, not the files > being linked to or from. > > it should be: > link is relative to cwd (if relative), original is relative to link (if > relative), so that in the example below: Already addressed by <https://github.com/D-Programming-Language/phobos/pull/3966>. See <http://dlang.org/phobos-prerelease/std_file.html#.symlink> for the new documentation. (In reply to Timothee Cour from comment #1) > Also, docs should specify precisely what happens when link ends with a '/' This is still undocumented.
Comment #3 by robert.schadek — 2024-12-01T16:26:14Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10165 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB