Jeff King [off-list ref] writes:
I'm confused why it matters. write_script() unconditionally calls "chmod
+x", doesn't it?
Yeah, that was exactly my thought, too. Sorry for not noticing that
this depended the "interpreter" exactly be /bin/sh, though (it is
not even executed).
I just double-checked its definition in test-lib-function.sh; am I
missing some Windows-specific magic that kicks in?
quoted
So why not just prefix it with `SHELL_PATH=/bin/sh`?
But then what is write_script buying us?
The correct way to write a script for a specific interpreter is to
give a second parameter to write_script, i.e.
write_script exec.sh /bin/sh </dev/null &&
and the answer to the question is "it will save us one line".
The version in 'master' that does
echo "#!/bin/sh" >exec.sh &&
chmod +x exec.sh &&
should be equivalent, so dropping that hunk from the patch is the
right resolution perhaps?
On Mon, Feb 08, 2016 at 11:43:19AM -0800, Junio C Hamano wrote:
quoted
But then what is write_script buying us?
The correct way to write a script for a specific interpreter is to
give a second parameter to write_script, i.e.
write_script exec.sh /bin/sh </dev/null &&
and the answer to the question is "it will save us one line".
At the cost of a useless "cat" invocation, though. :)
The version in 'master' that does
echo "#!/bin/sh" >exec.sh &&
chmod +x exec.sh &&
should be equivalent, so dropping that hunk from the patch is the
right resolution perhaps?
Yeah, but I still don't understand why the original did not work on
Windows, once all the other hunks from bcb11f1 are applied.
-Peff
Hi Peff (and other interested parties),
On Mon, 8 Feb 2016, Jeff King wrote:
On Mon, Feb 08, 2016 at 11:43:19AM -0800, Junio C Hamano wrote:
quoted
The version in 'master' that does
echo "#!/bin/sh" >exec.sh &&
chmod +x exec.sh &&
should be equivalent, so dropping that hunk from the patch is the
right resolution perhaps?
Yeah, but I still don't understand why the original did not work on
Windows, once all the other hunks from bcb11f1 are applied.
And indeed it passes. With MSYS2. Because it simply ignores that chmod +x
cannot flip an executable bit.
The original patch (the one that guarded the chmod behind the MINGW
prereq) originated in the MSys (AKA MSys1) times, where 1) chmod would
fail, and 2) POSIXPERM did not yet exist.
Besides, I am pretty certain that there is a test in t9100 that *does*
test the executable bit, properly requiring POSIXPERM.
So I still would be in favor of using write_script: 1) our *intention* is
to write a script, even if we do not currently execute it, and 2) if
anybody is interested in supporting MSys1 (*cough* Hannes & Sebastian
*cough*), they have a *much* easier time to fix it.
Ciao,
Dscho