bug#13665: Question about the translation of double_to_human
On 02/09/2013 08:45 PM, Paul Eggert wrote: On 02/09/2013 11:26 AM, Pádraig Brady wrote: These are function names and not to be translated. These are "developer debug" strings, which I'm tempted to remove entirely. Certainly "simple_strtod_human:\n" should not be translated, as it's referring to the identifier. Since the source code is written in English, we can safely assume developers read English, so there's no point to translating messages intended only for developers. Both factor and numfmt recently introduced devel debug messages, enabled by --verbose and ---devdebug respectively. I've cleaned this up in the attached so that both use the same method to output the messages, and both now enable these messages with the the same ---debug option. Also translations are removed from these messages, and a syntax check added to stop future translations sneaking in in future. thanks, Pádraig. >From d64515e1c198fb58ff40116b58912e76f3a177e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Sun, 10 Feb 2013 12:47:23 + Subject: [PATCH] maint: consolidate developer debug messages Both factor and numfmt recently introduced debug messages for developers enabled by --verbose and ---devdebug respectively. There were a few issues though: 1. They used different mechanisms to enable these messages. 2. factor used --verbose which might be needed for something else 3. They used different methods to output the messages, and numfmt used error() which added an unwanted newline 4. numfmt marked all these messages for translation and factor marked a couple. We really don't need these translated. So we fix the above issues here while renaming the enabling option for both commands to ---debug (still undocumented). * src/factor.c (verbose): Rename to dev_debug and change from int to bool as it's just a toggle flag. (long_options): Rename --verbose to ---debug. * src/system.h (devmsg): A new inline function to output a message if enabled by a global dev_debug variable in the compilation unit. * src/numfmt.c: Use devmsg() rather than error(). Also remove the translation tags from these messages. Also change debug flag to bool from int. * tests/misc/numfmt.pl: Adjust for the ---devdebug to ---debug change. * cfg.mk (sc_marked_devdiagnostics): Add a syntax check to ensure translations are not added to devmsg calls. --- cfg.mk |7 +++ src/factor.c | 37 ++--- src/numfmt.c | 104 ++ src/system.h | 15 +++ tests/misc/numfmt.pl | 22 +- 5 files changed, 83 insertions(+), 102 deletions(-) diff --git a/cfg.mk b/cfg.mk index fbc64b4..09858a1 100644 --- a/cfg.mk +++ b/cfg.mk @@ -521,6 +521,13 @@ sc_THANKS_in_duplicates: && { echo '$(ME): remove the above names from THANKS.in' \ 1>&2; exit 1; } || : +# Look for developer diagnostics that are marked for translation. +# This won't find any for which devmsg's format string is on a separate line. +sc_marked_devdiagnostics: + @prohibit='\> 1) == t1) { - debug ("[%s]", _("using single-precision arithmetic")); + devmsg ("[using single-precision arithmetic] "); print_factors_single (t1, t0); return true; } @@ -2416,7 +2405,7 @@ print_factors (const char *input) } #if HAVE_GMP - debug ("[%s]", _("using arbitrary-precision arithmetic")); + devmsg ("[using arbitrary-precision arithmetic] "); mpz_t t; struct mp_factors factors; @@ -2502,8 +2491,8 @@ main (int argc, char **argv) { switch (c) { -case VERBOSE_OPTION: - verbose = 1; +case DEV_DEBUG_OPTION: + dev_debug = true; break; case 's': diff --git a/src/numfmt.c b/src/numfmt.c index e42cbf8..f7c8e5e 100644 --- a/src/numfmt.c +++ b/src/numfmt.c @@ -136,7 +136,7 @@ static struct option const longopts[] = {"delimiter", required_argument, NULL, 'd'}, {"field", required_argument, NULL, FIELD_OPTION}, {"debug", no_argument, NULL, DEBUG_OPTION}, - {"-devdebug", no_argument, NULL, DEV_DEBUG_OPTION}, + {"-debug", no_argument, NULL, DEV_DEBUG_OPTION}, {"header", optional_argument, NULL, HEADER_OPTION}, {"format", required_argument, NULL, FORMAT_OPTION}, {"invalid", required_argument, NULL, INVALID_OPTION}, @@ -188,10 +188,10 @@ static uintmax_t header = 0; /* Debug for users: print warnings to STDERR about possible error (similar to sort's debug). */ -static int debug = 0; +static bool debug; -/* debugging for developers - to be removed in final version? */ -static int dev_debug = 0; +/* debugging for developers. Enables devmsg(). */ +bool dev_debug = false; /* will be set according to the current locale. */ static const char *decimal_point; @@ -583,18 +583,16 @@ simple_strtod_human (const char *input_str, /* 'scale_auto' is checked below. */ int scale_base = default_scale_base (allowed_sc
bug#13665: Question about the translation of double_to_human
On 02/10/2013 05:28 PM, Pádraig Brady wrote: > I've cleaned this up in the attached so that both use the same > method to output the messages, and both now enable these messages > with the the same ---debug option. > Also translations are removed from these messages, > and a syntax check added to stop future translations sneaking in in future. Great work, thanks. Minor nit: > diff --git a/cfg.mk b/cfg.mk > index fbc64b4..09858a1 100644 > --- a/cfg.mk > +++ b/cfg.mk > @@ -521,6 +521,13 @@ sc_THANKS_in_duplicates: > && { echo '$(ME): remove the above names from THANKS.in'\ > 1>&2; exit 1; } || : > > +# Look for developer diagnostics that are marked for translation. > +# This won't find any for which devmsg's format string is on a separate line. > +sc_marked_devdiagnostics: > + @prohibit='\ + halt='found marked developer diagnostic(s)' \ > + $(_sc_search_regexp) > + Shouldn't it be this pattern instead? - @prohibit='\
bug#13680: [patch] numfmt: do not gettextize developer debugging messages
Hi, The new command numfmt includes a bunch of debugging messages that are only meant for the developers. They shouldn't be gettextized. Offering things up for translation which are only for developers is a waste of translators' time. Attached patch fixes this. Regards, Benno -- http://www.fastmail.fm - The way an email service should be From 9de8dd37bcc0af2bd702113a04349eebb09ef0c7 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 10 Feb 2013 19:02:04 +0100 Subject: [PATCH 1/3] doc: do not gettextize debugging messages meant for developers * src/numfmt.c: Remove the call to gettext() around developer messages. --- src/numfmt.c | 46 +++--- 1 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/numfmt.c b/src/numfmt.c index e42cbf8..117f19b 100644 --- a/src/numfmt.c +++ b/src/numfmt.c @@ -584,8 +584,8 @@ simple_strtod_human (const char *input_str, int scale_base = default_scale_base (allowed_scaling); if (dev_debug) -error (0, 0, _("simple_strtod_human:\n input string: '%s'\n " - "locale decimal-point: '%s'\n"), input_str, decimal_point); +error (0, 0, "simple_strtod_human:\n input string: '%s'\n " + "locale decimal-point: '%s'\n", input_str, decimal_point); enum simple_strtod_error e = simple_strtod_float (input_str, endptr, value, precision); @@ -593,8 +593,8 @@ simple_strtod_human (const char *input_str, return e; if (dev_debug) -error (0, 0, _(" parsed numeric value: %Lf\n" - " input precision = %d\n"), *value, (int)*precision); +error (0, 0, " parsed numeric value: %Lf\n" + " input precision = %d\n", *value, (int)*precision); if (**endptr != '\0') { @@ -620,7 +620,7 @@ simple_strtod_human (const char *input_str, scale_base = 1024; (*endptr)++; /* skip second ('i') suffix character. */ if (dev_debug) -error (0, 0, _(" Auto-scaling, found 'i', switching to base %d\n"), +error (0, 0, " Auto-scaling, found 'i', switching to base %d\n", scale_base); } @@ -638,14 +638,14 @@ simple_strtod_human (const char *input_str, long double multiplier = powerld (scale_base, power); if (dev_debug) -error (0, 0, _(" suffix power=%d^%d = %Lf\n"), +error (0, 0, " suffix power=%d^%d = %Lf\n", scale_base, power, multiplier); /* TODO: detect loss of precision and overflows. */ (*value) = (*value) * multiplier; if (dev_debug) -error (0, 0, _(" returning value: %Lf (%LG)\n"), *value, *value); +error (0, 0, " returning value: %Lf (%LG)\n", *value, *value); return e; } @@ -696,7 +696,7 @@ double_to_human (long double val, int precision, enum scale_type scale, int group, enum round_type round) { if (dev_debug) -error (0, 0, _("double_to_human:\n")); +error (0, 0, "double_to_human:\n"); if (scale == scale_none) { @@ -707,7 +707,7 @@ double_to_human (long double val, int precision, if (dev_debug) error (0, 0, (group) ? - _(" no scaling, returning (grouped) value: %'.*Lf\n") : + " no scaling, returning (grouped) value: %'.*Lf\n" : _(" no scaling, returning value: %.*Lf\n"), precision, val); int i = snprintf (buf, buf_size, (group) ? "%'.*Lf" : "%.*Lf", @@ -725,7 +725,7 @@ double_to_human (long double val, int precision, unsigned int power = 0; val = expld (val, scale_base, &power); if (dev_debug) -error (0, 0, _(" scaled value to %Lf * %0.f ^ %d\n"), +error (0, 0, " scaled value to %Lf * %0.f ^ %d\n", val, scale_base, power); /* Perform rounding. */ @@ -755,7 +755,7 @@ double_to_human (long double val, int precision, /* && (absld (val) > simple_round_floor (val))) */ if (dev_debug) -error (0, 0, _(" after rounding, value=%Lf * %0.f ^ %d\n"), +error (0, 0, " after rounding, value=%Lf * %0.f ^ %d\n", val, scale_base, power); snprintf (buf, buf_size, (show_decimal_point) ? "%.1Lf%s" : "%.0Lf%s", @@ -765,7 +765,7 @@ double_to_human (long double val, int precision, strncat (buf, "i", buf_size - strlen (buf) - 1); if (dev_debug) -error (0, 0, _(" returning value: '%s'\n"), buf); +error (0, 0, " returning value: '%s'\n", buf); return; } @@ -1013,9 +1013,9 @@ parse_format_string (char const *fmt) } if (dev_debug) -error (0, 0, _("format String:\n input: %s\n grouping: %s\n" - " padding width: %ld\n alignment: %s\n" - " prefix: '%s'\n suffix: '%s'\n"), +error (0, 0, "format String:\n input: %s\n grouping: %s\n" + " padding width: %ld\n alignment: %s\n" + " prefix: '%s'\n suffix: '%s'\n", quote (fmt), (grouping) ? "yes" : "no", padding_
bug#13681: [patches] numfmt: standardize synopsis and docstring, and slice up helptext
Hi, The synopsis of numfmt currently says: Usage: %s [OPTIONS] [NUMBER] But multiple numbers are allowed, and a single option too, so it should read: Usage: %s [OPTION]... [NUMBER]... Further, the command description says: Reformat NUMBER(s) from stdin or command arguments. This is double, because the NUMBER(s) already are the command arguments. Furthermore, it is usual to refer to "standard input", in full, not with the abbreviation. Also, several of the option descriptions start with an uppercase letter, some not. It is customary to start with a lowercase one, and also to not use a period at the end, and a semicolon if there is needed for multiple phrases. Since now all of the descriptions change, the attached patch takes the opportunity to slice the big help text (which is a nuisance for translators) into strings that encompass a single option. (This follows the preference of the vast majority of translators. Sami Kerola, who does a lot of work on util-linux, conducted a small but telling survey: http://www.spinics.net/lists/util-linux-ng/msg07489.html) Regards, Benno -- http://www.fastmail.fm - Does exactly what it says on the tin From 590c544d02ceecb30f5ac72e77e603a415ad8b6e Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 10 Feb 2013 19:16:02 +0100 Subject: [PATCH 2/3] doc: standardize the synopsis and docstring of command 'numfmt' * src/numfmt.c: Correct synopsis and make command description clearer. --- src/numfmt.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/numfmt.c b/src/numfmt.c index 117f19b..f8593c8 100644 --- a/src/numfmt.c +++ b/src/numfmt.c @@ -810,10 +810,10 @@ usage (int status) else { printf (_("\ -Usage: %s [OPTIONS] [NUMBER]\n\ +Usage: %s [OPTION]... [NUMBER]...\n\ "), program_name); fputs (_("\ -Reformat NUMBER(s) from stdin or command arguments.\n\ +Reformat NUMBER(s), or the numbers from standard input if none are specified.\n\ "), stdout); emit_mandatory_arg_note (); fputs (_("\ -- 1.7.0.4 From edb80a6e50138d0c9a6ebc38ff85dce0af25662c Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 10 Feb 2013 19:42:02 +0100 Subject: [PATCH 3/3] doc: standardize helptext of numfmt and slice into single options * src/numfmt.c: Start option descriptions with lowercase letter; use semicolon instead of period where needed; indent continuation lines; gettextize single options for ease of translation and maintenance. --- src/numfmt.c | 131 +- 1 files changed, 75 insertions(+), 56 deletions(-) diff --git a/src/numfmt.c b/src/numfmt.c index f8593c8..f99ebb8 100644 --- a/src/numfmt.c +++ b/src/numfmt.c @@ -817,86 +817,106 @@ Reformat NUMBER(s), or the numbers from standard input if none are specified.\n\ "), stdout); emit_mandatory_arg_note (); fputs (_("\ - --from=UNIT auto-scale input numbers to UNITs. Default is 'none'.\n\ - See UNIT below.\n\ - --from-unit=N specify the input unit size (instead of the default 1).\n\ - --to=UNIT auto-scale output numbers to UNITs.\n\ - See UNIT below.\n\ - --to-unit=N the output unit size (instead of the default 1).\n\ - --round=METHOD the rounding method to use when scaling. METHOD can be:\n\ + --from=UNIT auto-scale input numbers to UNITs; default is 'none';\n\ +see UNIT below\n\ +"), stdout); + fputs (_("\ + --from-unit=N specify the input unit size (instead of the default 1)\n\ +"), stdout); + fputs (_("\ + --to=UNIT auto-scale output numbers to UNITs; see UNIT below\n\ +"), stdout); + fputs (_("\ + --to-unit=N the output unit size (instead of the default 1)\n\ +"), stdout); + fputs (_("\ + --round=METHOD the rounding method to use when scaling; METHOD can be:\n\ up, down, from-zero (default), towards-zero, nearest\n\ +"), stdout); + fputs (_("\ --suffix=SUFFIX add SUFFIX to output numbers, and accept optional SUFFIX\n\ - in input numbers.\n\ - --padding=N pad the output to N characters.\n\ - Positive N will right-aligned. Negative N will left-align.\n\ - Note: if the output is wider than N, padding is ignored.\n\ - Default is to automatically pad if whitespace is found.\n\ - --grouping group digits together (e.g. 1,000,000).\n\ - Uses the locale-defined grouping (i.e. have no effect\n\ - in C/POSIX locales).\n\ - --header[=N]print (without converting) the first N header lines.\n\ - N defaults to 1 if not specified.\n\ +in input numbers\n\ +"), stdout); + fputs (_("\ + --padding=N pad the output to N characters;\n\ +positive N will right-aligned; negative N will left-align;\n\ +note: if the output is wider than N, padding
bug#13680: [patch] numfmt: do not gettextize developer debugging messages
On 02/10/2013 06:55 PM, Benno Schulenberg wrote: Hi, The new command numfmt includes a bunch of debugging messages that are only meant for the developers. They shouldn't be gettextized. Offering things up for translation which are only for developers is a waste of translators' time. Attached patch fixes this. Thanks Benno, There is a more general patch proposed for this. http://bugs.gnu.org/13665 thanks, Pádraig.
bug#13681: [patches] numfmt: standardize synopsis and docstring, and slice up helptext
On 02/10/2013 07:10 PM, Benno Schulenberg wrote: Hi, The synopsis of numfmt currently says: Usage: %s [OPTIONS] [NUMBER] But multiple numbers are allowed, and a single option too, so it should read: Usage: %s [OPTION]... [NUMBER]... Further, the command description says: Reformat NUMBER(s) from stdin or command arguments. This is double, because the NUMBER(s) already are the command arguments. Furthermore, it is usual to refer to "standard input", in full, not with the abbreviation. Also, several of the option descriptions start with an uppercase letter, some not. It is customary to start with a lowercase one, and also to not use a period at the end, and a semicolon if there is needed for multiple phrases. Since now all of the descriptions change, the attached patch takes the opportunity to slice the big help text (which is a nuisance for translators) into strings that encompass a single option. (This follows the preference of the vast majority of translators. Sami Kerola, who does a lot of work on util-linux, conducted a small but telling survey: http://www.spinics.net/lists/util-linux-ng/msg07489.html) Thanks very much Benno. I'll apply this for the upcoming release. Pádraig.
bug#13665: Question about the translation of double_to_human
On 02/10/2013 05:15 PM, Bernhard Voelker wrote: On 02/10/2013 05:28 PM, Pádraig Brady wrote: I've cleaned this up in the attached so that both use the same method to output the messages, and both now enable these messages with the the same ---debug option. Also translations are removed from these messages, and a syntax check added to stop future translations sneaking in in future. Great work, thanks. Minor nit: diff --git a/cfg.mk b/cfg.mk index fbc64b4..09858a1 100644 --- a/cfg.mk +++ b/cfg.mk @@ -521,6 +521,13 @@ sc_THANKS_in_duplicates: && { echo '$(ME): remove the above names from THANKS.in'\ 1>&2; exit 1; } || : +# Look for developer diagnostics that are marked for translation. +# This won't find any for which devmsg's format string is on a separate line. +sc_marked_devdiagnostics: + @prohibit='\ Shouldn't it be this pattern instead? - @prohibit='\ Well that wouldn't catch: devmsg ("[%s]", _("blah")); And: do we need to reference Goeran's message to the ML? Already amended locally :) thanks, Pádraig.
bug#13681: [patches] numfmt: standardize synopsis and docstring, and slice up helptext
On Sun, Feb 10, 2013, at 21:01, Pádraig Brady wrote: > I'll apply this for the upcoming release. Thanks. Just to be sure: this will require a pre3, if translations are meant (where possible) to be complete. Oh, and one small overlooked typo still: -"positive N will right-aligned;" +"positive N will right-align;" Benno -- http://www.fastmail.fm - Send your email first class
bug#13681: [patches] numfmt: standardize synopsis and docstring, and slice up helptext
On 02/10/2013 09:34 PM, Benno Schulenberg wrote: > > On Sun, Feb 10, 2013, at 21:01, Pádraig Brady wrote: >> I'll apply this for the upcoming release. > > Thanks. Just to be sure: this will require a pre3, if translations > are meant (where possible) to be complete. > > Oh, and one small overlooked typo still: > -"positive N will right-aligned;" > +"positive N will right-align;" Thank you. Besides fixing a few too long lines (to silence make syntax-check), I have also sorted the options alphabetically and improved the indentation for short/long options, plus 2 spaces between the options and the description. I changed a few option descriptions. I hope this is okay for you. Furthermore, I've also sorted the options in the texinfo documentation. While already there, I fixed the style to have a double-blank after periods. I'll push tomorrow unless I receive further comments. Have a nice day, Berny numfmt-usage.patch.xz Description: application/xz
bug#13537: [PATCH] delaying dd allocation
On 02/10/2013 10:35 PM, Bernhard Voelker wrote: On 01/23/2013 11:48 AM, Ondrej Oprala wrote: Hi Bernhard, thanks for the remarks. Also, you were right about the corner case, the succession of commands $ touch a $ dd if=a seek=1 bs=1 $ ^D actually caused a segfault. Sorry, I didn't notice it before. I added a few lines to alloc_obuf, which cover the case when the initial ibuf allocation is skipped but obuf needs to be allocated and is to be set to ibuf and removed the newly redundant check before memset. Thanks, Ondrej Hi Padraig, I'm afraid this one slipped from my/our list. ;-/ AFAIR that last patch was okay, but we should have a look on it again. Do you think we should include it in 8.21? It has not slipped from my radar, though I thought I has responded with my plans for that, sorry. There is a whole class of heap allocation avoidance bugs that I intend to merge/address early in the next cycle. This dd one, one for head (13530), one for split (13537). thanks, Pádraig.
bug#13681: [patches] numfmt: standardize synopsis and docstring, and slice up helptext
On 02/10/2013 10:11 PM, Bernhard Voelker wrote: On 02/10/2013 09:34 PM, Benno Schulenberg wrote: On Sun, Feb 10, 2013, at 21:01, Pádraig Brady wrote: I'll apply this for the upcoming release. Thanks. Just to be sure: this will require a pre3, if translations are meant (where possible) to be complete. Oh, and one small overlooked typo still: -"positive N will right-aligned;" +"positive N will right-align;" Thank you. Besides fixing a few too long lines (to silence make syntax-check), I have also sorted the options alphabetically and improved the indentation for short/long options, plus 2 spaces between the options and the description. I changed a few option descriptions. I hope this is okay for you. Furthermore, I've also sorted the options in the texinfo documentation. While already there, I fixed the style to have a double-blank after periods. I'll push tomorrow unless I receive further comments. +1 thanks! Pádraig.
bug#13681: [patches] numfmt: standardize synopsis and docstring, and slice up helptext
On 02/11/2013 02:42 AM, Pádraig Brady wrote: > On 02/10/2013 10:11 PM, Bernhard Voelker wrote: >> I'll push tomorrow unless I receive further comments. > > +1 Thanks, pushed: http://git.sv.gnu.org/cgit/coreutils.git/commit/?id=b5f45b64 Marking as done. Have a nice day, Berny