bug#13409: [patch] make some error messages clearer

2013-01-10 Thread Benno Schulenberg

Hi,

Several error messages in some of the utilities say things
like reading %s.  They sound like progress messages, and
translators might be tempted to translate them as if they
said busy reading %s -- whereas I think they are trying
to say error while reading %s.

Attached patch suggests improvements for a bunch of those
messages.

Regards,

Benno

-- 
http://www.fastmail.fm - mmm... Fastmail...

From 1bb86c6f228f16bd4e15a83bac81f5fe521fe55e Mon Sep 17 00:00:00 2001
From: Benno Schulenberg bensb...@justemail.net
Date: Fri, 4 Jan 2013 22:45:34 +0100
Subject: [PATCH 2/2] textual: improve error messages upon failed read, write, access, close

* src/copy.c: Improve error messages for failing read, write and close.
* src/cp.c: Improve error messages for failing access.
* src/dd.c: Improve error messages for failing read, write and open.
* src/head.c: Improve error message for failing close.
* src/install.c: Improve error messages for failing access.
* src/ln.c: Likewise.
* src/mv.c: Likewise.
* src/touch.c: Improve error message for failing close.
* src/truncate.c: Likewise.
---
 src/copy.c |8 
 src/cp.c   |4 ++--
 src/dd.c   |   12 ++--
 src/head.c |2 +-
 src/install.c  |4 ++--
 src/ln.c   |8 
 src/mv.c   |4 ++--
 src/touch.c|2 +-
 src/truncate.c |2 +-
 9 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/src/copy.c b/src/copy.c
