git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "H.Merijn Brand" <h.m.brand@xs4all.nl>
To: git@vger.kernel.org
Subject: [PATCH] Do not fail test if '.' is part of $PATH
Date: Sat, 1 Dec 2018 18:07:57 +0100	[thread overview]
Message-ID: <20181201180757.0b2d3c89@pc09.procura.nl> (raw)

[-- Attachment #1: Type: text/plain, Size: 1382 bytes --]

When $PATH contains the current directory as .:PATH, PATH:., PATH:.:PATH,
or (maybe worse) as :PATH, PATH:, or PATH::PATH - as an empty entry is
identical to having dot in $PATH - this test used to fail

This patch was tested with PATH=$PATH, PATH=.:$PATH, PATH=$PATH:.,
PATH=$PATH:.:/bin, PATH=:$PATH, PATH=$PATH:, and PATH=$PATH::/bin

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Tested-by: H.Merijn Brand - Tux <h.m.brand@xs4all.nl>

diff --git a/t/t0061-run-command.sh b/t/t0061-run-command.sh
index cf932c851..557f87442 100755
--- a/t/t0061-run-command.sh
+++ b/t/t0061-run-command.sh
@@ -29,7 +29,14 @@ test_expect_success 'run_command can run a command' '
        test_must_be_empty err
 '

-test_expect_success 'run_command is restricted to PATH' '
+test_lazy_prereq DOT_IN_PATH '
+       case ":$PATH:" in
+       *:.:*|*::*) true  ;;
+       *)          false ;;
+       esac
+'
+
+test_expect_success !DOT_IN_PATH 'run_command is restricted to PATH' '
        write_script should-not-run <<-\EOF &&
        echo yikes
        EOF

-- 
H.Merijn Brand  http://tux.nl   Perl Monger  http://amsterdam.pm.org/
using perl5.00307 .. 5.29   porting perl5 on HP-UX, AIX, and openSUSE
http://mirrors.develooper.com/hpux/        http://www.test-smoke.org/
http://qa.perl.org   http://www.goldmark.org/jeff/stupid-disclaimers/

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

             reply	other threads:[~2018-12-01 17:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-01 17:07 H.Merijn Brand [this message]
2018-12-01 19:38 ` [PATCH] Do not fail test if '.' is part of $PATH Jeff King
2018-12-03  0:29   ` Junio C Hamano
2018-12-03  1:00 ` Junio C Hamano

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=20181201180757.0b2d3c89@pc09.procura.nl \
    --to=h.m.brand@xs4all.nl \
    --cc=git@vger.kernel.org \
    /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).