X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:references :in-reply-to:content-type:content-id:content-transfer-encoding :mime-version; q=dns; s=default; b=MrMNWxWxPDrXcGYYVAY4R5AYNaXT/ GvP6eJYVhk8aBAg1NwcKINIoDGfPaXzMPrQlr+++6BDrLRiWatCuG/scAkH7NT+H VMO4t4Ouarps96MhamJCWamNE5DUkl1O/geZz7KfTy2RiPCITdzlozT+G6ialZqi 3czsWJxen5XS4U= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:references :in-reply-to:content-type:content-id:content-transfer-encoding :mime-version; s=default; bh=77FM/63i3z10ossbNRD0qrS2cI8=; b=fH7 iJtH0merFdqJlDpgAnRswGz4ZyvRNe+Y3ACnRKMCzgAwgslJ9YO4WLM12LrE3UeH FTzAT0PbsUH/lnR4R5y4FHhRHPzsYLBB5U+3VVNFnLbHcb3E/rSASD5YXFz22h91 Ogwny2v62Uz19x5yc6Fx+kvHbP1mD8mhdd0woP2s= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-5.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,KAM_ASCII_DIVIDERS,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1602 X-HELO: NAM03-CO1-obe.outbound.protection.outlook.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eTTEqQAosT2dgj4AJdlzL8B1djqzBFmFQqponTSZ1FkwH3IOjkGGa0GJNl5l85uf4JA+bdHP0fjJiD+arKErqcrDhiWxSljXOafzpr7r3GT0zh7hYgPo2tU5niaxEEIiFVlUvgU+h7Afah0YjAQ2FISPkDoS2GSJ0DsKWySOJAtMgbq/ARfD6nQWXMwPlVVi2f/bhQYgnexPrEi0ulo+4LZTsecZY2/AjKFJOzM7ZqwHy4XuTA98nZCvw/TJdiRQJzDgC5qF2FVaNuv+xjBnb9Ag1uGbwbPbdc9cHSGwuqskXsQXfhg5ZLrHWoz1drt9bXAJTVHtp7JxG496/EhJSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oiYYoeOeHoHxMDnjoONTPdLgnmOsByBYDilj9JIPsg8=; b=gnptmf7cWnx0Ou+qNUichGrV0/onS28PDoGxqNQl2bdAh/UbW6yIfVSl29U947LKw2TNnsIP83By8TM//CJMHa9c99cIZbbd1G14p5/41+eSRIpcAj8lTd4cLX4PvcK9N0BDMRr6NFw4KoSrL/bZwWmyAfgtudU/C6gZJPrFbiqXlGxVJsvFy9khDceL6R6Vz4woHeSn0qWME/qyFhlo/qCs7oO7czrs941XR1fUEsRckv44gNzwiqVNvBBtNC3eYlVBHI/nGDuUvOWOpaDJ01XlVbnv45zUNqKa88WiGWugIxKmMTtmLtcO4hC005OB09s6VO3xRD5Hnl3geKwmDw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cornell.edu; dmarc=pass action=none header.from=cornell.edu; dkim=pass header.d=cornell.edu; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cornell.edu; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oiYYoeOeHoHxMDnjoONTPdLgnmOsByBYDilj9JIPsg8=; b=GGY8HEQOtGQQW8zo4PrXspVNddHYFicrv8FMbuJv8kaWPbgUp0j/g+0rIXDJiYgYDI/bSWxXE1uJunscVsNDlvi4sxJXgyCrx8+nz5eDQrvNZW71EuM5wV/tLg+XV+0voDJKuwBMHa3B43bfesNWzD5xzlFTGJhA6JFXxdQlAKA= From: Ken Brown To: "cygwin AT cygwin DOT com" Subject: Re: execvp* and spawnvp* react differently to same PATH environment variable Date: Wed, 9 Oct 2019 16:43:08 +0000 Message-ID: References: <1549599310 DOT 1980812 DOT 1570481495155 DOT JavaMail DOT zimbra AT tdcadsl DOT dk> In-Reply-To: <1549599310.1980812.1570481495155.JavaMail.zimbra@tdcadsl.dk> user-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 authentication-results: spf=none (sender IP is ) smtp.mailfrom=kbrown AT cornell DOT edu; x-ms-oob-tlc-oobclassifiers: OLM:1775; received-spf: None (protection.outlook.com: cornell.edu does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="Windows-1252" Content-ID: <3A35FB5557181241A9F375984157E956 AT namprd04 DOT prod DOT outlook DOT com> MIME-Version: 1.0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 7om4vAUc8UIm1NnZ+0rsNb8X5c+daqXevgu71wFcLHShGbsWYNFR1jAT45A8aPAQbKiwa1Z+RtQJVh79gBZvcw== X-IsSubscribed: yes Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id x99Ghi5m006111 On 10/7/2019 4:51 PM, donpedro.tdcadsl.dk via cygwin wrote: > Hi all, > > While working on something i noticed that execvp* and spawnvp* behave differently with regards to $PATH, which i think is not correct. > > ---------------------------------------------- > > 1) The execvp* functions are called like this: > > return spawnve ( _P_OVERLAY | _P_PATH_TYPE_EXEC , > find_exec ( file , buf , "PATH" , FE_NNF ) ? : "" , > argv , envp ); > > This calls find_exec() with FE_NNF, which causes the path to be NULL if not found in $PATH. > > This later causes cygwin to fail correctly if the program is not in $PATH. > > ---------------------------------------------- > > 2) The spawnvp* functions are called like this: > > return spawnve (mode | _P_PATH_TYPE_EXEC, find_exec (file, buf), argv, cur_environ ()); > > This does _not_ calls find_exec() with FE_NNF which causes the path to be the posix form, as it is not found in path. > > This later causes cygwin to find the program even though it was not in $PATH which seems wrong. > > ---------------------------------------------- > > This seems like a bug in spawnvp* functions unless i am missing something? I think you're probably right. The use of FE_NNF in execvp* was introduced in commit 6d63272b. I suspect it was just an oversight that the spawvp* functions weren't changed in the same way. I'll send a patch to the cygwin-patches list to fix this. When Corinna returns, she can tell us whether there's some reason that spawnvp should be different from execvp. Ken -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple