You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Karl Fogel <kf...@red-bean.com> on 2021/02/22 04:39:30 UTC

Re: [PATCH] Fix tests failing on Debian due to lack of 'python' command.

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,

Re: [PATCH] Fix tests failing on Debian due to lack of 'python' command.

Posted by Yasuhito FUTATSUKI <fu...@yf.bsdclub.org>.
On 2021/02/26 7:02, Karl Fogel wrote:
> On 25 Feb 2021, Yasuhito FUTATSUKI wrote:
>> 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). 
> 
> On a Debian GNU/Linux system with only 'python3' (no 'python'), I tried a complete build and 'make check' in each of these three configurations:
> 
>  1. No patch (clean r1886938)
>  2. Your patch A
>  3. Your patch B
> 
> With a clean tree (no patches), there are the expected 4 test failures:
> 
>  FAIL:  commit_tests.py 48: set revision props during remote  property edit FAIL:  prop_tests.py 1: write/read props in wc  only (ps, pl, pdel, pe) FAIL:  prop_tests.py 16: property  operations on a URL FAIL:  update_tests.py 38: update --accept  automatic conflict resolution
> With just Patch A, there are no test failures -- yay!
> 
> With just Patch B, there are the same 4 test failures:
> 
>  FAIL:  commit_tests.py 48: set revision props during remote  property edit FAIL:  prop_tests.py 1: write/read props in wc  only (ps, pl, pdel, pe) FAIL:  prop_tests.py 16: property  operations on a URL FAIL:  update_tests.py 38: update --accept  automatic conflict resolution
> Do you get similar results?

On my environment, FreeBSD 12.2 (/bin/sh is 'ash'), even with Patch B,
all tests passed, except getopt_tests.py due to SVN_EXPERIMENTAL_COMMANDS
environment variable (I use shelf3).

It rely on that /bin/sh expands "$@" with preserving parameter field
separation and that built-in command 'exec' preserves field separation.
I think that the former is OK by POSIX specification [1], but I'm not sure
the later.

How about if apply 's/^exec //' to subversion/tests/cmdline/svneditor.sh
and then "make TESTS=subversion/tests/cmdline/prop_tests.py check" after
failed with patch B?

[1] 2. Shell Command Language - 2.5.2 Special Parameters
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_05_02

Cheers,
-- 
Yasuhito FUTATSUKI <fu...@yf.bsclub.org>

Re: [PATCH] Fix tests failing on Debian due to lack of 'python' command.

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Karl Fogel wrote on Thu, Feb 25, 2021 at 16:02:10 -0600:
> With just Patch B, there are the same 4 test failures:
> 
>  FAIL:  commit_tests.py 48: set revision props during remote  property edit
> FAIL:  prop_tests.py 1: write/read props in wc  only (ps, pl, pdel, pe)
> FAIL:  prop_tests.py 16: property  operations on a URL FAIL:
> update_tests.py 38: update --accept  automatic conflict resolution
> 
> Do you get similar results?

Is your ${abs_builddir}/…/svneditor.sh executable?  If you'd used
patch(1) rather than «svn patch», it wouldn't be.

Re: [PATCH] Fix tests failing on Debian due to lack of 'python' command.

Posted by Karl Fogel <kf...@red-bean.com>.
On 25 Feb 2021, Yasuhito FUTATSUKI wrote:
>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). 

On a Debian GNU/Linux system with only 'python3' (no 'python'), I 
tried a complete build and 'make check' in each of these three 
configurations:

  1. No patch (clean r1886938)
  2. Your patch A
  3. Your patch B

With a clean tree (no patches), there are the expected 4 test 
failures:

  FAIL:  commit_tests.py 48: set revision props during remote 
  property edit FAIL:  prop_tests.py 1: write/read props in wc 
  only (ps, pl, pdel, pe) FAIL:  prop_tests.py 16: property 
  operations on a URL FAIL:  update_tests.py 38: update --accept 
  automatic conflict resolution 

With just Patch A, there are no test failures -- yay!

With just Patch B, there are the same 4 test failures:

  FAIL:  commit_tests.py 48: set revision props during remote 
  property edit FAIL:  prop_tests.py 1: write/read props in wc 
  only (ps, pl, pdel, pe) FAIL:  prop_tests.py 16: property 
  operations on a URL FAIL:  update_tests.py 38: update --accept 
  automatic conflict resolution 

Do you get similar results?

Best regards,
-Karl

Re: [PATCH] Fix tests failing on Debian due to lack of 'python' command.

