Issue 4601: directory permission error with make install in 3.0 (original) (raw)
Created on 2008-12-08 21:27 by legerf, last changed 2022-04-11 14:56 by admin. This issue is now closed.
Messages (11)
Author: Leger (legerf)
Date: 2008-12-08 21:27
Under Debian/Lenny, with Python3.0.final install from the tarball, any user can't import lib-dynload, launch IDLE ... but local root can do them.
When I login in root and run "chmod -R o+rx /usr/lib/python3.0/*", users can use normaly python3.0.
Install detail : "configure --with-pydebug --with-doc-strings --enable-shared --enable-profiling --enable-ipv6 --with-threads --with-tsc --prefix=/usr ; make ; make test" and after "make altinstall
altinstall.log 2>&1". I join altinstall.log.
Author: Leger (legerf)
Date: 2008-12-08 21:59
My root umask = 0027 (hardened system), so the altinstall/install script don't manage umask parameter.
Author: STINNER Victor (vstinner) *
Date: 2008-12-08 22:10
I'm able to reproduce the bug with umask set to 0027: drwxr-x--- 2 root root 3072 déc 8 22:59 (...)/lib/python3.1/lib-dynload
With umask 0077, it's: drwx------ 2 root root 3072 déc 8 22:59 (...)/lib/python3.1/lib-dynload
The problem is specific to this directory.
Author: STINNER Victor (vstinner) *
Date: 2008-12-08 22:27
install() method of the install_lib command (Lib/distutils/command/install_lib.py) calls self.copy_tree() which calls copy_tree() from Lib/distutils/dir_util.py. By default, this function preserve the modes (perserve_mode=1 by default). Or the build created a directory with permissions "drwx------".
I wrote that only lib-dynload directory has a problem. But other files are install with permissions -rw-------:
- .../lib/python?.?/*.{pyc,pyo}
- .../lib/python?.?/lib2to3/PatternGrammar*.pickle
- .../lib/python?.?/lib2to3/Grammar*.pickle
- .../lib/python?.?/lib-dynload/Python*.egg-info
Author: STINNER Victor (vstinner) *
Date: 2008-12-08 22:38
With Python trunk, the directory has the right permission (drwxr-xr-x) whereas build/lib.linux(...) has permission drwx------.
But the problem is still open for listed files (.pyc, .pyo, .picle, .egg-info).
Author: STINNER Victor (vstinner) *
Date: 2008-12-08 23:34
Gotcha! os.path.walk() was replaced by os.walk() but walk() argument is no more a callback because walk() is a generator! Here is a fix.
Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) *
Date: 2008-12-09 11:57
The patch is fine.
If it were me, I'd change os.walk to accept keyword-only arguments: def walk(top, *, topdown=True, onerror=None, followlinks=False): ...
Author: STINNER Victor (vstinner) *
Date: 2008-12-09 12:19
Hum, there is not fixer for 2to3. But I might be hard to write such fixer because walk() generates (dirpath, dirnames, filenames) instead of (dirpath, filenames).
Python2 prototype: os.path.walk(path, visit, arg) -> None with visit: callback(arg, dirpath, filenames)
Python3 prototype: os.walk(top[, topdown=True[, onerror=None[, followlinks=False]]]) -> generator with onerror: callback() the generator produces (dirpath, dirnames, filenames)
Example: os.path.walk('Lib/xml/', callback, 42) can be replaced by for dirpath, dirnames, filenames in os.walk('Lib/xml/'): callback(42, dirpath, dirnames + filenames)
About the keyword only: +1 (or +2 :-)).
Index: Lib/os.py
--- Lib/os.py (révision 67652) +++ Lib/os.py (copie de travail) @@ -192,7 +192,7 @@
all.extend(["makedirs", "removedirs", "renames"])
-def walk(top, topdown=True, onerror=None, followlinks=False): +def walk(top, *, topdown=True, onerror=None, followlinks=False): """Directory tree generator.
For each directory in the directory tree rooted at top (including
top
Author: STINNER Victor (vstinner) *
Date: 2009-03-24 23:51
amaury> The patch is fine.
Cool :-) Anyone to commit the fix? Maybe, tarek?
amaury> If it were me, I'd change os.walk to accept amaury> keyword-only arguments: amaury> def walk(top, *, topdown=True, onerror=None, amaury> followlinks=False): amaury> ...
I like the idea but it should be proposed in a new issue :-) I proposed an API change for open() (issue #4121) but it was rejected by Guido:
"(...) Beyond 3.0, I'm still rather reluctant -- I expect most users will be wise and use keyword args anyway; I'm not sure what we buy by forcing this. (...)"
But walk() is a different case than open().
Author: STINNER Victor (vstinner) *
Date: 2009-07-02 16:47
ping
Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) *
Date: 2009-07-02 23:57
Ok, fixed in r73788 and r73789.
History
Date
User
Action
Args
2022-04-11 14:56:42
admin
set
github: 48851
2009-07-02 23:57:32
amaury.forgeotdarc
set
status: open -> closed
resolution: accepted -> fixed
messages: +
2009-07-02 16:47:00
vstinner
set
messages: +
2009-03-24 23:51:43
vstinner
set
nosy: + tarek
messages: +
2008-12-09 12:19:38
vstinner
set
messages: +
2008-12-09 11:57:11
amaury.forgeotdarc
set
resolution: accepted
messages: +
nosy: + amaury.forgeotdarc
2008-12-08 23:34:09
vstinner
set
files: + setup_chmod.patch
keywords: + patch
title: permissions errors with altinstall in 3.0 -> directory permission error with make install in 3.0
messages: +
versions: - Python 2.6, Python 2.7
2008-12-08 22:38:49
vstinner
set
messages: +
2008-12-08 22:27:56
vstinner
set
messages: +
components: + Distutils, - Library (Lib)
versions: + Python 2.6, Python 3.1, Python 2.7
2008-12-08 22:10:08
vstinner
set
nosy: + vstinner
messages: +
2008-12-08 21:59:55
legerf
set
messages: +
2008-12-08 21:27:52
legerf
create