GNU bug report logs - #18054
Problematic translation strings in coreutils 8.22‏

Previous Next

Package: coreutils;

Reported by: Sebastian Rasmussen <sebras <at> hotmail.com>

Date: Sat, 19 Jul 2014 00:05:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18054 in the body.
You can then email your comments to 18054 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#18054; Package coreutils. (Sat, 19 Jul 2014 00:05:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sebastian Rasmussen <sebras <at> hotmail.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Sat, 19 Jul 2014 00:05:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Sebastian Rasmussen <sebras <at> hotmail.com>
To: "bug-coreutils <at> gnu.org" <bug-coreutils <at> gnu.org>
Subject: Problematic translation strings in coreutils 8.22‏ 
Date: Fri, 18 Jul 2014 23:48:10 +0200
Hi!
 
When reviewing the Swedish translation of coreutils I noticed the pecular string
"failed to %s supplemental groups" which (because the contents of %s were
unclear) prompted me to look at the source of coreutils. The %s used in this string
is expanded to either "set" or "clear" but neither of those strings are enclosed by
the _() translation macro.
 
Once saw this I looked for further instances where the translation macro was
used in a strange way and I found the instance in gl/lib/randread.c. In the
.pot-file only "%s: end of file" is present and "%s: read error" is left untranslated.
The reason for this is that the translation macro _() in this instance contains
a ternary expression and only the first string will be parsed and offered for
translation. To fix this I propose to first evaluate the expression and only
then apply the translation macro.
 
Below I provide you with a proposed patch (applying on top of git HEAD).
Applying this patch makes the strings "set" and "clear" appear in the .pot-file
and "%s: read error" be mentioned for lib/randread.c too. I hope the patch
will help you in sorting out this minor issue. Thanks for an excellent set of utilities!
 
 / Sebastian
 
 
 
From 1333c446baefe31ebe25a1c18cd8f64a0c122516 Mon Sep 17 00:00:00 2001
From: Sebastian Rasmussen <sebras <at> hotmail.com>
Date: Wed, 16 Jul 2014 20:58:12 +0200
Subject: [PATCH] maint: fix two translation message issues
 
* gl/lib/randread.c (randread_error): xgettext can not handle translation
  strings containing C-expressions, so use the translation macro _() only
  for the real strings after the ternary expression has been evaluated.
* src/chroot.c (main): Two condtional error strings were untranslated.
---
 gl/lib/randread.c | 2 +-
 src/chroot.c      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
 
diff --git a/gl/lib/randread.c b/gl/lib/randread.c
index a073cab..af85653 100644
--- a/gl/lib/randread.c
+++ b/gl/lib/randread.c
@@ -125,7 +125,7 @@ randread_error (void const *file_name)
 {
   if (file_name)
     error (exit_failure, errno,
-           _(errno == 0 ? "%s: end of file" : "%s: read error"),
+           errno == 0 ? _("%s: end of file") : _("%s: read error"),
            quotearg_colon (file_name));
   abort ();
 }
diff --git a/src/chroot.c b/src/chroot.c
index fff0b53..963f66b 100644
--- a/src/chroot.c
+++ b/src/chroot.c
@@ -393,7 +393,7 @@ main (int argc, char **argv)
 
   if ((uid_set (uid) || groups) && setgroups (n_gids, gids) != 0)
     error (EXIT_CANCELED, errno, _("failed to %s supplemental groups"),
-           gids ? "set" : "clear");
+           gids ? _("set") : _("clear"));
 
   free (in_gids);
   free (out_gids);
-- 
2.0.1 		 	   		  

Information forwarded to bug-coreutils <at> gnu.org:
bug#18054; Package coreutils. (Sat, 19 Jul 2014 00:23:02 GMT) Full text and rfc822 format available.

Message #8 received at 18054 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Sebastian Rasmussen <sebras <at> hotmail.com>
Cc: 18054 <at> debbugs.gnu.org
Subject: Re: bug#18054: Problematic translation strings in coreutils 8.22‏
Date: Sat, 19 Jul 2014 01:22:29 +0100
On 07/18/2014 10:48 PM, Sebastian Rasmussen wrote:
> Hi!
>  
> When reviewing the Swedish translation of coreutils I noticed the pecular string
> "failed to %s supplemental groups" which (because the contents of %s were
> unclear) prompted me to look at the source of coreutils. The %s used in this string
> is expanded to either "set" or "clear" but neither of those strings are enclosed by
> the _() translation macro.
>  
> Once saw this I looked for further instances where the translation macro was
> used in a strange way and I found the instance in gl/lib/randread.c. In the
> .pot-file only "%s: end of file" is present and "%s: read error" is left untranslated.
> The reason for this is that the translation macro _() in this instance contains
> a ternary expression and only the first string will be parsed and offered for
> translation. To fix this I propose to first evaluate the expression and only
> then apply the translation macro.
>  
> Below I provide you with a proposed patch (applying on top of git HEAD).
> Applying this patch makes the strings "set" and "clear" appear in the .pot-file
> and "%s: read error" be mentioned for lib/randread.c too. I hope the patch
> will help you in sorting out this minor issue. Thanks for an excellent set of utilities!
>  
>  / Sebastian

