Re: [PATCH] t9100: fix breakage when SHELL_PATH is not /bin/sh

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] t9100: fix breakage when SHELL_PATH is not /bin/sh

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:08:09

Johannes Schindelin [off-list ref] writes:
write_script is a semantically unambiguous way to specify what we *want*.
And it would allow us to handle chmod specifically for Windows *in one
place only*.
Correct.  write_script, for the intended target of the helper, is a
way to write a script that can later be invoked by the test with the
name "$1".  It is conceivable for write_script on UNIX to be writing
into "$1" while Windows version to be writing into "$1.bat" and the
script, i.e. the user of the write_script helper, to do this

	write_script foo <<EOF &&
        ...
        EOF
	...
        foo

which may result in foo.bat running on Windows without us having to
adjust the test script.  So it indeed is a very nice abstraction to
have.

But the way the test uses this exec.sh script is not consistent with
that.  exec.sh for this test is merely a data, whose content must
exactly match what later tests expect, i.e. it wants it to begin
with "#!/bin/sh" and its execute bit on, even though the test does
not have no intention to run it as a script.

So I think it was doubly wrong for me to suggest write_script
without realizing that this is _not_ writing a script in the usual
sense for us to write with write_script.



        	

Re: [PATCH] t9100: fix breakage when SHELL_PATH is not /bin/sh

From: Johannes Schindelin <hidden>
Date: 2016-06-15 23:08:10

Hi Junio,

On Mon, 8 Feb 2016, Junio C Hamano wrote:
Johannes Schindelin [off-list ref] writes:
quoted
write_script is a semantically unambiguous way to specify what we *want*.
And it would allow us to handle chmod specifically for Windows *in one
place only*.
Correct.  write_script, for the intended target of the helper, is a
way to write a script that can later be invoked by the test with the
name "$1".
And whose executable bit is set, contingent on the POSIXPERM prereq.
It is conceivable for write_script on UNIX to be writing
into "$1" while Windows version to be writing into "$1.bat"
Oy vey. Good thing you did not see my first reaction.

Shell scripts and batch scripts have *very* different semantics. Therefore
it would be a major nightmare (for me, not for you) to support writing
them *using the same write_script invocation*.

Let's just not go there.
But the way the test uses this exec.sh script is not consistent with
that.  exec.sh for this test is merely a data, whose content must
exactly match what later tests expect, i.e. it wants it to begin with
"#!/bin/sh" and its execute bit on, even though the test does not have
no intention to run it as a script.
The important part, of course, is "and its execute bit on" which makes it
a moot point to ask whether we intend to execute the script or not. A
script is what we want, and a script is what we write. Therefore,
write_script is what we call. With the $2 fix-up to keep DrMicha happy.

Ciao,
Dscho
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help