delorie.com/archives/browse.cgi | search |
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:message-id:date:from:mime-version:to:subject | |
:references:in-reply-to:content-type; q=dns; s=default; b=Q0eikD | |
YX9FHviBWViKjzzdWaQrvuMfh+zUDUGLUcDDG0cUPBcTX8jtatrOlzgLWvcoiT+c | |
2VEJ+ZWmXQAIerL0zAuFRwkp5WpuPU0aK60hciNgMARjcpwHzYr0hCaH5IsFFKcN | |
KDlKnQA58uj+hzz6HhjE5645Wt+gHBu4mI6ok= | |
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:message-id:date:from:mime-version:to:subject | |
:references:in-reply-to:content-type; s=default; bh=euNdRZIvp5LN | |
/a7cHDK8g3WDsZw=; b=hdRMPm/ntW247NUO4a1HQh2MV7hRqCwoAd68KQvRTkLW | |
ssWSIJBYxVBXJG8Q5Ca48JegFtmJ+Zyq4dDrznteQMWHiZqsdG0e+0jcPv1bVlAO | |
9OGdgeXEabaTqFuosiqdAjy3NMR0cggdc7CGN32MHfim+D61RYE8rS+4hS1yb3A= | |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
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=-3.1 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 |
X-HELO: | mx1.redhat.com |
Message-ID: | <54137295.4070304@redhat.com> |
Date: | Fri, 12 Sep 2014 16:24:21 -0600 |
From: | Eric Blake <eblake AT redhat DOT com> |
User-Agent: | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0 |
MIME-Version: | 1.0 |
To: | cygwin AT cygwin DOT com |
Subject: | Re: Cannot exec() program outside of /bin if PATH is unset |
References: | <5413271B DOT 1010109 AT t-online DOT de> <54134A83 DOT 80107 AT redhat DOT com> <54135451 DOT 3060902 AT t-online DOT de> |
In-Reply-To: | <54135451.3060902@t-online.de> |
OpenPGP: | url=http://people.redhat.com/eblake/eblake.gpg |
X-IsSubscribed: | yes |
--4xHf4rJGhN4WO6Skdg30dEDFNTbEtQhNf Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 09/12/2014 02:15 PM, Christian Franke wrote: >>> unsetenv("PATH"); >> This is undefined behavior, per POSIX. POSIX recommends that you always >> leave PATH defined to at least a bare minimum of the results of >> confstr(_CS_PATH, ...); it also states that implementations are free to >> do what they want (in this case, crash) if you don't follow the >> recommendation: >> >> http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html >> "If PATH is unset or is set to null, the path search is >> implementation-defined." >=20 > There is no POSIX PATH search needed in my testcase: > execl("/usr/sbin/alternatives", ...) PATH may not be needed for execl() to find the binary it will be executing, but it IS required to be set in the environment to the bare minimum of confstr(_CS_PATH) for that binary to have a chance of executing in a well-defined setup. >=20 > The alternatives.exe could be found. The required DLLs could not be loade= d. > POSIX does not specify anything about the load path of shared libraries. > On Linux, LD_LIBRARY_PATH is completely separate from PATH. > On Windows, the DLL load path is connected to PATH. >=20 >>> Enabling the SetDllDirectory() Win32 call fixes the problem. >>> Would possibly make sense to add this call to cygwin1.dll. >> That said, just because POSIX has already given us the >> get-out-of-jail-free card doesn't mean that we can't be nice and improve >> cygwin1.dll to try and help broken programs that unset PATH. >=20 > Hmm... is postfix actually broken? Yes, from the POSIX point of view. It is doing something that is documented to have unspecified behavior, namely, removing PATH from the environment. > Unsetting PATH is IMO sane (from the POSIX POV) if all exec() calls use > absolute path names. It is unspecified, whether or not it has sane behavior on some platforms. Just because something is unspecified by POSIX doesn't mean that you can't do it, it just means that if you do it, and things break, you get to keep both pieces. So I would file a bug to upstream postfix that they are broken for unsetting PATH. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --4xHf4rJGhN4WO6Skdg30dEDFNTbEtQhNf Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg iQEcBAEBCAAGBQJUE3KVAAoJEKeha0olJ0Nqv68H/3wG1PMIMmQ7/FaQBEUG2cHE YODWfZAunXmB8bxBVek6cnn9asEqQ0P94V/b39RRIcG6rzZAB5PEXTEUF65Wxmg2 eFkDM8inC+R9APP1W/qXKJ+1EBKwBmqKrSnPhvhiD52EJxykhGm5/f8EXAMWd+7Q 3y8m/F4bOXqd7AjmLQFElFV3GS+iR+1dlWpx9dcBnbJ64Mi9/rtjlk7pEiCXr/SV PF+FWDhnnpy6fbKCffDTYzLetrT1N5ixWzfGHzILS4/JrJXWWlUz9fY1HfqgOgZk kHOP96Xr5BXmc62eX1pCWwZ4+MOWwcRdr+Etz/5yRf9zyOVsr7NGCC8jxlrPpiw= =PGHm -----END PGP SIGNATURE----- --4xHf4rJGhN4WO6Skdg30dEDFNTbEtQhNf--
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |