X-Recipient: archive-cygwin@delorie.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
	:content-type:content-transfer-encoding; q=dns; s=default; b=H8i
	H9Quswykjhv8f7Qjs2tj5Xb0cs6/RbCz1aYDogqx2g/4L8eVU+lUwWCc5JzlUxm/
	S5XgvKzQGCmUPXrYXdNnY6t4EcOyIHzfwJ+OO+z5hhkydFuLqOXcY3WMjceEBlNl
	A63sQcdahYo3XDXoinaYCwhCeJuQ7tPEKdNeUMJ4=
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
	:content-type:content-transfer-encoding; s=default; bh=Re5+IZfmX
	EsrUSaggCuimcTTOgE=; b=k5xyU9ObkD68NQXN/z1k4NxKseVbBjhzizP85IoC7
	2c+pr2w9JBw16reY2+ZStDxhNvFFcDM6qcBXY3xShU0wJNtbacNnez1nSAh6dgc1
	+cqCxGkO2um+G1xTv4dQ5HIAek3i3gg7G5kSg4fHPmTNn4TnbQ2LA4d1a9LyQBXS
	Dc=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.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_50,FREEMAIL_FROM,RDNS_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no version=3.3.2
X-HELO: mail-qa0-f41.google.com
X-Received: by 10.49.35.52 with SMTP id e20mr100908464qej.63.1385866318926;        Sat, 30 Nov 2013 18:51:58 -0800 (PST)
Message-ID: <529AA451.4050408@gmail.com>
Date: Sat, 30 Nov 2013 21:52:01 -0500
From: Max Polk <maxpolk@gmail.com>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1
MIME-Version: 1.0
To: Cygwin list <cygwin@cygwin.com>
Subject: [patch] cygwin-apps/run 1.0.3
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes

Follow-up to run 1.0.3 crashing and leaving run.exe.stackdump, first
reported at http://cygwin.com/ml/cygwin/2013-08/msg00169.html

The list wouldn't let me send a patch because it had an email address in
the Changelog, so I had to put it here: http://pastebin.com/4SSPDGQh

The first fix is much like the above, but instead simply changes < to <=
to also copy the extra NULL terminator sentinel in the argv array, which
was needed to avoid deleting random memory.

The second fix adds quotes around parameters so spaces in the original
arguments don't get mistaken as separate arguments.  For example this
original test case:

     run bash --login -i -c "emacs FILENAME"

Get executed internally within run as this without quotes:

     bash --login -i -c emacs FILENAME

Without reinstating the quotes emacs runs with no arguments and FILENAME
is lost by bash.

Debug output (--run-debug=3) excerpt from two commands showing how
quotes are now added:

run DEBUG: C:\Apps\Cyg\bin\bash.exe --login -i -c emacs FILENAME

run DEBUG: C:\Apps\Cyg\bin\bash.exe "--login" "-i" "-c" "emacs FILENAME"

Side note: If you ask me why I'm running bash as a login shell to run
emacs-w32, it's to get all my .bash_profile settings when launched from
a Windows shortcut.  Paths and env vars and other things work better.
The side effect is that bash is a parent of emacs-w32 but that's okay
because there is no console window.


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

