delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/05/09/17:50:31

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:reply-to:message-id:to:subject
:in-reply-to:references:mime-version:content-type; q=dns; s=
default; b=sal7j/faS9TurbJE2veg6uinQx3H8T/XSXGSpA8ujdruXBbUmbTuS
nmbHf8SskDkNByaN9TY0er+2iXBNeN48mC/IcI6zcIIYOWGtuxObRnmf16V6SaGh
OeJkR/zeAEcYXO3R+Z9VgUPaqEx0aA/e6SJsCeiSpY4yLVyGkrvyVE=
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:reply-to:message-id:to:subject
:in-reply-to:references:mime-version:content-type; s=default;
bh=w57UBLBumiRbWGG3HhOYqmYm+/s=; b=LthjcEqWG2j4DiiYjNAOGXCFuc4t
5y0z+DONKP7e9V51uE1GMAVXanfJbLaO4oujQ9GjSoRiScZuXwX0gtWmau4Ve0/v
nZ9qb3svxXMdkGbtPufHxSwUqRB0ZDQsA75QdcGMzC+j5I0E8PeAdm6JqyB/80sc
iztqmmcIj31SKOQ=
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=-0.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KAM_THEBAT,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 spammy=H*UA:Bat!, H*x:Bat!, H*r:ip*192.168.1.10, H*M:yandex
X-HELO: forward2p.cmail.yandex.net
Authentication-Results: smtp2o.mail.yandex.net; dkim=pass header.i=@yandex.ru
X-Yandex-Suid-Status: 1 0,1 0
Date: Wed, 10 May 2017 00:48:07 +0300
From: Andrey Repin <anrdaemon AT yandex DOT ru>
Reply-To: cygwin AT cygwin DOT com
Message-ID: <17641936.20170510004807@yandex.ru>
To: Joni Eskelinen <jonieske AT gmail DOT com>, cygwin AT cygwin DOT com
Subject: Re: [ANNOUNCEMENT] New: cygextreg-1.2.0-1
In-Reply-To: <c9aa6066-6eb4-4c33-7f65-7dd1c34203e1@gmail.com>
References: <announce DOT 131486df-0b2e-a6d7-9840-21ecd08755a9 AT gmail DOT com> <1351717921 DOT 20170505141750 AT yandex DOT ru> <c9aa6066-6eb4-4c33-7f65-7dd1c34203e1 AT gmail DOT com>
MIME-Version: 1.0
X-IsSubscribed: yes

------------0260C3180389E1EAC
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Greetings, Joni Eskelinen!

> On 5.5.2017 14.17, Andrey Repin wrote:
>> Greetings, Joni Eskelinen!
>> 
>>> The following package has been added to the Cygwin distribution:
>> 
>>> * cygextreg-1.2.0-1
>> 
>> 
>>> Scripts are executed with bash
>> 
>> This must not be the case, unless explicitly requested. Enough that
>> all Windows associations are executed with cmd if you try to
>> CreateProcess blindly. Don't copy this mistake.
>> 
> Bash is used as an intermediary shell that executes the script.
> Generally a shebang line denotes the actual interpreter.

> Bash was chosen because it's bundled with a default Cygwin installation.

/usr/bin/env is also in the default install.
And I'm using it to run scripts now.
See attached TCC wrapper.

>> If you want to make it useful, write a thin wrapper over exec() that
>> finds out and runs proper interpreter, and support it with options to
>> make interpreters happy. F.e. convert $0 to Cygwin path, if
>> interpreter don't understand native paths (i.e. dash cringe over
>> non-latin1 native paths and I yet to find out why).
>> 
> All native paths are converted to Cygwin equivalents before invoking
> bash,

That's not the right thing to do. You can't know if a "path" you convert is an
actual local filesystem path (except for $0, but even then, it is not always
necessary).

> ie. $0 as in the path of the file that was clicked from Windows,
> and consecutive arguments if some files were dragged and dropped to
> registered file icon.
> That is, the script shall always receive only Posix style paths, by design.

