Subject: bug#6516: closed (Re: bug#6516: [patch] improving error messages for when 'ln' fails)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 27 Jun 2010 08:07:02 +0000

Your bug report

#6516: [patch] improving error messages for when 'ln' fails

which was filed against the coreutils package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
6516: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6516
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#6516: [patch] improving error messages for when 'ln' fails
From: Jim Meyering <[email-masked]>
To: "Benno Schulenberg" <[email-masked]>
Cc: [email-masked]
Date: Sun, 27 Jun 2010 10:05:50 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Benno Schulenberg wrote:
> Trying to make a link that already exists, 'ln' prints a message that
> is slightly confusing, especially when using '-v' and thus expexting
> a progress message.  For example:
>
> $ ln -sv bash /bin/sh
> ln: creating symbolic link '/bin/sh': File exists
>
> The 'creating..." seems to say that the link is being created.
> The message would be clearer in the following form:
>
> ln: cannot create symbolic link '/bin/sh': File exists
...

Thanks.  I've changed s/cannot/failed to/ and applied it.

  $ ./ln ln /xx
  ./ln: failed to create hard link `/xx' => `ln': Invalid cross-device link
  [Exit 1]

> Subject: [PATCH] ln: print a clearer error message when linking fails
>
> ---
>  src/ln.c |   10 +++++-----
>  1 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/src/ln.c b/src/ln.c
> index 8612afe..bd5f361 100644
> --- a/src/ln.c
> +++ b/src/ln.c
> @@ -304,14 +304,14 @@ do_link (const char *source, const char *dest)
>        error (0, errno,
>               (symbolic_link
>                ? (errno != ENAMETOOLONG && *source
> -                 ? _("creating symbolic link %s")
> -                 : _("creating symbolic link %s -> %s"))
> +                 ? _("cannot create symbolic link %s")
> +                 : _("cannot create symbolic link %s -> %s"))
>                : (errno == EMLINK && !source_is_dir
> -                 ? _("creating hard link to %.0s%s")
> +                 ? _("cannot create hard link to %.0s%s")
>                   : (errno == EDQUOT || errno == EEXIST || errno == ENOSPC
>                      || errno == EROFS)
> -                 ? _("creating hard link %s")
> -                 : _("creating hard link %s => %s"))),
> +                 ? _("cannot create hard link %s")
> +                 : _("cannot create hard link %s => %s"))),
>               quote_n (0, dest), quote_n (1, source));
>
>        if (dest_backup)

Subject: [patch] improving error messages for when 'ln' fails
From: "Benno Schulenberg" <[email-masked]>
To: [email-masked]
Date: Sat, 26 Jun 2010 12:21:08 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

Trying to make a link that already exists, 'ln' prints a message that
is slightly confusing, especially when using '-v' and thus expexting
a progress message.  For example:

$ ln -sv bash /bin/sh
ln: creating symbolic link '/bin/sh': File exists

The 'creating..." seems to say that the link is being created.
The message would be clearer in the following form:

ln: cannot create symbolic link '/bin/sh': File exists

Attached patch makes this change.

Regards,

Benno

-- 
http://www.fastmail.fm - Faster than the air-speed velocity of an
                          unladen european swallow

From 05939f3bf8907f9ae9f36d72e521d934c49daf37 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <[email-masked]>
Date: Sat, 26 Jun 2010 12:00:42 +0200
Subject: [PATCH] ln: print a clearer error message when linking fails

---
 src/ln.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/ln.c b/src/ln.c
index 8612afe..bd5f361 100644
--- a/src/ln.c
+++ b/src/ln.c
@@ -304,14 +304,14 @@ do_link (const char *source, const char *dest)
       error (0, errno,
              (symbolic_link
               ? (errno != ENAMETOOLONG && *source
-                 ? _("creating symbolic link %s")
-                 : _("creating symbolic link %s -> %s"))
+                 ? _("cannot create symbolic link %s")
+                 : _("cannot create symbolic link %s -> %s"))
               : (errno == EMLINK && !source_is_dir
-                 ? _("creating hard link to %.0s%s")
+                 ? _("cannot create hard link to %.0s%s")
                  : (errno == EDQUOT || errno == EEXIST || errno == ENOSPC
                     || errno == EROFS)
-                 ? _("creating hard link %s")
-                 : _("creating hard link %s => %s"))),
+                 ? _("cannot create hard link %s")
+                 : _("cannot create hard link %s => %s"))),
              quote_n (0, dest), quote_n (1, source));
 
       if (dest_backup)
-- 
1.6.3.3