On 2021/02/26 22:52, Daniel Shahaf wrote: > Yasuhito FUTATSUKI wrote on Thu, Feb 25, 2021 at 21:43:15 +0900: >> On 2021/02/22 13:39, Karl Fogel wrote: >>> 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. >> >> Then, I made patches. It also allows pypy to run the test without >> 'python'. >> >> (A) Replace the shebang line of svneditor.py from svneditor.py >> at running the configure script. (fix-svneditor-in-test-patch-a.txt) >> As @PYTHON@ can be basename only, relative path, or absolute path, >> "/usr/bin/env" is still needed. >> >> (B) Make a script to launch svneditor.py using @PYTHON@, svneditor.sh >> at running the configure scriptt. (fix-svneditor-in-test-patch-b.txt) >> >> If @PYTHON@ is always absolute path, we can use shebang line without >> '/usr/bin/env' in patch (A). >> >> Cheers, > > I take it the two patches are alternatives? If so, I prefer (B), because: > > - .in files get in the way of the edit-compile-fix cycle, and the file > that (B) makes .in is less likely to need to be edited. > > - Using @PYTHON@ in a #!/bin/sh script is closer to its existing uses > (in Makefile.in, for example) than using it on the #! line. Thank you for the comment. It is reasonable.
So I looked at patch (B) more closely and updated, so that the substituted string is not interpreted specially by the shell. As this uses function, it does not work with v7 sh but POSIX shells allows to use it. -- Yasuhito FUTATSUKI <futat...@yf.bsclub.org>
tests: Add launcher for svneditor.py with specfied Python at configure. * configure.ac: Add subversion/tests/cmdline/svneditor.sh to SVN_CONFIG_SCRIPT. * subversion/tests/cmdline (svn:ignore): ignore svneditor.sh. * subversion/tests/cmdline/svneditor.sh.in: New script tempate, launching svneditor.py via @PYTHON@. * subversion/tests/cmdline/svneditor.py: - Drop svn:executable. - Remove shebang line. Index: configure.ac =================================================================== --- configure.ac (revision 1886884) +++ configure.ac (working copy) @@ -1769,6 +1769,7 @@ done SVN_CONFIG_SCRIPT(tools/backup/hot-backup.py) SVN_CONFIG_SCRIPT(tools/hook-scripts/commit-access-control.pl) +SVN_CONFIG_SCRIPT(subversion/tests/cmdline/svneditor.sh) SVN_CONFIG_SCRIPT(subversion/bindings/swig/perl/native/Makefile.PL) if test -e packages/solaris/pkginfo.in; then SVN_CONFIG_SCRIPT(packages/solaris/pkginfo) Index: subversion/tests/cmdline/svneditor.py =================================================================== --- subversion/tests/cmdline/svneditor.py (revision 1886884) +++ subversion/tests/cmdline/svneditor.py (working copy) @@ -1,4 +1,3 @@ -#!/usr/bin/env python # # svneditor.py: a mock $SVN_EDITOR for the Subversion test suite # Property changes on: subversion/tests/cmdline/svneditor.py ___________________________________________________________________ Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: subversion/tests/cmdline/svneditor.sh.in =================================================================== --- subversion/tests/cmdline/svneditor.sh.in (nonexistent) +++ subversion/tests/cmdline/svneditor.sh.in (working copy) @@ -0,0 +1,40 @@ +#!/bin/sh +# +# svneditor.sh.in: a launcher of svneditor.py, used as $SVN_EDITOR +# for the Subversion test suite +# +# Subversion is a tool for revision control. +# See http://subversion.apache.org for more information. +# +# ==================================================================== +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +###################################################################### + +print_python_path() +{ +cat <<"_SVN_EOF" +@PYTHON@x +_SVN_EOF +} + +python="$(print_python_path)" +python="${python%x}" + +script_dir="`cd $(dirname "$0"); pwd`" + +exec "$python" "$script_dir"/svneditor.py "$@" Property changes on: subversion/tests/cmdline/svneditor.sh.in ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: subversion/tests/cmdline/svntest/main.py =================================================================== --- subversion/tests/cmdline/svntest/main.py (revision 1886884) +++ subversion/tests/cmdline/svntest/main.py (working copy) @@ -129,7 +129,7 @@ else: if windows: svneditor_script = os.path.join(sys.path[0], 'svneditor.bat') else: - svneditor_script = os.path.join(sys.path[0], 'svneditor.py') + svneditor_script = os.path.join(sys.path[0], 'svneditor.sh') # Username and password used by the working copies wc_author = 'jrandom' Index: subversion/tests/cmdline =================================================================== --- subversion/tests/cmdline (revision 1886884) +++ subversion/tests/cmdline (working copy) Property changes on: subversion/tests/cmdline ___________________________________________________________________ Modified: svn:ignore ## -11,3 +11,4 ## .libs .davautocheck.sh.stop lock-helper +svneditor.sh