Posted by Yasuhito FUTATSUKI <fu...@yf.bsdclub.org>.
On 2021/04/01 3:57, Julian Foad wrote:
> Yasuhito FUTATSUKI wrote:
>> Follow up to r188732: Fix the invocation of svneditor.sh on out of tree build.
> 
> I confirm this patch makes it work properly in my out-of-tree build.  Thank you!
> 
Commited in r1888273. Thanks!

Cheers,
-- 
Yasuhito FUTATSUKI <fu...@yf.bsclub.org>

Re: [PATCH] Fix tests failing on Debian due to lack of 'python' command.

Posted by Julian Foad <ju...@apache.org>.
Yasuhito FUTATSUKI wrote:
> Follow up to r188732: Fix the invocation of svneditor.sh on out of tree build.

I confirm this patch makes it work properly in my out-of-tree build.  Thank you!

-- 
- Julian

Re: [PATCH] Fix tests failing on Debian due to lack of 'python' command.

Posted by Yasuhito FUTATSUKI <fu...@yf.bsdclub.org>.
On 2021/03/31 23:53, Julian Foad wrote:
>> I've commited the former of above candidates (using script_dir at runtime).
> 
> Hello.  I just noticed this change makes some tests fail for me.  I am using an out-of-tree build.  What seems to be happening is it is now building "subversion/tests/cmdline/svneditor.sh" in the obj-dir (which is not in the source tree) but then at test-running time it is searching for "subversion/tests/cmdline/svneditor.sh" in the source tree, and not finding it.  (Only the ".in" version of that file is in the source tree.)
> 
> Would you be able to check and fix this?

Ah, thank you for the report. I confirmed the issue.

Here is a patch addressing it.

[[[
Follow up to r188732: Fix the invocation of svneditor.sh on out of tree build.

* subversion/tests/cmdline/svneditor.sh.in ():
  Specify the absolute path for svneditor.py, instead of relative path from
  the script on execution.

* subversion/tests/cmdline/svntest/main.py (svneditor_script):
  Build the absolute path by using absolute path of current working directory
  on execution, like entries-dump or lock-helper, instead of using path of
  module self.

Index: subversion/tests/cmdline/svneditor.sh.in
===================================================================
--- subversion/tests/cmdline/svneditor.sh.in	(revision 1887713)
+++ subversion/tests/cmdline/svneditor.sh.in	(working copy)
@@ -25,5 +25,4 @@
 #    under the License.
 ######################################################################
 
-script_dir=`dirname "$0"`
-exec @PYTHON@ "$script_dir"/svneditor.py "$@"
+exec @PYTHON@ "@abs_srcdir@"/svneditor.py "$@"
Index: subversion/tests/cmdline/svntest/main.py
===================================================================
--- subversion/tests/cmdline/svntest/main.py	(revision 1887713)
+++ subversion/tests/cmdline/svntest/main.py	(working copy)
@@ -129,7 +129,10 @@ else:
 if windows:
   svneditor_script = os.path.join(sys.path[0], 'svneditor.bat')
 else:
-  svneditor_script = os.path.join(sys.path[0], 'svneditor.sh')
+  # This script is in the build tree, not in the source tree.  
+  svneditor_script = os.path.join(os.path.dirname(
+                                      os.path.dirname(os.path.abspath('.'))),
+                                  'tests/cmdline/svneditor.sh')
 
 # Username and password used by the working copies
 wc_author = 'jrandom'
]]]

Cheers,
-- 
Yasuhito FUTATSUKI <fu...@yf.bsclub.org>

Re: [PATCH] Fix tests failing on Debian due to lack of 'python' command.

Posted by Julian Foad <ju...@apache.org>.
> I've commited the former of above candidates (using script_dir at runtime).

Hello.  I just noticed this change makes some tests fail for me.  I am using an out-of-tree build.  What seems to be happening is it is now building "subversion/tests/cmdline/svneditor.sh" in the obj-dir (which is not in the source tree) but then at test-running time it is searching for "subversion/tests/cmdline/svneditor.sh" in the source tree, and not finding it.  (Only the ".in" version of that file is in the source tree.)

Would you be able to check and fix this?

- Julian


Re: [PATCH] Fix tests failing on Debian due to lack of 'python' command.

