bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] Option --gen-pot loses a letter when splitting long strin


From: Aharon Robbins
Subject: Re: [bug-gawk] Option --gen-pot loses a letter when splitting long strings
Date: Sat, 04 Oct 2014 23:22:20 +0300
User-agent: Heirloom mailx 12.5 6/20/10

Hi.  Re this:

> From: Bert Bos <address@hidden>
> Date: Sat, 4 Oct 2014 03:02:16 +0200
> To: address@hidden
> Subject: [bug-gawk] Option --gen-pot loses a letter when splitting long
>       strings
>
> When using `gawk --gen-pot' to generate a message catalog, strings
> that are longer than 70 characters are broken over two lines in the
> output. However, the 70th character itself disappears.
>
> E.g., with this Awk program in file tmp.awk:
>
> {print _"This string is so long that gawk --gen-pot will break it and lose a 
> letter at the break."}
>
> running `gawk --gen-pot' produces:
>
> #: tmp.awk:1
> msgid "This string is so long that gawk --gen-pot will break it and lose a "
> "etter at the break."
> msgstr ""
>
> Note the missing "l" from "letter". This occurs with at least:
>
>   - gawk 4.0.1 under Debian "wheezy" for amd64
>   - gawk 4.1.1 under Debian "jessie" for amd64
>   - gawk 4.1.1 from Macports under Mac OS 10.9 ("Mavericks")
>
> The result is the same after setting LC_ALL=C.
>
> Bert

Indeed, it's a bug.  Either nobody is using --gen-pot, or else their
messages are shorter than 70 characters.  Sigh.  Below is the fix. It
will get pushed into the repo shortly.

Thanks,

Arnold
----------------------
diff --git a/profile.c b/profile.c
index b0fbbed..84e7f9d 100644
--- a/profile.c
+++ b/profile.c
@@ -909,11 +909,11 @@ pp_string_fp(Func_print print_func, FILE *fp, const char 
*in_str,
 
        slen = strlen(str);
        for (count = 0; slen > 0; slen--, str++) {
+               print_func(fp, "%c", *str);
                if (++count >= BREAKPOINT && breaklines) {
                        print_func(fp, "%c\n%c", delim, delim);
                        count = 0;
-               } else
-                       print_func(fp, "%c", *str);
+               }
        }
        efree(s);
 }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]