[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svnpubsub dependcy problem building RPM's for Subverssion 1.8.0

From: Branko Čibej <brane_at_wandisco.com>
Date: Sat, 22 Jun 2013 23:20:03 +0200

On 22.06.2013 20:09, Nico Kadel-Garcia wrote:
> On Sat, Jun 22, 2013 at 12:02 PM, Branko Čibej <brane_at_wandisco.com> wrote:
>> On 22.06.2013 17:46, Nico Kadel-Garcia wrote:
>>> There's also an issue with inconsistent use of ;/usr/local/bin/pyton,
>>> or "/usr/bin/env python", fo the svnpubsub *.py scripts:
>> That inconsistency is very intentional: some of the python files are
>> hook scripts, and those use the absolute path of the python interpreter
>> because hook scripts are typically executed with an empty environment,
>> and therefore you cannot assume that "#!/usr/bin/env python" will work.
>>> # Canonicalize path to python, correctly
>>> for name in tools/server-side/svnpubsub/*.py; do
>>> sed -i 's|#!/usr/local/bin/python|#!/usr/bin/env python|g' $name
>>> done
>> The above will actually break the hook scripts. At best you can use
>> "#!/usr/bin/python" in those scripts.
> That's trivial to do, fortunately, and it will work fine in an RHEL
> environment, since "/usr/bin/python" is the default system Python.

I did actually mean "the path of the default Python installation" rather
than /usr/bin/python.

> But I'd trust this claim that it breaks things more if I didn't see
> that "#!/usr/bin/env python" scattered all over the Python hook
> scripts in /usr/share/ on RHEL, including the testserver.py and
> watcher.py in the svnpubsub directory. Only these two scripts have
> "#!/usr/local/bin/python"
>
> commit-hook.py
> revprop-change-hook.py

Only these two files are hook scripts. testserver.py and watcher.py are
development tools and aren't really meant for production use.

> I can see an issue if someone installs, and aliases or sets PATH by
> default, for an alternative Python over in /usr/local/bin/python or
> /opt/Python-2.6/bin/python, and winds up confusing "/usr/bin/env
> python" with an incompatible version. I personally think people who
> get that silly get what they deservice, but I'm happy to be a bit
> safer and do it your way.

Let me reiterate: by default, hook scrips are executed with an empty
enviromnent, which means that PATH is not set and "/usr/bin/env python"
will typically find nothing at all. It has nothing to do with using one
or another Python version. While there is now (in 1.8) a way to set the
environment for hook scripts, it is wrong to assume that administrators
will use that mechanism to set the PATH for hook scripts.

If they do, they can also modify the Python invocation. But it's
definitely not up to the Subversion project to mandate how an admin
wants to set up their server.

-- Brane

-- 
Branko Čibej | Director of Subversion
WANdisco // Non-Stop Data
e. brane_at_wandisco.com
Received on 2013-06-22 23:20:37 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.