Posted by Yasuhito FUTATSUKI <fu...@yf.bsdclub.org>.
On 2021/03/03 4:05, Daniel Shahaf wrote:
> Yasuhito FUTATSUKI wrote on Tue, 02 Mar 2021 03:21 +00:00:
>> On 2021/03/02 0:41, Daniel Shahaf wrote:
>>> Yasuhito FUTATSUKI wrote on Mon, Mar 01, 2021 at 10:55:51 +0900:
>>>> +++ subversion/tests/cmdline/svneditor.sh.in	(working copy)
>>>> @@ -0,0 +1,40 @@
>>>> +print_python_path()
>>>> +{
>>>> +cat <<"_SVN_EOF"
>>>> +@PYTHON@x
>>>> +_SVN_EOF
>>>> +}
>>>
>>> I don't see any value of @PYTHON@ that would benefit from being
>>> carefully unescaped like this, since Makefile.in already assumes that
>>> @PYTHON@ can be used either bare or in double quotes:
>>
>> Then, it is just same for expansion of @abs_srcdir@. As the use of
>> abs_srcdir in Makefile is not quoted, expansion of @abs_srcdir@ in
>> svneditor.sh can be used without quotes, putting aside which is
>> good embedding path statically or setting it at run time.
>>
> 
> +1
> 
>>>> +python="$(print_python_path)"
>>>> +python="${python%x}"
>>>> +
>>>> +script_dir="`cd $(dirname "$0"); pwd`"
>>>> +
>>>
>>> If «$0» needs quoting, then quotes are needed around the «$(…)»
>>> construct as well.
>>
>> Sure. And the result of the observation above, bare $0 can be used here,
>> unless the scripts are moved or copied to another place.
> 
> I don't agree with this part.  If we use a bare $0 and someone tries to
> update the build system to support $abs_srcdir/$abs_builddir with spaces
> (this was looked into at some point in the past), they'll have one more
> mole to whack; and if someone cribs the code from this script into
> another script where the assumption 'The dirname of $0 doesn't include
> spaces' doesn't hold, they'll have to notice the the double quotes'
> absence and add them, or else they'll have a bug waiting to manifest;
> whereas if we double-quote the $0, there's no downside.
> 
>> To launch svneditor.py script $script_dir can be relative path, this
>> can be simply,
>>
>>     script_dir=`dirname "$0"`
>>
>> Thus, a launcher script (without file header) can be
>>
>> [[[
>> script_dir=`dirname "$0"`
>> exec @PYTHON@ "$script_dir"/svneditor.py "$@"
>> ]]]
>>
> 
> +1.001
> 
>> or one in previous revision of patch (B).
> 
> +1
 
I've commited the former of above candidates (using script_dir at runtime).

Cheers,
-- 
Yasuhito FUTATSUKI <fu...@yf.bsclub.org>

Re: [PATCH] Fix tests failing on Debian due to lack of 'python' command.

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Yasuhito FUTATSUKI wrote on Tue, 02 Mar 2021 03:21 +00:00:
> On 2021/03/02 0:41, Daniel Shahaf wrote:
> > Yasuhito FUTATSUKI wrote on Mon, Mar 01, 2021 at 10:55:51 +0900:
> >> +++ subversion/tests/cmdline/svneditor.sh.in	(working copy)
> >> @@ -0,0 +1,40 @@
> >> +print_python_path()
> >> +{
> >> +cat <<"_SVN_EOF"
> >> +@PYTHON@x
> >> +_SVN_EOF
> >> +}
> > 
> > I don't see any value of @PYTHON@ that would benefit from being
> > carefully unescaped like this, since Makefile.in already assumes that
> > @PYTHON@ can be used either bare or in double quotes:
> 
> Then, it is just same for expansion of @abs_srcdir@. As the use of
> abs_srcdir in Makefile is not quoted, expansion of @abs_srcdir@ in
> svneditor.sh can be used without quotes, putting aside which is
> good embedding path statically or setting it at run time.
> 

+1

> >> +python="$(print_python_path)"
> >> +python="${python%x}"
> >> +
> >> +script_dir="`cd $(dirname "$0"); pwd`"
> >> +
> > 
> > If «$0» needs quoting, then quotes are needed around the «$(…)»
> > construct as well.
> 
> Sure. And the result of the observation above, bare $0 can be used here,
> unless the scripts are moved or copied to another place.

I don't agree with this part.  If we use a bare $0 and someone tries to
update the build system to support $abs_srcdir/$abs_builddir with spaces
(this was looked into at some point in the past), they'll have one more
mole to whack; and if someone cribs the code from this script into
another script where the assumption 'The dirname of $0 doesn't include
spaces' doesn't hold, they'll have to notice the the double quotes'
absence and add them, or else they'll have a bug waiting to manifest;
whereas if we double-quote the $0, there's no downside.

