Project

General

Profile

Bug #16658

#! line on samweb script breaks on sl7 if LD_LIBRARY_PATH is set

Added by Marc Mengel over 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
Start date:
05/24/2017
Due date:
% Done:

100%

Estimated time:
Duration:

Description

If you've setup any ups products that set LD_LIBRARY_PATH, the /usr/bin/python -SE gets confused and cannot find its libraries on SL7.

This means that the #! /usr/bin/python -SE line at the top of the samweb script fails.

Is there some reason we can't just make it #!/usr/bin/env python or #!/usr/bin/env python2

Associated revisions

Revision 3c5d2c53 (diff)
Added by Robert Illingworth over 2 years ago

Add shell script to clean the environment before invoking the python code. Resolves #16658

History

#1 Updated by Robert Illingworth over 2 years ago

That was very deliberately done so that setting up any ups version of python and setting any PYTHON* environment variables would not affect it.

What libraries is it not finding?

#2 Updated by Robert Illingworth over 2 years ago

I can't reproduce this - it works fine for me on SL7 with ifdhc setting LD_LIBRARY_PATH.

#3 Updated by Robert Illingworth over 2 years ago

What will break is if you set LD_LIBRARY_PATH to a directory containing some other version of libpython2.7.so.1.0 . But if you do that (masking what's essentially a system library) you're well into shooting yourself in the foot territory.

#4 Updated by Marc Mengel over 2 years ago

CC: Marc Paterno <>
From: Chris Green <>
Subject: More python / samweb info
Hi,

So /usr/bin/python has no rpath, so it depends on LD_LIBRARY_PATH to
find libpython2.7.so.1.0. It didn't trigger on SLF6 because
/usr/bin/python is looking for libpython2.6.so.1.0, which is not
overridden by our setup of python v2_7_13d.

Best,

Chris.

#5 Updated by Marc Mengel over 2 years ago

So basically it's confused on SLF7 becuase the system python is python 2.7, and the python being setup by the various experiment environments is also a python 2.7, and it finds their python2.7.so.1.0 rather than the system one, and then it can't seem to find its brains.

However, I think samweb runs fine in various pythons that we would be setting up, so having it run with #!/usr/bin/env python ought to work(?).

#6 Updated by Robert Illingworth over 2 years ago

I've had painful experience in the past with things breaking because of weird stuff in the environment. So this is intended to work with whatever broken combinations of PYTHONPATH, PYTHONHOME, etc that people come up with. I suppose this is just a new variation. But I certainly don't trust that '/usr/bin/env python' will necessarily work correctly.

#7 Updated by Robert Illingworth over 2 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

#8 Updated by Robert Illingworth over 2 years ago

I've just pushed an update that should make this work.

As a bonus, there's now a samweb.py script - if you run samweb you get /usr/bin/python2 with a cleaned environment; if you run samweb.py it'll run with "/usr/bin/env python2" so you'll get anything you might have configured locally.

#9 Updated by Robert Illingworth about 2 years ago

  • Target version set to v2_2

#10 Updated by Robert Illingworth about 2 years ago

  • Status changed from Resolved to Closed


Also available in: Atom PDF