Hi, very likely for the same reason root has no ~/bin by default, with the implied goal of reducing "magic" injections into root's environment (and thus reduce any possible attack vectors for code injection or similar surprises).
In human terms "if root decided to be in a project dir with a local .pylintrc, provide that, but don't inject a global one just anywhere". Ciao, Jürgen ________________________________________ Von: [email protected] [[email protected]] im Auftrag von Sylvain Thénault [[email protected]] Gesendet: Freitag, 5. April 2013 10:04 An: Alex Davies Cc: [email protected] Betreff: Re: [Python-projects] pylint run as root - not getting ~/.pylintrd On 04 avril 22:57, Alex Davies wrote: > Hi All, Hi, > If I run pylint as root (I know, I know), it fails to find my .pylintrc file: > > [root@a b]# strace pylint --report n c.py 2>&1 | grep pylintrc > stat("pylintrc", 0x7fff75600e30) = -1 ENOENT (No such file or > directory) > stat(".pylintrc", 0x7fff75600e30) = -1 ENOENT (No such file or > directory) > stat("/etc/pylintrc", 0x7fff75600e30) = -1 ENOENT (No such file or > directory) > > The cause seems to be in pylint/config.py (from latest tarball): > > 90 if 'PYLINTRC' in os.environ and exists(os.environ['PYLINTRC']): > 91 pylintrc = os.environ['PYLINTRC'] > 92 else: > 93 user_home = expanduser('~') > 94 if user_home == '~' or user_home == '/root': > 95 pylintrc = ".pylintrc" > 96 else: > 97 pylintrc = join(user_home, '.pylintrc') > > expanduser() will return a tilde in the case that expanduser isn’t > able to figure out what the home directory is, but I’m not really sure > why we want to set .pylintrc to be in the local directory in the case > that /root is returned; expand user works just fine: > > >>> from os.path import expanduser > >>> expanduser('~') > '/root' > > Can anyone shed light on this? There is probably a good reason why > that “/root” if block is there, which I would like to understand > before considering if a patch to remove it makes sense. This has been there for a while (before migration to hg...). I'm fine to remove this particular case that I can't explain anymore. -- Sylvain Thénault, LOGILAB, Paris (01.45.32.03.12) - Toulouse (05.62.17.16.42) Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations Développement logiciel sur mesure: http://www.logilab.fr/services CubicWeb, the semantic web framework: http://www.cubicweb.org _______________________________________________ Python-Projects mailing list [email protected] http://lists.logilab.org/mailman/listinfo/python-projects _______________________________________________ Python-Projects mailing list [email protected] http://lists.logilab.org/mailman/listinfo/python-projects
