git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: Ben Walton <bdwalton@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	Git List <git@vger.kernel.org>, Johannes Sixt <j6t@kdbg.org>,
	Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: Re: [PATCH 1/3] Modify tr expressions so that xpg4/tr handles it on Solaris
Date: Sun, 19 Jul 2015 17:49:33 -0400	[thread overview]
Message-ID: <CAPig+cSpTgcBA5YbfQWY+x+wc7rBQjugcan+MwLuZVcHaOH9kQ@mail.gmail.com> (raw)
In-Reply-To: <1437328836-19156-2-git-send-email-bdwalton@gmail.com>

On Sun, Jul 19, 2015 at 2:00 PM, Ben Walton <bdwalton@gmail.com> 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@gmail.com>
> ---
> 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 '[[]]'?

  reply	other threads:[~2015-07-19 21:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-19 18:00 Adapt some tests to work around broken Solaris tools Ben Walton
2015-07-19 18:00 ` [PATCH 1/3] Modify tr expressions so that xpg4/tr handles it on Solaris Ben Walton
2015-07-19 21:49   ` Eric Sunshine [this message]
2015-07-19 18:00 ` [PATCH 2/3] Fix sed usage in tests to work around broken xpg4/sed " Ben Walton
2015-07-19 18:00 ` [PATCH 3/3] " Ben Walton
2015-07-19 20:22   ` Johannes Sixt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPig+cSpTgcBA5YbfQWY+x+wc7rBQjugcan+MwLuZVcHaOH9kQ@mail.gmail.com \
    --to=sunshine@sunshineco.com \
    --cc=bdwalton@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    --cc=johannes.schindelin@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).