I think the older version was incomplete or even wrong on this point.
recent:
-r, --relative
with -s, create links relative to link location
-s, --symbolic
make symbolic links instead of hard links
vs old:
-r, --relative
create symbolic links relative to link location
-s, --symbolic
make symbolic links instead of hard links
Without -s, hard links are created, I presume - this was not so explicit in the older version.
But I just read, did not test the behavior or differences between them. I can’t imagine that the behavior actually changed.
Make symbolic links relative to the link location. This option is only valid with the --symbolic option.
Example:
ln -srv /a/file /tmp
'/tmp/file' -> '../a/file'
Relative symbolic links are generated based on their canonicalized containing directory, and canonicalized targets. I.e., all symbolic links in these file names will be resolved. See realpath: Print the resolved file name., which gives greater control over relative file name generation
Yes I shared that link above and it must be noted that the man page for ln (latest or not) doesn’t mention this resolving which is the main issue. The side issue and curiosity for me is at the end of that sentence:
Is anyone able to show what is meant above in plain english. I’m just not familiar with some of the syntax, are they trying to say using [-r] is equivalent to using a realpath command to extract the canonical/resolved filepath? If so, how does that help toward “greater control over relative file name generation”? If anything control is taken away. To give greater control the canonicalizing/resolving would be separated out into another option (eg. -c --canonicalize(?) or -R --resolve(?))
As it stands there is an inconsistency here. When making a normal symlink (not relative) there is no canonicalizing, when asking to make a relative symlink, the developers chose to ALSO canonicalize. I’m totally ok with this. Either:
a) this behavior must be documented in the man pages that Manjaro gets, not just for lucky Linux Mint users (on this occasion), it should make clear that relative symlinks can be done manually without -r, as explained by the solution by @anon51566685, or b) the canonicalizing/resolving is not done for relative symlinks (consistent with normal links) but the option to is separated out to a -c --canonicalize option (an issue for other devs) c) the canonicalizing/resolving is done for normal symlinks too (consistency) but there is an option to NOT resolve, possibly -R --no-resolve(?) or -C --no-canonicalize(?) (again an issue for other devs)
My preference is simply (a), documentation explaining what is going on and why. I believe resolving was done for convenience/optimization, not greater control, but would love to be proven wrong.
Please stop dreaming for a second. There is no mention about any resolving anywhere in docs, no matter distro. It’s the word I used. If you want to change docs, then open a new issue at coreutils.
I posted a link to GNU documentation in post #12 and nobody seemed to have read/understood it, so I reposted link again with a quote in post #26 dealing with original topic question
/usr/share/man/man1/ln.1.gz is provided by package coreutils, that is inherited from Arch
So if you want changes made to the manpage you would need to contact Arch package maintainer Arch Linux - coreutils 9.5-1 (x86_64)
IMO the major inconsistency here is that there is no information about the use-case for these symlinks. I suspect that creating relative symbolic links might be the Y part of an XY problem and there may be another way to deal with the underlying X part
The man page for ln comes unchanged from GNU Coreutils source distribution. If you think there is a bug in that documentation then report it to the GNU Coreutils project.
Its settled, the a), b), c) proposals with a link to this thread will make it to coreutils. The motivation is obviously to prevent this confusion happening to others. I actaully don’t use email. Is there a good temp email server out there that I can use? Just DM it, no gafam or cloudflare, please. The one I normally would use is down atm and that makes me sad.
If anyone is compelled to submit this on my behalf please email the following to bug-coreutils@gnu.org with subject Symlinks to symlinks inconsistency and confusion
Hello, I've submitted this on behalf of someone whose temp email service is not working. They say:
Symlinks that are made with the [-r --relative] option, have the added side-effect of resolving (or canonicalizing). This is not mentioned in the man page, but it *is* mentioned here with a somewhat confusing code example that is supposed to show how the side-effect gives "greater control" to the user.
https://www.gnu.org/software/coreutils/manual/html_node/ln-invocation.html
Please see this thread as to how I, as a hobbyist (gnu)linux user and privacy advocate, struggled.
https://forum.manjaro.org/t/symlinks-to-symlinks/149596
No one in the forum was able to explain the benefit of this inconsistent side-effect.
There are three ways to resolve this:
a) this behavior be documented in the man page, making clear that relative symlinks can be done manually without -r, as explained by the solution in the forum thread,
b) the canonicalizing/resolving is not done for relative symlinks (consistent with normal links) but the option to is separated out to a -c --canonicalize(?) option, or
c) the canonicalizing/resolving is done for normal symlinks too (consistency) but there is an option to NOT resolve, possibly -R --no-resolve(?) or -C --no-canonicalize(?)
My preference is simply (a), documentation explaining what is going on and why. I believe resolving was done for convenience/optimization, not "greater control", but would love to be proven wrong. :)
A --no-canonicalize -C flag makes sense if we want the --relative option to be useful in more use-cases but that is almost a feature request, rather than a bug.
Thanks greatly for your work
Aqita
a) fix man page, or
b) and c) are about altering the behavior for consistency, regarding either b) creating relative symlinks (to match what I might call “absolute symlink” creation), or c) altering the making of “absolute” ones (to match ‘relative’).
Finally I suggest adding a helpful --no-canonicalize option to extend functionality of the --relative option to suit the simple symlink-to-symlink use-case.
Please tell us when above is emailed to coreutils@gnu.org, I’m sure that they will understand and appreciate it.