Subject: Re: bug#47703: Mention if ln -s needs -r, or ln -r needs -s

From: Pádraig Brady <[email-masked]>
Date: Sun, 11 Apr 2021 15:21:19 +0100

On 09/04/2021 12:46, 積丹尼 Dan Jacobson wrote:
> man ln says:
> 
>         -r, --relative
>                create symbolic links relative to link location
> 
>         -s, --symbolic
>                make symbolic links instead of hard links
> 
> Does -s need -r,
> or   -r need -s?
> 
> Hard to tell from the man page.
> 
> Had to find out the 'hard' way.
> 
> Please mention the answer on the man page.

Fair point.
Will address with the attached.
Marking this as done.

thanks,
Pádraig
>From 572b74dd5f6d672eecd8b43e5eab443744fbc090 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email-masked]>
Date: Sun, 11 Apr 2021 15:17:02 +0100
Subject: [PATCH] doc: clarify that ln --relative requires --symbolic to be
 specified

* doc/coreutils.texi (ln invocation): State --symbolic is required.
* src/ln.c (usage): Explicitly state -s is not implied.
Fixes https://bugs.gnu.org/47703
---
 doc/coreutils.texi | 1 +
 src/ln.c           | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index e53c0de6e..acc1841fa 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -10584,6 +10584,7 @@ link will be the same as if a hard link had been created.
 @opindex -r
 @opindex --relative
 Make symbolic links relative to the link location.
+This option is only valid with the @option{--symbolic} option.
 
 Example:
 
diff --git a/src/ln.c b/src/ln.c
index d0319ef4e..9974d9647 100644
--- a/src/ln.c
+++ b/src/ln.c
@@ -447,7 +447,7 @@ interpreted in relation to its parent directory.\n\
   -n, --no-dereference        treat LINK_NAME as a normal file if\n\
                                 it is a symbolic link to a directory\n\
   -P, --physical              make hard links directly to symbolic links\n\
-  -r, --relative              create symbolic links relative to link location\n\
+  -r, --relative              with -s, create links relative to link location\n\
   -s, --symbolic              make symbolic links instead of hard links\n\
 "), stdout);
       fputs (_("\
-- 
2.26.2