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