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:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=Rsi26vli1cAGkMS6 huYT2CX2VMWp79QIQNUl77w3dem1kkKYcepNkkGZgdTrVXMa31z/D8qxoJmeUT9V /RkrV2A8k9usQHTN1IkoP6NIXPMvyHehVRKaw+eowZwJMPrtNXm226QZsLpKH/Zs V/c/lic4C3j0x6OV305YJ9kApfA= 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:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=QoQ5VWWUZ/45/StSOR//7K d3X7E=; b=aQvbNF1wUxs/Qn1GtHW1tnRHskYKF3YdZdA29jgwa20RtwnF4P5w3n +2MXn7bKKcMoV12pYeuly6NVCkePtHODj4LEuLb8PK/efw+rbWfBEWC4BYl+sEua 5ks3Uj93Q0m2xfreJO+DI1Y3JA2SfQx14mzeHbO3d2ukg4kzB9pPM= 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-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=H*i:sk:36d1b8e, H*MI:sk:36d1b8e, H*f:sk:36d1b8e, feeling X-HELO: mail-oi0-f43.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=/7mTw75DQTFHa42ZzsMWS+0Cx7vNeKmSOmfU95ILnbY=; b=SrpyFYKMUQduwZyXHJkwMvSWSsSmcJXCeRnvfjnCeqjZxIISYAdUCD1yfSRpPDmr4Q IyqAYRUZiRkb/e7Vjm9xQExUNErexVuRaE2N4UpvOk7t34eCppGmvr5TwBMK8hP5I68y aQurG/pk6Ldus6kNOK1i/WGFzMRQc8M1YSRMm3L7KORoS4yatZtToIZfpr7fHtKfCvP8 Hl3NllG3VkT7Hyj3hHCBzabTCXv35avA4LyQnMtBx9j1PxbBlnPk5bde5cpdpdgFL/xc KDIn2EdyDkoMdyuC+ZKbWo15e7WDhaXSx3BdPvsZ3+ZuK8yAZg95rj1tJpk41U062nao KC2w== X-Gm-Message-State: AN3rC/5x+DRFLzyV5kvgEgwdkMDQz6WixGvn5Nnvkld6WYmqnTMoXwemIabyZfe4s/pvVg== X-Received: by 10.36.13.149 with SMTP id 143mr22192246itx.21.1492013516450; Wed, 12 Apr 2017 09:11:56 -0700 (PDT) Subject: Re: Use a default path in exec*p*() if PATH is unset? To: cygwin AT cygwin DOT com References: <7b94712a-465d-421b-bc76-720e443708d3 AT t-online DOT de> <6991638b-2400-dacd-28ee-e2d2c9d91ed4 AT gmail DOT com> <36d1b8e6-4d03-eb00-37f0-e12c9f1c792b AT t-online DOT de> From: cyg Simple Message-ID: <1be7896a-700a-5384-2220-cc7bc25065e8@gmail.com> Date: Wed, 12 Apr 2017 12:12:02 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <36d1b8e6-4d03-eb00-37f0-e12c9f1c792b@t-online.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes On 4/11/2017 3:02 PM, Christian Franke wrote: > cyg Simple wrote: >> >> -i, --ignore-environment start with an empty environment >> >> A relative use of the executable will not be found if the environment is >> empty. > > Not necessarily (see Linux, *BSD, ...). POSIX says this is > "implementation-defined" - under the assumption that 'env' uses execvp() > which is the case for the GNU coreutils version. > > POSIX says this is "implementation-defined" Which means it is undefined by POSIX. Also one could argue that --ignore-environment also means any default ones within an API set. > >>> Interestingly the approach in newlib/libc/posix/execvp.c differs from >>> Cygwin and others: >>> execvp() with PATH unset calls execv(). This has the same effect as >>> execvp() with PATH set to current directory only. >>> >> Why do you assume that this is an issue with execvp? > > I never did (otherwise this would be a thread on cygwin-patches list). > > The above only means that it is IMO interesting that the Cygwin source > package contains two implementations of execvp() which handle the unset > PATH situation differently. > Sure, but it is implemented correctly based on POSIX. ;) > >> The user should >> not expect that an undefined behavior behaves the same way on other >> systems. > > Of course. But even then it is a reasonable question which possible > alternative should be implemented by Cygwin. Cygwin homepage says "Get > that Linux feeling, ...". So "implementation-defined" behavior should > possibly be close to Linux :-) > Even so not all "Linux feeling" can be implemented. But I agree it should be as close as possible. But I don't believe that env --ignore-environment should be using execvp and should be using execv instead. That is for the upstream coreutils team to decide though. -- cyg Simple -- 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