GNU bug report logs - #6516
[patch] improving error messages for when 'ln' fails

Previous Next

Package: coreutils;

Reported by: "Benno Schulenberg" <bensberg <at> justemail.net>

Date: Sat, 26 Jun 2010 13:21:01 UTC

Severity: normal

Tags: patch

Done: Jim Meyering <jim <at> meyering.net>

Bug is archived. No further changes may be made.

Full log


Message #10 received at 6516-done <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: "Benno Schulenberg" <bensberg <at> justemail.net>
Cc: 6516-done <at> debbugs.gnu.org
Subject: Re: bug#6516: [patch] improving error messages for when 'ln' fails
Date: Sun, 27 Jun 2010 10:05:50 +0200
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)




This bug report was last modified 15 years and 29 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.