FS#40975 - [python2][gnome-tweak-tool] Add startup application doesn't work

Attached to Project: Arch Linux
Opened by Valdemar E. Winther (harrim4n) - Wednesday, 25 June 2014, 19:36 GMT
Last edited by Eli Schwartz (eschwartz) - Monday, 02 October 2017, 21:03 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Angel Velasquez (angvp)
Jan Alexander Steffens (heftig)
Felix Yan (felixonmars)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

Description:
Under the tab Startup Applications it is not possible to add a new application.

Additional info:
* Version : 3.12.0-1
* Clicking the "+" button produces this output:

Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/gtweak/tweaks/tweak_group_startup.py", line 194, in _on_add_clicked
set(self._get_running_executables()))
File "/usr/lib/python2.7/site-packages/gtweak/tweaks/tweak_group_startup.py", line 210, in _get_running_executables
os.getlogin(),'-o','cmd'],
OSError: [Errno 2] No such file or directory

* This appears to fix the problem: https://bbs.archlinux.org/viewtopic.php?pid=1414443#p1414443 (I haven't tried it though)


Steps to reproduce:
* Open gnome-tweak-tool
* Go to "Startup Applications"
* Try adding an application by clicking the "+" button on the bottom.

This task depends upon

Closed by  Eli Schwartz (eschwartz)
Monday, 02 October 2017, 21:03 GMT
Reason for closing:  Fixed
Additional comments about closing:  fixed in 2014 via https://bugzilla.gnome.org/show_bug.cgi? id=728231
Comment by Jan Alexander Steffens (heftig) - Saturday, 28 June 2014, 12:11 GMT
This is a problem coming from either python2 (and python) or the kernel.

os.getlogin() first tries to read /proc/self/loginuid (requiring CONFIG_AUDIT=y, which we don't have) and if that doesn't exist, try to determine the user logged in on the process' controlling terminal by reading utmp. Since processes started from X sessions typically don't have a logged-in controlling terminal (unless started from xterm), the call fails.

Personally, I'd like to have AUDIT back, since I was making use of loginuid myself.
Comment by Felix Yan (felixonmars) - Wednesday, 02 July 2014, 10:01 GMT
See http://bugs.python.org/issue584566

So it was a wontfix upstream since more than 10 years ago. I'd suggest to report to the gnome-tweak-tool upstream, according to the BUGS section of getlogin(3), use getpwuid(geteuid()) instead.

In Python, it would be something like this:

>>> pwd.getpwuid(os.getuid())
pwd.struct_passwd(pw_name='felix', pw_passwd='x', pw_uid=1000, pw_gid=100, pw_gecos='Felix Yan', pw_dir='/home/felix', pw_shell='/bin/bash')
Comment by mattia (nTia89) - Sunday, 01 October 2017, 15:08 GMT
fixed now 3.24 (and also upstream)

so we can close it

Loading...