On 2021/01/27 16:30, Karl Fogel wrote:
> On 26 Jan 2021, Daniel Shahaf wrote:
>> +1 to using sys.executable. Fixing the quoting while in there would be
>> nice to have, but as it's not a regression it's not a blocker either.
>> Happy to leave the details to you.
>
> Well, things turn out to be a bit more complicated than I thought.
>
> My original patch was just to replace
>
> svneditor_script = os.path.join(sys.path[0], 'svneditor.py')
>
> with
>
> svneditor_script = sys.executable + " " + \
> os.path.join(sys.path[0], 'svneditor.py')
>
> in subversion/tests/cmdline/svntest/main.py. Unfortunately, exactly one
> test still fails with that:
>
> FAIL: update_tests.py 38: update --accept automatic conflict resolution
>
> See [1] for details.
This is because SVN_MERGE does not execute through a shell, whole value
is treated as a single path. On the other hand, SVN_EDITOR is passed
to system() and is interpreted by a shell.
> So then I tried a slightly fancier and experimental change. I'll
> present it in straight-code form here, instead of patch, but it's just
> replacing the same line as before:
>
> # Create a shell script that invokes the Python executable (the
> # one that the test suite is using) on svneditor.py and its args.
> svneditor_script = os.path.join(sys.path[0], 'svneditor.sh')
> with open(svneditor_script, 'w') as fp:
> fp.write("#!/bin/sh\n\n")
> fp.write("'%s' '%s' $@\n" % (sys.executable,
fp.write("'%s' '%s' \"$@\"\n" % (sys.executable,
> os.path.join(sys.path[0], 'svneditor.py')))
> svneditor_script_st = os.stat(svneditor_script)
> os.chmod(svneditor_script, svneditor_script_st.st_mode | stat.S_IEXEC)
>
> Pretty straightforward, right? I know, I know: it doesn't clean up the
> shell script afterwards or anything yet. I'm just experimenting.
How about using configure to generate svneditor.sh?
Cheers,
--
Yasuhito FUTATSUKI <[email protected]>