Re: [PATCH 1/3] Modify tr expressions so that xpg4/tr handles it on Solaris

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

 



On Sun, Jul 19, 2015 at 2:00 PM, Ben Walton <bdwalton@xxxxxxxxx> wrote:
> It seems that xpg4/tr mishandles some strings involving [ not followed
> by a character class:
> % echo '[::1]' | /usr/xpg4/bin/tr -d '[]'
> [::1
>
> % echo '[::1]' | /usr/xpg4/bin/tr -d '['
> usr/xpg4/bin/tr: Bad string.
>
> This was breaking two tests. To fix the issue, use the octal
> representations of [ and ] instead. Reference the octal expression as
> a newly exported variable so that it's shared across tests and more
> easily understood when reading it.
>
> Signed-off-by: Ben Walton <bdwalton@xxxxxxxxx>
> ---
> diff --git a/t/test-lib.sh b/t/test-lib.sh
> index 39da9c2..6b5b6cd 100644
> --- a/t/test-lib.sh
> +++ b/t/test-lib.sh
> @@ -173,7 +173,10 @@ LF='
>  # when case-folding filenames
>  u200c=$(printf '\342\200\214')
>
> -export _x05 _x40 _z40 LF u200c
> +# [ and ], for use by tr commands.
> +squarebrackets="\133\135"

While it's true that the reader may be able to consult the commit
message to learn more about "squarebrackets" and "tr", this might be
one of those cases where either a more explanatory in-code comment is
warranted or the comment should be dropped altogether, since the the
current comment is not illuminating. I'd vote for expanding the
comment a bit to mention "some versions of Solaris 'tr'" and a short
description of the misbehavior.

Also, Hannes wondered how Solaris 'tr' would react to '[][]'. Were you
able to test that or the alternative '[[]]'?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]