> To launch svneditor.py script $script_dir can be relative path, this
> can be simply,
> 
>     script_dir=`dirname "$0"`
> 
> Thus, a launcher script (without file header) can be
> 
> [[[
> script_dir=`dirname "$0"`
> exec @PYTHON@ "$script_dir"/svneditor.py "$@"
> ]]]
> 

+1.001

> or one in previous revision of patch (B).

+1

Cheers,

Daniel

Re: [PATCH] Fix tests failing on Debian due to lack of 'python' command.

Posted by Yasuhito FUTATSUKI <fu...@yf.bsdclub.org>.
On 2021/03/02 0:41, Daniel Shahaf wrote:
> Yasuhito FUTATSUKI wrote on Mon, Mar 01, 2021 at 10:55:51 +0900:
>> 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:

>>>> (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.
> 
> Thanks for the revision.  I'm happy to leave it to you to choose between
> the two versions of (B).  I'll just share two (more) observations:

Thank you.

>> +++ subversion/tests/cmdline/svneditor.sh.in	(working copy)
>> @@ -0,0 +1,40 @@
>> +print_python_path()
>> +{
>> +cat <<"_SVN_EOF"
>> +@PYTHON@x
>> +_SVN_EOF
>> +}
> 
> I don't see any value of @PYTHON@ that would benefit from being
> carefully unescaped like this, since Makefile.in already assumes that
> @PYTHON@ can be used either bare or in double quotes:

Then, it is just same for expansion of @abs_srcdir@. As the use of
abs_srcdir in Makefile is not quoted, expansion of @abs_srcdir@ in
svneditor.sh can be used without quotes, putting aside which is
good embedding path statically or setting it at run time.

>> +python="$(print_python_path)"
>> +python="${python%x}"
>> +
>> +script_dir="`cd $(dirname "$0"); pwd`"
>> +
> 
> If «$0» needs quoting, then quotes are needed around the «$(…)»
> construct as well.

Sure. And the result of the observation above, bare $0 can be used here,
unless the scripts are moved or copied to another place. To launch
svneditor.py script $script_dir can be relative path, this can be simply,

    script_dir=`dirname "$0"`

Thus, a launcher script (without file header) can be

[[[
script_dir=`dirname "$0"`
exec @PYTHON@ "$script_dir"/svneditor.py "$@"
]]]

or one in previous revision of patch (B).

Cheers,
-- 
Yasuhito FUTATSUKI <fu...@yf.bsclub.org>

Re: [PATCH] Fix tests failing on Debian due to lack of 'python' command.

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Yasuhito FUTATSUKI wrote on Mon, Mar 01, 2021 at 10:55:51 +0900:
> 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.

Thanks for the revision.  I'm happy to leave it to you to choose between
the two versions of (B).  I'll just share two (more) observations:

> +++ subversion/tests/cmdline/svneditor.sh.in	(working copy)
> @@ -0,0 +1,40 @@
> +print_python_path()
> +{
> +cat <<"_SVN_EOF"
> +@PYTHON@x
> +_SVN_EOF
> +}

I don't see any value of @PYTHON@ that would benefit from being
carefully unescaped like this, since Makefile.in already assumes that
@PYTHON@ can be used either bare or in double quotes:

% grep -n @PYTHON@ Makefile.in
398:PYTHON = @PYTHON@
% fgrep -n '$(PYTHON)' Makefile.in
551:    @if test "$(PYTHON)" != "none"; then                                 \
629:      $(PYTHON) $(top_srcdir)/build/run_tests.py                         \
657:    @env PYTHON=$(PYTHON) THREADED=$(THREADED) MAKE=$(MAKE) \
⋮
% 

> +python="$(print_python_path)"
> +python="${python%x}"
> +
> +script_dir="`cd $(dirname "$0"); pwd`"
> +

If «$0» needs quoting, then quotes are needed around the «$(…)»
construct as well.

Personally, I'd use two sets of «--» guards as well (one for «cd» and
one for «dirname»), even if there's no (current) case where that
matters.  Readability and cribbing compatibility are things.

Cheers,

Daniel

> +exec "$python" "$script_dir"/svneditor.py "$@"

Re: [PATCH] Fix tests failing on Debian due to lack of 'python' command.

Posted by Yasuhito FUTATSUKI <fu...@yf.bsdclub.org>.
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 <fu...@yf.bsclub.org>

Re: [PATCH] Fix tests failing on Debian due to lack of 'python' command.

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
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.

Re: [PATCH] Fix tests failing on Debian due to lack of 'python' command.

Posted by Yasuhito FUTATSUKI <fu...@yf.bsdclub.org>.
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,
-- 
Yasuhito FUTATSUKI <fu...@yf.bsclub.org>