index 0decf9f..664a878 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -165,7 +165,7 @@ sparse_copy (int src_fd, int dest_fd, char *buf, size_t buf_size,
 {
   if (errno == EINTR)
 continue;
-  error (0, errno, _(reading %s), quote (src_name));
+  error (0, errno, _(error reading %s), quote (src_name));
   return false;
 }
   if (n_read == 0)
@@ -203,7 +203,7 @@ sparse_copy (int src_fd, int dest_fd, char *buf, size_t buf_size,
   size_t n = n_read;
   if (full_write (dest_fd, buf, n) != n)
 {
-  error (0, errno, _(writing %s), quote (dst_name));
+  error (0, errno, _(error writing %s), quote (dst_name));
   return false;
 }
 
@@ -1172,13 +1172,13 @@ preserve_metadata:
 close_src_and_dst_desc:
   if (close (dest_desc)  0)
 {
-  error (0, errno, _(closing %s), quote (dst_name));
+  error (0, errno, _(error closing %s), quote (dst_name));
   return_val = false;
 }
 close_src_desc:
   if (close (source_desc)  0)
 {
-  error (0, errno, _(closing %s), quote (src_name));
+  error (0, errno, _(error closing %s), quote (src_name));
   return_val = false;
 }
 
diff --git a/src/cp.c b/src/cp.c
index 231d6a3..a5eb67d 100644
--- a/src/cp.c
+++ b/src/cp.c
@@ -568,7 +568,7 @@ target_directory_operand (char const *file, struct stat *st, bool *new_dst)
   if (err)
 {
   if (err != ENOENT)
-error (EXIT_FAILURE, err, _(accessing %s), quote (file));
+error (EXIT_FAILURE, err, _(failed to access %s), quote (file));
   *new_dst = true;
 }
   return is_a_dir;
@@ -1067,7 +1067,7 @@ main (int argc, char **argv)
 {
   struct stat st;
   if (stat (optarg, st) != 0)
-error (EXIT_FAILURE, errno, _(accessing %s), quote (optarg));
+error (EXIT_FAILURE, errno, _(failed to access %s), quote (optarg));
   if (! S_ISDIR (st.st_mode))
 error (EXIT_FAILURE, 0, _(target %s is not a directory),
quote (optarg));
diff --git a/src/dd.c b/src/dd.c
index 4e35df0..9d8f073 100644
--- a/src/dd.c
+++ b/src/dd.c
@@ -1614,7 +1614,7 @@ skip (int fdesc, char const *file, uintmax_t records, size_t blocksize,
 {
   if (fdesc == STDIN_FILENO)
 {
-  error (0, errno, _(reading %s), quote (file));
+  error (0, errno, _(error reading %s), quote (file));
   if (conversions_mask  C_NOERROR)
 print_stats ();
 }
@@ -1981,7 +1981,7 @@ dd_copy (void)
 
   if (nread  0)
 {
-  error (0, errno, _(reading %s), quote (input_file));
+  error (0, errno, _(error reading %s), quote (input_file));
   if (conversions_mask  C_NOERROR)
 {
   print_stats ();
@@ -2044,7 +2044,7 @@ dd_copy (void)
   w_bytes += nwritten;
   if (nwritten != n_bytes_read)
 {
-  error (0, errno, _(writing %s), quote (output_file));
+  error (0, errno, _(error writing %s), quote (output_file));
   return EXIT_FAILURE;
 }
   else if (n_bytes_read == input_blocksize)
@@ -2107,7 +2107,7 @@ dd_copy (void)
 w_partial++;
   if (nwritten != oc)
 {
-  error (0, errno, _(writing %s), quote (output_file));
+  error (0, errno, _(error writing %s), quote (output_file));
   

bug#13409: [patch] make some error messages clearer

2013-01-10 Thread Paul Eggert
On 01/10/13 11:20, Benno Schulenberg wrote:
 Several error messages in some of the utilities say things
 like reading %s.  They sound like progress messages, and
 translators might be tempted to translate them as if they
 said busy reading %s

-  error (0, errno, _(reading %s), quote (src_name));
+  error (0, errno, _(error reading %s), quote (src_name));

Surely a translator who read the message in context will see
that it's an error message, since 'error' is being called.

I'm not sure we want to change the wording, but if we do change
it I suggest cannot read %s rather than error reading %s,
as the gerunds make the wording less clear.





bug#13410: [patch] tiniest of uniformizations for msgids

2013-01-10 Thread Benno Schulenberg

Hi,

Attached patch moves a newline in the help text of 'ln' to the
next text fragment, so the preceding fragment about backup
methods becomes identical to the ones for 'cp', 'mv', and 'install'.
It means one less msgid for translators.

Regards,

Benno

-- 
http://www.fastmail.fm - A no graphics, no pop-ups email service

From 1874463b2f554378cd2b71f21b3b0fc03f7b116a Mon Sep 17 00:00:00 2001
From: Benno Schulenberg bensb...@justemail.net
Date: Fri, 4 Jan 2013 22:07:49 +0100
Subject: [PATCH 1/2] ln: make a help text fragment identical to three others

* src/ln.c (usage): Move a newline to the next text fragment, so
the preceding fragment about backup methods becomes the same as
the ones for cp, mv, and install.  A bit easier for translators.
---
 src/ln.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/ln.c b/src/ln.c
index e7ab348..8d5e31e 100644
--- a/src/ln.c
+++ b/src/ln.c
@@ -430,9 +430,9 @@ the VERSION_CONTROL environment variable.  Here are the values:\n\
   numbered, t make numbered backups\n\
   existing, nil   numbered if numbered backups exist, simple otherwise\n\
   simple, never   always make simple backups\n\
-\n\
 ), stdout);
   printf (_(\
+\n\
 Using -s ignores -L and -P.  Otherwise, the last option specified controls\n\
 behavior when a TARGET is a symbolic link, defaulting to %s.\n\
 ), LINK_FOLLOWS_SYMLINKS ? -L : -P);
-- 
1.7.0.4



bug#13410: [patch] tiniest of uniformizations for msgids

2013-01-10 Thread Pádraig Brady

On 01/10/2013 07:23 PM, Benno Schulenberg wrote:

 From 1874463b2f554378cd2b71f21b3b0fc03f7b116a Mon Sep 17 00:00:00 2001
From: Benno Schulenbergbensb...@justemail.net
Date: Fri, 4 Jan 2013 22:07:49 +0100
Subject: [PATCH 1/2] ln: make a help text fragment identical to three others


Pushed with the commit summary adjusted to the following,
since the change makes no functional change to ln:

  doc: make a --help text fragment identical to three others

thanks!
Pádraig.





bug#13409: [patch] make some error messages clearer

2013-01-10 Thread Pádraig Brady

On 01/10/2013 07:20 PM, Benno Schulenberg wrote:


Hi,

Several error messages in some of the utilities say things
like reading %s.  They sound like progress messages, and
translators might be tempted to translate them as if they
said busy reading %s -- whereas I think they are trying
to say error while reading %s.

Attached patch suggests improvements for a bunch of those
messages.


Even outside the translation context, this is a net improvement.

cmd_old: accessing 'file': Permission denied
cmd_new: failed to access 'file': Permission denied

I'll apply this in a while.

thanks!
Pádraig.





bug#13409: [patch] make some error messages clearer

2013-01-10 Thread Jim Meyering
Paul Eggert wrote:

 On 01/10/13 11:20, Benno Schulenberg wrote:
 Several error messages in some of the utilities say things
 like reading %s.  They sound like progress messages, and
 translators might be tempted to translate them as if they
 said busy reading %s

 -  error (0, errno, _(reading %s), quote (src_name));
 +  error (0, errno, _(error reading %s), quote (src_name));

 Surely a translator who read the message in context will see
 that it's an error message, since 'error' is being called.

 I'm not sure we want to change the wording, but if we do change
 it I suggest cannot read %s rather than error reading %s,
 as the gerunds make the wording less clear.

Hi Paul,

I prefer to avoid cannot in new diagnostics, because its semantics
are a not as clear as failed to, e.g.,

-  error (0, errno, _(reading %s), quote (src_name));
+  error (0, errno, _(failed to read %s), quote (src_name));

To some, cannot might suggest not allowed to, whereas failed to
has no such ambiguity.





bug#13409: [patch] make some error messages clearer

2013-01-10 Thread Paul Eggert
On 01/10/13 13:40, Jim Meyering wrote:
 -  error (0, errno, _(reading %s), quote (src_name));
 +  error (0, errno, _(failed to read %s), quote (src_name));

Yes, that's fine too.  It also avoids the gerund.

A terser possibility, which I've used elsewhere,
is something like this:

  error (0, errno, _(%s: read failed), quotearg_colon (src_name));





bug#13409: [patch] make some error messages clearer

2013-01-10 Thread Jim Meyering
Paul Eggert wrote:
 On 01/10/13 13:40, Jim Meyering wrote:
 -  error (0, errno, _(reading %s), quote (src_name));
 +  error (0, errno, _(failed to read %s), quote (src_name));

 Yes, that's fine too.  It also avoids the gerund.

 A terser possibility, which I've used elsewhere,
 is something like this:

   error (0, errno, _(%s: read failed), quotearg_colon (src_name));

If all else were equal, I'd have a slight preference for your wording,
but while the diagnostic itself is 3 bytes shorter, the overall line
length is 14 bytes longer than the original:

1  error (0, errno, _(reading %s), quote (src_name));
2  error (0, errno, _(failed to read %s), quote (src_name));
3  error (0, errno, _(%s: read failed), quotearg_colon (src_name));

and the new name, quotearg_colon may require inclusion of quotearg.h.
The problem is that standard use of error is getting too long, and
a naive conversion would lead to split lines and a decrease in readability.

This makes me want a two-argument wrapper to be used like this:

  wwarn (_(%s: read failed), src_name);

That seems more readable, and would not induce any line splitting.
(we can't use warn, so I made up wwarn)
We'd also have to adjust the syntax-checking rules that examine
diagnostics in the string arguments of error calls.