Ticket #1126 (closed defect: wontfix)
/usr/athena/bin/python breaks with /usr/athena symlink
Reported by: | andersk | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | The Distant Future |
Component: | -- | Keywords: | |
Cc: | Fixed in version: | debathena-python-config 1.0 | |
Upstream bug: |
Description
debathena / python / jdreed 2011-09-21 16:42:37 (This zephyr does not necessarily reflect the views of IS&T, MIT, its) WTF? $ python -V Python 2.7.1+ $ python -c 'import platform;print platform.python_version()' 2.7.1+ $ /usr/athena/bin/python -V Python 2.7.1+ $ /usr/athena/bin/python -c 'import platform;print platform.python_version()' Traceback (most recent call last): File "/usr/athena/lib/python2.7/site.py", line 562, in <module> main() File "/usr/athena/lib/python2.7/site.py", line 544, in main known_paths = addusersitepackages(known_paths) File "/usr/athena/lib/python2.7/site.py", line 271, in addusersitepackages user_site = getusersitepackages() File "/usr/athena/lib/python2.7/site.py", line 246, in getusersitepackages user_base = getuserbase() # this will also set USER_BASE File "/usr/athena/lib/python2.7/site.py", line 236, in getuserbase USER_BASE = get_config_var('userbase') File "/usr/athena/lib/python2.7/sysconfig.py", line 558, in get_config_var return get_config_vars().get(name) File "/usr/athena/lib/python2.7/sysconfig.py", line 457, in get_config_vars _init_posix(_CONFIG_VARS) File "/usr/athena/lib/python2.7/sysconfig.py", line 310, in _init_posix raise IOError(msg) IOError: invalid Python installation: unable to open /usr/athena/local/lib/python2.7/config/Makefile (No such file or directory) debathena / python / jdreed 2011-09-21 16:43:24 (This zephyr does not necessarily reflect the views of IS&T, MIT, its) (this is on, like, natty) debathena / python / andersk 2011-09-21 16:45:04 (Anders Kaseorg) Haha, /usr/athena. debathena / python / jdreed 2011-09-21 16:44:21 (This zephyr does not necessarily reflect the views of IS&T, MIT, its) so not the point debathena / python / andersk 2011-09-21 16:49:02 (Anders Kaseorg) A workaround is python -S. debathena / python / jdreed 2011-09-21 16:52:59 (This zephyr does not necessarily reflect the views of IS&T, MIT, its) Wait, what about /usr/athena is causing it to lose? If I symlink python into /usr/local/bin or even /opt/bin it's fine debathena / python / andersk 2011-09-21 16:56:18 (Anders Kaseorg) python being symlinked is different from its containing directory being symlinked. debathena / python / andersk 2011-09-21 17:01:31 (Anders Kaseorg) From my sysconfig.py (on oneiric, which has the same problem): def _get_makefile_filename(): if _PYTHON_BUILD: return os.path.join(_PROJECT_BASE, "Makefile") return os.path.join(get_path('platstdlib').replace("/usr/local","/usr",1), "config" + (sys.pydebug and "_d" or ""), "Makefile") and /usr/athena/local doesn’t match that. debathena / python / jdreed 2011-09-21 17:02:17 (This zephyr does not necessarily reflect the views of IS&T, MIT, its) I don't, then, understand why this still works: jdreed@infinite-loop:~$ sudo ln -nsf /usr /opt/usr [sudo] password for jdreed: jdreed@infinite-loop:~$ /opt/usr/bin/python -c 'import platform;print platform.python_version()' 2.7.1+ debathena / python / andersk 2011-09-21 17:03:51 (Anders Kaseorg) Because /opt/usr/local does match that. debathena / python / jdreed 2011-09-21 17:03:54 (This zephyr does not necessarily reflect the views of IS&T, MIT, its) Hrm. We should probably still care somehow, since we just broke our compatibility layer without telling anyone debathena / python / andersk 2011-09-21 17:05:11 (Anders Kaseorg) $ sudo ln -nsf /usr /opt/usr $ /opt/usr/bin/python -c '' $ sudo ln -nsf /usr /opt/rsu $ /opt/rsu/bin/python -c '' … IOError: invalid Python installation: unable to open /opt/rsu/local/lib/python2.7/config/Makefile (No such file or directory) debathena / python / andersk 2011-09-21 17:08:55 (Anders Kaseorg) Well, uh, you can read debian/patches/distutils-install-layout.diff, cry, and file a hilarious Debian bug? debathena / python / andersk 2011-09-21 17:13:06 (Anders Kaseorg) It looks like it would work if /usr/athena/bin was the symlink instead of /usr/athena?
Change History
comment:2 in reply to: ↑ 1 Changed 12 years ago by kaduk
Replying to jdreed:
It looks like it would work if /usr/athena/bin was the symlink instead of /usr/athena?
Is there a good reason not to do this? What would break? This is certainly easier than debathena-python-config, and if you have /usr mounted somewhere other than /usr _AND_ still rely on /usr/athena/bin working, then we don't have to support you.
mkdir -p /usr/athena for d in bin include lib sbin share; do sudo ln -nsf /usr/$d /usr/athena/$d done
Karl notes on zephyr that this produces surprising behavior if the filesystem normally mounted at /usr is mounted someplace else. Though perhaps a relative symlink would work? I haven't followed closely enough to tell.
comment:3 follow-up: ↓ 5 Changed 12 years ago by jdreed
Greg notes that changing the symlink target to, e.g. ../bin will work if the filesystem is mounted somewhere else, and also fixes the python issue. Should we just do that?
jdreed@infinite-loop:~$ sudo ln -nsf ../bin /usr/athena/bin jdreed@infinite-loop:~$ ls -l /usr/athena/bin lrwxrwxrwx 1 root root 6 Aug 1 12:30 /usr/athena/bin -> ../bin jdreed@infinite-loop:~$ /usr/athena/bin/python -c ''
comment:4 Changed 12 years ago by jdreed
This doesn't get us closer to deprecation, of course. The right way to do that is probably to provide symlinks for everything that was there under athena 9 (795 in /usr/athena/bin, yay), which whine loudly and then exec their thing anyway, and then eventually pull /usr/athena. But that is not this ticket.
comment:5 in reply to: ↑ 3 Changed 12 years ago by kaduk
Replying to jdreed:
Greg notes that changing the symlink target to, e.g. ../bin will work if the filesystem is mounted somewhere else, and also fixes the python issue. Should we just do that?
jdreed@infinite-loop:~$ sudo ln -nsf ../bin /usr/athena/bin jdreed@infinite-loop:~$ ls -l /usr/athena/bin lrwxrwxrwx 1 root root 6 Aug 1 12:30 /usr/athena/bin -> ../bin jdreed@infinite-loop:~$ /usr/athena/bin/python -c ''
I am happy with doing that and seeing how things work/break.
comment:6 Changed 12 years ago by jdreed
I committed this change in r25755. However, as noted on zephyr (but not e-mail -- *glare*), this likely won't work. And in fact, it doesn't, because of how dpkg unpacks packages.
For maximum lulz, the fix which worked on in comment 5 does not in fact work on Precise. "Yay."
That having been said, removing /usr/athena and replacing it with a directory seems to have no effect on a running perl script launched from /usr/athena/bin/perl. So we can either do something stupid with debathena-python-config, or we can finally deprecate /usr/athena/bin, which I think I'm also fine with doing.
comment:7 Changed 12 years ago by jdreed
- Status changed from new to committed
- Fixed in version set to debathena-python-config 1.0
I committed r25777, though Anders notes this might be "fixed" in Quantal.
Is there a good reason not to do this? What would break? This is certainly easier than debathena-python-config, and if you have /usr mounted somewhere other than /usr _AND_ still rely on /usr/athena/bin working, then we don't have to support you.