I felt I should close the loop in this thread:
I decided to leave this be for now. Even though it is mildly
annoying that the Subversion test suite exhibits a few spurious
failures on systems that have only 'python3' and not 'python', it
turns out that most of the time most of my systems have 'python'.
So the real-world effects here are pretty minor for me, and
apparently for others, and there are more important things I could
work on in Subversion. If anyone wants to fix this minor problem,
there are enough pointers in this thread I think.
Thank you, Yasuhito FUTATSUKI, for your further analysis! That
was helpful; I'm glad we have it in the archives.
Best regards, -Karl
On 27 Jan 2021, Yasuhito FUTATSUKI wrote:
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,