| 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:date:from:to:subject:message-id:reply-to | |
| :references:mime-version:content-type:in-reply-to; q=dns; s= | |
| default; b=CDhjRcgO5HtE4jWyHSM+WofqhACGdi+PZ1T/VsBThq1wtgTN9MI7I | |
| Gjv7ooD0v8nSZedGlV0NkKQRVZa3wZgtXQ2X+r9J/8EIaJsPfrXAwAqgeEmiwLcg | |
| Mb/fkF2RJr31le+poChh7rjETQ3pBfgjS1z9K5r+hnQbfcipZTGHGw= | |
| 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:date:from:to:subject:message-id:reply-to | |
| :references:mime-version:content-type:in-reply-to; s=default; | |
| bh=HtdHHOpOVkZtjWSslF1g8rMuU38=; b=Q6nsbV+j6qhecjS7sk+A1x2o4qSY | |
| xIMABU5bApz2QJ2qIs+fW/3ckd32sKoiCwCp6UwXzIrWNtk/jsirR14x9pXKzyGr | |
| S8kSGwb0wCEEySEVaSsLomCbJJBwgNRI5w9uJr5HnmexAtOAJ+8rYN28q0jD/DiL | |
| UhsyD0wN3wYzQBQ= | |
| 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-Spam-SWARE-Status: | No, score=-104.1 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=H*F:D*cygwin.com |
| X-HELO: | mout.kundenserver.de |
| Date: | Tue, 6 Aug 2019 11:01:06 +0200 |
| From: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com> |
| To: | cygwin AT cygwin DOT com |
| Subject: | Re: Empty file without "x" permission is successfully executable on Cygwin |
| Message-ID: | <20190806090106.GN11632@calimero.vinschen.de> |
| Reply-To: | cygwin AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| References: | <BL0PR0901MB43081893EE588BDED05886BFA5DA0 AT BL0PR0901MB4308 DOT namprd09 DOT prod DOT outlook DOT com> <eeb8deb6-fc17-1ecd-fb9d-6c0882f75dc1 AT cornell DOT edu> <7d007c9f-e98d-f497-d706-dbf94bb563f2 AT towo DOT net> <319f78d5-fbcd-712a-ba27-137bd1fbd439 AT cornell DOT edu> <8378710e-4533-ee50-0e31-7714982eec0d AT cornell DOT edu> <20190806083300 DOT GM11632 AT calimero DOT vinschen DOT de> |
| MIME-Version: | 1.0 |
| In-Reply-To: | <20190806083300.GM11632@calimero.vinschen.de> |
| User-Agent: | Mutt/1.11.3 (2019-02-01) |
--UvwuEPigQXXfOf7G
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Aug 6 10:33, Corinna Vinschen wrote:
> On Aug 6 03:19, Ken Brown wrote:
> > >>> On 8/5/2019 2:18 PM, Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwi=
n wrote:
> > >>>> Hi,
> > >>>>
> > >>>> Please consider the following shell session:
> > >>>>
> > >>>> $ cat dummy.c
> > >>>> #include <stdio.h>
> > >>>>
> > >>>> int main()
> > >>>> {
> > >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return 0;
> > >>>> }
> > >>>> $ gcc -o dummy dummy.c
> > >>>> $ mv dummy.exe dummy
> > >>>> $ ./dummy
> > >>>> $ echo $?
> > >>>> 0
> > >>>> $ chmod a-x dummy
> > >>>> $ ./dummy
> > >>>> -bash: ./dummy: Permission denied
> > >>>> $ rm dummy
> > >>>> $ touch dummy
> > >>>> $ ./dummy
> > >>>> $ echo $?
> > >>>> 0
> > >>>> [...]
> > It look like what's happening is that bash calls execve(), which return=
s with=20
> > errno ENOEXEC instead of EACCES.
> >=20
> > I'll look at this more tomorrow unless someone beats me to it.
>=20
> Looks like the checks for this scenario are in the wrong order. In
> av::setup(), the first check is if the file is a valid executable and if
> so, exec returns ENOEXEC (unless called via exec[vl]p). Only if that
> fails, av::setup checks the executability of the file(*).
Sorry, this description makes no sense. Let me try again, here's
what av::setup does:
- Check if the file has been recognized as a she-bang script.
- If not, checks if we have been called from exec[vl]p.
- If not, return with ENOEXEC.
- If yes, prepend /bin/sh to the script name.
- Check if file is executable.
- If not, return with EACCES.
- Continue script handling.
> Ken, I'll propose a patch on cygwin-patches, please check.
Corinna
--=20
Corinna Vinschen
Cygwin Maintainer
--UvwuEPigQXXfOf7G
Content-Type: application/pgp-signature; name="signature.asc"
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAl1JQdIACgkQ9TYGna5E
T6CvQA/8Cefy3dO2Km266DEtdGbeABPxgruEka+R9MnMeWzYGBh2Y1L7BGqF3KFt
nSuYKZcNmJM9eWC1wLDAULaaYD6kP3xBHHGSk/Q10v5IeblitZJUcEnpSFzysswg
Wy19GqBe+OTYz4UYy/n45mZe5B05Tw8z+2/CtG5UsZlxM8IeVwpoTBgYkd2QbTh5
hlT8YcT/Zq3y6q13yVAy3rwoR+64RypRKnSkPheCt0ze10QOdDuQJ4YfPr+E4O2x
8AN/P8rpUc7INzUqWCFQYeewJXSYw62bXdP99UqJg7ThH/D+KxPvlpiWWrRIRa7y
W4sWHqd6R67lB+oK230rT42ivuOjCXsm8MQn+2/KDHGo/hJRoXH4dagkARNyau+O
xceYWOMZvXhb8uOHR24Tf/77Ku9nWkNIgI7TLRJ67wIWmIHJ+NSz7C0lU4lmkT9e
BP9jvzBuXSk+5kAMk3jwBLtEjIMiebp0z4H5t1Ivaqeb19Zj81xBNLVFaGucMaDT
NNNjMtdrYlpW0aNXZ9n1sgcRm+1/2zFYR6WgA7Tb8gSqNMf8rVNX+8ElBOd9/DZ6
IsmJj1x/BLUPhNAFzKbLq/fWZbtPE1VZmKHn1QoQKJQBTBhzmvvrO/Kxga1ltYOn
MvoHuLTxfBJQrXZh82YabEifGELSVxCBiePbYBD+0fDgPC2ve8I=
=vAHF
-----END PGP SIGNATURE-----
--UvwuEPigQXXfOf7G--
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |