Comment 0 for bug 1828208

Revision history for this message
Dan Streetman (ddstreet) wrote :

[impact]

and application that uses launchpadlib to login to LP, and is run as root (with sudo), will cause launchpadlib to also be run as root. It will then create the $HOME/.launchpadlib directory and cache files with root ownership, but in the non-root user's $HOME directory, since sudo does not do a full login and change the env.

The root-owned ~/.launchpadlib and/or root-owned files under that directory will then cause later failures with other applications that also use launchpadlib, but are not run as root, since launchpadlib will try to update the files, but can't since it is not root.

[test case]

ubuntu@test:~$ ls -lad .launchpadlib
ls: cannot access '.launchpadlib': No such file or directory

ubuntu@test:~$ sudo python3
Python 3.7.3 (default, Apr 3 2019, 05:39:12)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from launchpadlib.launchpad import Launchpad
>>> lp = Launchpad.login_with('sudo-test', service_root='production', version='devel')
The authorization page:
 (https://launchpad.net/+authorize-token?oauth_token=mB9NB4ndzLVswfRHPjHZ&allow_permission=DESKTOP_INTEGRATION)
should be opening in your browser. Use your browser to authorize
this program to access Launchpad on your behalf.
Waiting to hear from Launchpad about your decision...
>>>

ubuntu@test:~$ ls -lad .launchpadlib
drwx------ 3 root root 4096 May 8 10:13 .launchpadlib

[regression potential]

TBD

[other info]

I am updating software-properties to use launchpadlib in bug 645404, and the primary use case there is the 'add-apt-repository' script which must be run as root.