From patchwork Sat Dec 1 17:07:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.Merijn Brand" X-Patchwork-Id: 10707749 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5BDB614E2 for ; Sat, 1 Dec 2018 17:08:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 39ABD2D1AB for ; Sat, 1 Dec 2018 17:08:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C9F42D216; Sat, 1 Dec 2018 17:08:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 230522D1AB for ; Sat, 1 Dec 2018 17:08:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726968AbeLBEVK (ORCPT ); Sat, 1 Dec 2018 23:21:10 -0500 Received: from lb2-smtp-cloud7.xs4all.net ([194.109.24.28]:59193 "EHLO lb2-smtp-cloud7.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726895AbeLBEVJ (ORCPT ); Sat, 1 Dec 2018 23:21:09 -0500 Received: from pc09.procura.nl ([188.202.26.81]) by smtp-cloud7.xs4all.net with ESMTPSA id T8kTgQxzSfGaRT8kUgaL3Y; Sat, 01 Dec 2018 18:08:10 +0100 Date: Sat, 1 Dec 2018 18:07:57 +0100 From: "H.Merijn Brand" To: git@vger.kernel.org Subject: [PATCH] Do not fail test if '.' is part of $PATH Message-ID: <20181201180757.0b2d3c89@pc09.procura.nl> X-Mailer: Claws Mail 3.17.0git137 (GTK+ 2.24.31; x86_64-suse-linux-gnu) Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwEAIAAACI8LKTAAAACXBIWXMAAABIAAAASABGyWs+AAAC JElEQVRo3u2aMY4CMQxFczZ6RItEzRm4DBINDbRUSPRInIRbsNK6+dJfezN4kokn48IaCSjysL8d e9Knoj2fr9f9/gllqQ6U9/vxWK3EdwdIEGjRIVCu18NhuxUfK46SH81+fzrdbuKPx/P5ctHQdAdI TKAgpvV6s9ntBEfXEYSGgMQzIHnuFBBjkshCNJ2KtJZ04hHNAugP8bZr3NIHhbcF0AKoK0CoaHXU LUWBIs1n+jV+Fl8CVqOApEXAwyMO/DSR4XVntoAYDR7eBjQupuYAYTMph8Rj21D4m7MChN02tpqs NSnb/KqU2oHCXu5xDCgflj/RAgBiKBIXnICzAsSjWBsTz5K4/HeXYvb8yK5lY3VGEwPi2aONKT+5 AlcxrTPOwcTiraGRChgMEKJh0bVVifGVTq6qgBiNVl8QE29EsK6VE+YJAOG2wz5AvsqUS6uqgHCA n4NGvBYpnJ64Jgg27sCtxtBk1CJIA4S/GhdWKh07QxUB48jWGhZ4jKamRRr/T8/M0AaEyctry6YB 4dTGj9iWZNs3DahES5kPCJOu0RQbF/fQOBprsB9gaO9JtPDzII9U5ySXX7AnuIt91y54AAW7rPpT LCe5gt3F+CLqr2UarGB3MXvMylWGq4+9RCx3TW1oJq1t3HPQlFs6N1fFNEB4s8dn7Ne7ACSm7TPQ I5quAWmw6qBpulHM33B0Csge4Nd8JTTYG2b1XyRe3lH8x34ABJ6aePuQ2N4AAAAASUVORK5CYII= MIME-Version: 1.0 X-CMAE-Envelope: MS4wfJVPNwgQQg8ZmnwlygglNtztMfdBiL4hH7PV9ZE1mbxBKQwj6XgEVLtmTyc3I6wtr9ji8FrYb292YUWtIDsupc11ozhmisTWoxPSFyMMBMGQMjjeQim+ nYrDi1rLI47g1LlmfuBhUyV8RFj5mEusVumipzlFxyo9wFERjpMh89f9 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Tested-by: H.Merijn Brand - Tux 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