groff
[Top][All Lists]
Advanced

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

Re: [groff] 1.22.4.rc4 - Final RC before official 1.22.4


From: G. Branden Robinson
Subject: Re: [groff] 1.22.4.rc4 - Final RC before official 1.22.4
Date: Thu, 6 Dec 2018 23:17:11 -0500
User-agent: NeoMutt/20180716

At 2018-12-06T18:44:18+0100, Ingo Schwarze wrote:
>     Improve shell script portability in the hdtbl fonts examples.

Thanks for catching and fixing this!

>     1. POSIX requires "echo -n" to print "-n" followed by
>        a newline character, so use printf(1) instead.
>     2. According to POSIX, behaviour of tr(1) is undefined
>        if string2 contains fewer characters than string1,
>        and on Oracle Solaris, the excess characters in string1
>        are not translated.  So make sure string2 contains
>        a sufficient number of characters.
> 
> -        | tr '[:cntrl:]' ' '"
> +        | tr '[:cntrl:]' '[ *32]'"

This might not be portable _enough_.

The number of characters in the class :cntrl: is locale-dependent; you
are only guaranteed 32 such codepoints if LC_CTYPE=C (that is, ASCII).

POSIX says that the repeat count in the second argument to tr can be
omitted, and the transliteration target will grow to fit the size of the
source:

https://pubs.opengroup.org/onlinepubs/009695399/utilities/tr.html

...on the other hand, Solaris's relationship with POSIX has been
difficult at best, so I wouldn't be surprised if omitting the repeat
count is disallowed in its implementation.  But I know nothing about the
limitations of historical versions of tr.

Another approach would be to force LC_CTYPE=C in the pipeline before
calling tr.

So either:

        | tr '[:cntrl:]' '[ *]'"

or:

        | LC_CTYPE=C tr '[:cntrl:]' '[ *32]'"

perhaps?

Regards,
Branden

Attachment: signature.asc
Description: PGP signature


reply via email to

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