You have a strangely limited perception on the usability of your tool.
How about console invocation?

>>> in an interactive login shell.
>> 
>> This should be optional. Login shell may cause $(pwd) to change, not 
>> to mention, it alters environment.
>> 
>>> If the executed script exits with a non-zero code, MinTTY window
>> 
>> This should be optional.
>> 
>>> shall be kept open
>> 
>> This should be optional.
>> 
> Nice suggestions. I've thought to implement per extension options
> especially for keeping the window open after completion.

> Script is actually invoked roughly as follows:
> /bin/bash -il -c 'cd <directory> && ./<filename>'

So, you're intentionally changing execution environment?

> with proper escaping applied. So even though user's personal init script
> changes the working directory, the script will be invoked in its
> containing directory.

Which is not necessarily the place where user had it invoked.

> I think it's a reasonable default to have bash run this way, since
> there's a fair chance that scripts require environmental variables set
> in .bashrc or like (eg. $PATH to ruby gems).

I'm not in the favor of chances when I'm doing my work.


-- 
With best regards,
Andrey Repin
Tuesday, May 9, 2017 17:15:35

Sorry for my terrible english...
------------0260C3180389E1EAC
Content-Type: application/octet-stream;
 name="cygwrap.btm"
Content-transfer-encoding: base64
Content-Disposition: attachment;
 filename="cygwrap.btm"

QFNFVCBQUk9NUFQ9QCRTJFAkXw0KQEVDSE8gT0ZGDQpPTiBCUkVBSyBSRU0N
Cg0KSUYgIiV+MSIgPT0gIi0taW5zdGFsbCIgR09UTyA6U0VUVVANCklGICIl
fjEiID09ICIiIEdPVE8gOkJBTk5FUg0KDQpTRVQgUEFUSD0lQFJUUklNW1ws
JUBQQVRIWyVARlVMTFsiJX4wIl1dXTslW1BBVEhdDQpTRVQgRU5WPSVAUEFU
SFslQEZVTExbIiV+MCJdXWVudi5leGUNClNFVCBDTUROQU1FPSVARVhFQ1NU
UltjeWdwYXRoLmV4ZSAtdSAiJX4xIl0NClNISUZUDQoNCiIlW0VOVl0iIC0t
ICIlW0NNRE5BTUVdIiAlJA0KUkVNIEVDSE8gUmV0dXJuICU/DQpRVUlUICU/
DQoNCjpCQU5ORVINCkVDSE8gQ3lnd2luIHNjcmlwdCB3cmFwcGVyLg0KRUNI
TyBVc2FnZToNCkVDSE8uDQpFQ0hPICAgJUBGSUxFTkFNRVsiJX4wIl0gc2Ny
aXB0IFtwYXJhbWV0ZXJzXQ0KRUNITyAgICVARklMRU5BTUVbIiV+MCJdIC0t
aW5zdGFsbCBbLmV4dCAuLi5dDQpFQ0hPLg0KRUNITyBUaGUgIi5zaCIgZXh0
ZW5zaW9uIGlzIGFsd2F5cyByZWdpc3RlcmVkIG9uIGluc3RhbGwuDQpRVUlU
DQoNCjpTRVRVUA0KDQpGVFlQRSB1bml4c2hlbGwuc2NyaXB0PSIlW0NvbVNw
ZWNdIiAvQyAiJUBGVUxMWyIlfjAiXSIgIiUlMSIgJSUqDQpTSElGVA0KRE8g
RVhUIElOIC9MIC5zaCAlJA0KICBJRkYgIiVATEVGVFsxLCVbRVhUXV0iID09
ICIuIiBUSEVODQogICAgQVNTT0MgJVtFWFRdPXVuaXhzaGVsbC5zY3JpcHQN
CiAgRU5ESUZGDQpFTkRETw0K


------------0260C3180389E1EAC
Content-Type: text/plain; charset=us-ascii


--
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
------------0260C3180389E1EAC--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019