Excellent attention to detail.
The patch looks great. The only change I'll make is to s/maint:/doc:/
in the commit summary.

thanks!
Pádraig.






Information forwarded to bug-coreutils <at> gnu.org:
bug#18054; Package coreutils. (Sat, 19 Jul 2014 01:42:02 GMT) Full text and rfc822 format available.

Message #11 received at 18054 <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: Sebastian Rasmussen <sebras <at> hotmail.com>, 18054 <at> debbugs.gnu.org
Subject: Re: bug#18054: Problematic translation strings in coreutils 8.22‏
Date: Fri, 18 Jul 2014 19:41:32 -0600
[Message part 1 (text/plain, inline)]
On 07/18/2014 03:48 PM, Sebastian Rasmussen wrote:

>  
>    if ((uid_set (uid) || groups) && setgroups (n_gids, gids) != 0)
>      error (EXIT_CANCELED, errno, _("failed to %s supplemental groups"),
> -           gids ? "set" : "clear");
> +           gids ? _("set") : _("clear"));

This is not good; there may be languages where the translation context
around "set" is different than around "clear".  Better is:

error (EXIT_CANCELED, errno,
       gids ? _("failed to set supplemental groups") :
           _("failed to clear supplemental groups"));

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#18054; Package coreutils. (Sat, 19 Jul 2014 09:43:02 GMT) Full text and rfc822 format available.

Message #14 received at 18054 <at> debbugs.gnu.org (full text, mbox):

From: Sebastian Rasmussen <sebras <at> hotmail.com>
To: "18054 <at> debbugs.gnu.org" <18054 <at> debbugs.gnu.org>
Subject: RE: bug#18054: Problematic translation strings in coreutils 8.22‏
Date: Sat, 19 Jul 2014 11:41:58 +0200
>Excellent attention to detail.
>The patch looks great. The only change I'll make is to s/maint:/doc:/
>in the commit summary.

Oh, ok. It wasn't clear from a quick git log how you usually do this,
but I'll update that.

>> if ((uid_set (uid) || groups) && setgroups (n_gids, gids) != 0)
>> error (EXIT_CANCELED, errno, _("failed to %s supplemental groups"),
>> - gids ? "set" : "clear");
>> + gids ? _("set") : _("clear"));
>
> This is not good; there may be languages where the translation context
> around "set" is different than around "clear".

True, I aimed for making the change as small as I possibly could (I haven't
contributed to coreutils before so I'm unware if you prefer minimalistic
patches or not :) ). But you are of course completely correct.

I provide an updated patch below, I hope I got the indentation correct,
otherwise please correct it for me. Thanks!

 / Sebastian



From f293a9006aa199fe5970c74744ea8db5aa6da70d Mon Sep 17 00:00:00 2001
From: Sebastian Rasmussen <sebras <at> hotmail.com>
Date: Wed, 16 Jul 2014 20:58:12 +0200
Subject: [PATCH] doc: fix two translation message issues

* gl/lib/randread.c (randread_error): xgettext can not handle translation
  strings containing C-expressions, so use the translation macro _() only
  for the real strings after the ternary expression has been evaluated.
* src/chroot.c (main): a translated error string had optional parts
  selected by a ternary expression which were left untranslated, evaluate
  the expression first and then have both resulting strings be translated.
---
 gl/lib/randread.c | 2 +-
 src/chroot.c      | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/gl/lib/randread.c b/gl/lib/randread.c
index a073cab..af85653 100644
--- a/gl/lib/randread.c
+++ b/gl/lib/randread.c
@@ -125,7 +125,7 @@ randread_error (void const *file_name)
 {
   if (file_name)
     error (exit_failure, errno,
-           _(errno == 0 ? "%s: end of file" : "%s: read error"),
+           errno == 0 ? _("%s: end of file") : _("%s: read error"),
            quotearg_colon (file_name));
   abort ();
 }
diff --git a/src/chroot.c b/src/chroot.c
index fff0b53..aa191ba 100644
--- a/src/chroot.c
+++ b/src/chroot.c
@@ -392,8 +392,9 @@ main (int argc, char **argv)
 #endif
 
   if ((uid_set (uid) || groups) && setgroups (n_gids, gids) != 0)
-    error (EXIT_CANCELED, errno, _("failed to %s supplemental groups"),
-           gids ? "set" : "clear");
+    error (EXIT_CANCELED, errno,
+           gids ? _("failed to set supplemental groups") :
+           _("failed to clear supplemental groups"));
 
   free (in_gids);
   free (out_gids);
-- 
2.0.1
 		 	   		  

Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Sat, 19 Jul 2014 14:59:02 GMT) Full text and rfc822 format available.

Notification sent to Sebastian Rasmussen <sebras <at> hotmail.com>:
bug acknowledged by developer. (Sat, 19 Jul 2014 14:59:03 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Sebastian Rasmussen <sebras <at> hotmail.com>, 18054-done <at> debbugs.gnu.org
Subject: Re: bug#18054: Problematic translation strings in coreutils 8.22‏
Date: Sat, 19 Jul 2014 07:57:56 -0700
[Message part 1 (text/plain, inline)]
Thanks, I pushed the attached slightly-simpler patch.
[0001-maint-fix-message-translation-glitches.patch (text/plain, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#18054; Package coreutils. (Sat, 19 Jul 2014 15:46:02 GMT) Full text and rfc822 format available.

Message #22 received at 18054 <at> debbugs.gnu.org (full text, mbox):

From: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: 18054 <at> debbugs.gnu.org, eggert <at> cs.ucla.edu, sebras <at> hotmail.com
Subject: Re: bug#18054: Problematic translation strings in coreutils 8.22‏
Date: Sat, 19 Jul 2014 17:45:06 +0200
On 07/19/2014 04:57 PM, Paul Eggert wrote:
> From: Paul Eggert <eggert <at> cs.ucla.edu>
> [...]
> Problem reported by Sebastian Rasmussen in: http://bugs.gnu.org/18054

This feels wrong.
As Padraig often said, we should encourage people to contribute
to the coreutils project.  So if someone provides a rough idea
or a loose diff, we'd usually add an entry in THANKS.in, and if
the contributor even took the effort to provide a clean patch,
then we should commit in his/her name.
This will encourage them to continue with further contributions.

Thanks & have a nice day,
Berny




Information forwarded to bug-coreutils <at> gnu.org:
bug#18054; Package coreutils. (Sat, 19 Jul 2014 16:21:02 GMT) Full text and rfc822 format available.

Message #25 received at 18054 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Bernhard Voelker <mail <at> bernhard-voelker.de>
Cc: 18054 <at> debbugs.gnu.org, Paul Eggert <eggert <at> cs.ucla.edu>, sebras <at> hotmail.com
Subject: Re: bug#18054: Problematic translation strings in coreutils 8.22
Date: Sat, 19 Jul 2014 09:19:38 -0700
On Sat, Jul 19, 2014 at 8:45 AM, Bernhard Voelker
<mail <at> bernhard-voelker.de> wrote:
> On 07/19/2014 04:57 PM, Paul Eggert wrote:
>> From: Paul Eggert <eggert <at> cs.ucla.edu>
>> [...]
>> Problem reported by Sebastian Rasmussen in: http://bugs.gnu.org/18054
>
> This feels wrong.
> As Padraig often said, we should encourage people to contribute
> to the coreutils project.  So if someone provides a rough idea
> or a loose diff, we'd usually add an entry in THANKS.in, and if
> the contributor even took the effort to provide a clean patch,
> then we should commit in his/her name.
> This will encourage them to continue with further contributions.

I agree.  Thank you for articulating that.




Information forwarded to bug-coreutils <at> gnu.org:
bug#18054; Package coreutils. (Sat, 19 Jul 2014 17:08:01 GMT) Full text and rfc822 format available.

Message #28 received at 18054 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Bernhard Voelker <mail <at> bernhard-voelker.de>, 18054 <at> debbugs.gnu.org, 
 sebras <at> hotmail.com
Subject: Re: bug#18054: Problematic translation strings in coreutils 8.22‏
Date: Sat, 19 Jul 2014 10:07:30 -0700
This one's not that simple, since the patch is trivial and I didn't 
commit it as stated, but a somewhat different patch.

These days I think THANKS.in is a waste of time, to be honest.  I 
typically forget it and I would rather deprecate it.  I put 
acknowledgments into commit logs, which are copied into the ChangeLog 
file in the distribution, and that's way better thanks than some long 
list that nobody reads anyway.  We should not update THANKS.in except 
for the case where someone helped but didn't get acknowledged in the 
ChangeLog, a case that should be rare now.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 17 Aug 2014 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 275 days ago.

Previous Next


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