I've used (you need libcap2-bin for setcap) sudo setcap cap_sys_nice=eip /usr/bin/python2.5 to allow python scripts to adjust nice levels/choose scheduler. Unfortunately it obscures fakeroot call, since then I get $> fakeroot python ERROR: ld.so: object 'libfakeroot-sysv.so' from LD_PRELOAD cannot be preloaded: ignored. Python 2.5.4 (r254:67916, Feb 18 2009, 03:00:47) [GCC 4.3.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. and that brakes pycentral: $> fakeroot dh_pycentral -i dh_pycentral: Unable to parse python version out of "ERROR: ld.so: object 'libfakeroot-sysv.so' from LD_PRELOAD cannot be preloaded: ignored. Python 2.5.4 ". since it relies on parsing stderr as it contains output from python --version
I'm not sure what we can do here; I don't think we want to obscure the fact that LD_PRELOAD has been disabled for security reasons.
Hi Clint, do you mean that executables with any capabilities (or even just cap_sys_nice) set are considered insecure and LD_PRELOAD is explicitly disallowed so LD_PRELOAD of fakeroot library fails? N.B. fakeroot python whenever python has no cap_sys_nice is doing fine
Yes, it is the same as with setuid/setgid programs. The point is that otherwise you could make a preload library to exploit any capability by subverting one of the functions used by a privileged binary. I'm not sure how fakeroot-ng interacts with capabilities, but perhaps it is more suitable for your use case.
$> fakeroot-ng python --version Python 2.5.4 cool -- thanks for the hint... seems to remain working fine within dpkg-buildpackage ;) I just wonder now what to do with the bug -- apparently it is a feature ;) but may be error message could be made more informative/relevant?
Clint Adams wrote: For SUID, fakeroot means that the program runs with privileges but without fakeroot's wrapping. Fakeroot-ng means that program runs without the (real) privileges, but with fakeroot-ng's wrapping. I'm not sure about capabilities, but it's definitely worth giving it a try. Shachar
Yaroslav Halchenko wrote: This is not a bug. It's a design limitation. I'm not even sure fakeroot has the option of detecting when this limitation is about to trigger (at least, not in a sane way). Shachar
I think this is not a bug of fakeroot but of python-central!
If dh_pycentral wants to find the Python version somewhere in stderr it
should use a damn good parser!
I suggest to use one of the following statements instead of trying to
parse stderr!
# New in version 2.3.
$ python -c "import platform;print(platform.python_version())"
2.6.6rc2
# New in version 2.0.
$ python -c "import sys;print(sys.version_info)"
(2, 6, 6, 'candidate', 2)
# New in version 2.3.
$ python -c "import platform;print(platform.python_version_tuple())"
('2', '6', '6rc2')
# New in version 1.5.2.
$ python -c "import sys;print(hex(sys.hexversion))"
0x20606c2
# Should not be used as of http://docs.python.org/library/sys.html
$ python -c "import sys;print(sys.version)"
2.6.6rc2 (r266rc2:84114, Aug 18 2010, 07:33:44)
[GCC 4.4.5 20100816 (prerelease)]
BTW.
Calling dh_pycentral from a non exeisting directory results into the
same error.