From: Jeff King <peff@peff•net>
To: Junio C Hamano <gitster@pobox•com>
Cc: "brian m. carlson" <sandals@crustytoothpaste•net>,
git@vger•kernel.org,
"Johannes Schindelin" <johannes.schindelin@gmx•de>,
"Torsten Bögershausen" <tboegi@web•de>
Subject: Re: [PATCH v3 0/3] Improve robustness of putty detection
Date: Tue, 28 Apr 2015 00:15:21 -0400 [thread overview]
Message-ID: <20150428041521.GB24580@peff.net> (raw)
In-Reply-To: <xmqq4mo2zgtz.fsf@gitster.dls.corp.google.com>
On Sun, Apr 26, 2015 at 03:04:56PM -0700, Junio C Hamano wrote:
> The test scripts are expected to take either 3 or 4 parameters, and
> the extra parameter when it takes 4 is the comma separated list of
> prerequisites. "bracketed hostnames are still ssh" does not look
> like prerequisites at all to us humans, and the framework should
> also be able to notice that and barf, I would think.
>
> Perhaps something like this?
I like it. I wondered if we could even recognize a known set of prereqs
(e.g., say "I don't know about the FOO prereq; did you forget to
test_lazy_prereq it?"), but I don't think we can. Some of the prereqs
are set by arbitrary code, and when they are not set, we don't call a
"test_do_not_set_prereq FOO". Enforcing a sane syntax is almost as
good, and seems pretty easy to implement.
> +test_verify_prereq () {
> + test -z "$test_prereq" ||
> + expr >/dev/null "$test_prereq" : '^[A-Z0-9_,!]*$' ||
> + error "bug in the test script: '$test_prereq' does not look like a prereq"
> +}
The leading "^" is unnecessary in an expr regexp, as such expressions
are always left-anchored. And according to POSIX, even undesirable
due to hysterical raisins. You do still need the '$' to anchor the end.
I was surprised that the regexp does not match the empty string itself
(making the initial "test -z" redundant), but it does not seem to with
my version of expr. Weird. I think it is because the exit value is not
"did it match" but "is the return value of the expression non-zero", and
of course we matched zero characters.
At any rate, we are probably much better off having the initial "test
-z" there as an optimization, anyway. "expr" is not usually a built-in,
and otherwise we add an extra fork to each test invocation (not
something I expect matters under Linux, but I know Windows folks are
very sensitive to it).
-Peff
next prev parent reply other threads:[~2015-04-28 4:17 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-22 14:36 [BUG] having 'plink' anywhere in the GIT_SSH environment variables sets putty = true Patrick Sharp
2015-04-22 17:46 ` Johannes Schindelin
2015-04-22 19:12 ` Patrick Sharp
2015-04-22 20:29 ` Jeff King
2015-04-22 21:19 ` brian m. carlson
2015-04-22 21:29 ` Jeff King
2015-04-22 21:44 ` brian m. carlson
2015-04-22 22:00 ` Jeff King
2015-04-22 22:24 ` brian m. carlson
2015-04-22 23:23 ` Jeff King
2015-04-23 0:06 ` [PATCH 1/2] connect: simplify SSH connection code path brian m. carlson
2015-04-23 0:06 ` [PATCH 2/2] connect: improve check for plink to reduce false positives brian m. carlson
2015-04-23 6:50 ` Johannes Schindelin
2015-04-23 15:53 ` Jeff King
2015-04-23 23:14 ` brian m. carlson
2015-04-24 6:41 ` Johannes Schindelin
2015-04-24 22:28 ` [PATCH v2 1/2] connect: simplify SSH connection code path brian m. carlson
2015-04-24 22:28 ` [PATCH v2 2/2] connect: improve check for plink to reduce false positives brian m. carlson
2015-04-24 22:46 ` Pete Harlan
2015-04-24 22:48 ` brian m. carlson
2015-04-25 16:03 ` Torsten Bögershausen
2015-04-26 18:52 ` brian m. carlson
2015-04-26 20:30 ` [PATCH v3 0/3] Improve robustness of putty detection brian m. carlson
2015-04-26 20:30 ` [PATCH v3 1/3] connect: simplify SSH connection code path brian m. carlson
2015-04-26 20:30 ` [PATCH v3 2/3] t5601: fix quotation error leading to skipped tests brian m. carlson
2015-04-26 20:30 ` [PATCH v3 3/3] connect: improve check for plink to reduce false positives brian m. carlson
2015-04-27 7:57 ` Johannes Schindelin
2015-04-28 3:53 ` Jeff King
2015-06-26 13:15 ` Jeff King
2015-06-26 16:16 ` Junio C Hamano
2015-06-26 16:27 ` Jeff King
2015-06-26 17:13 ` Johannes Schindelin
2015-06-26 17:23 ` Jeff King
2015-06-26 20:43 ` brian m. carlson
2015-04-26 22:04 ` [PATCH v3 0/3] Improve robustness of putty detection Junio C Hamano
2015-04-27 15:46 ` Torsten Bögershausen
2015-04-28 4:15 ` Jeff King [this message]
2015-04-29 1:38 ` brian m. carlson
2015-04-24 6:37 ` [PATCH 2/2] connect: improve check for plink to reduce false positives Johannes Schindelin
2015-04-23 5:08 ` [BUG] having 'plink' anywhere in the GIT_SSH environment variables sets putty = true Torsten Bögershausen
2015-04-23 13:15 ` Patrick Sharp
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150428041521.GB24580@peff.net \
--to=peff@peff$(echo .)net \
--cc=git@vger$(echo .)kernel.org \
--cc=gitster@pobox$(echo .)com \
--cc=johannes.schindelin@gmx$(echo .)de \
--cc=sandals@crustytoothpaste$(echo .)net \
--cc=tboegi@web$(echo .)de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox