After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 616706 - Make getting the environment from gnome-session more robust
Make getting the environment from gnome-session more robust
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2010-04-24 13:42 UTC by Owen Taylor
Modified: 2010-05-09 20:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Make getting the environment from gnome-session more robust (1.38 KB, patch)
2010-04-24 13:43 UTC, Owen Taylor
reviewed Details | Review
Make getting the environment from gnome-session more robust (1.40 KB, patch)
2010-05-09 18:40 UTC, Owen Taylor
committed Details | Review

Description Owen Taylor 2010-04-24 13:42:44 UTC
readlink() on /proc/<pid>/exe can have results like:

 /usr/bin/gnome-keyring-daemon.#prelink#.5DFZsF (deleted)
 /usr/bin/gnome-session (deleted)

To find gnome-session in a more robust way, read /proc/<pid>/cmdline
instead.
Comment 1 Owen Taylor 2010-04-24 13:43:08 UTC
Created attachment 159472 [details] [review]
Make getting the environment from gnome-session more robust

readlink() on /proc/<pid>/exe can have results like:

 /usr/bin/gnome-keyring-daemon.#prelink#.5DFZsF (deleted)
 /usr/bin/gnome-session (deleted)

To find gnome-session in a more robust way, read /proc/<pid>/cmdline
instead.
Comment 2 Colin Walters 2010-04-24 16:58:43 UTC
Review of attachment 159472 [details] [review]:

::: src/gnome-shell.in
@@ +44,3 @@
             continue
+        command = command.split()[0]
+        command = command.replace("\x00", "")

Shouldn't that be: command = command.split("\x00")
The null character separates the arguments as far as I know, so just dropping them then splitting on whitespace won't work unless the command only has one argument (which is probably why it works for just "gnome-session").
Comment 3 Owen Taylor 2010-05-09 18:40:42 UTC
Created attachment 160652 [details] [review]
Make getting the environment from gnome-session more robust

Same but with:

+        # /proc/cmdline is separated and terminated by NULs
+        command = command.split("\x00")[0]
Comment 4 Colin Walters 2010-05-09 18:51:14 UTC
Review of attachment 160652 [details] [review]:

Looks fine.
Comment 5 Owen Taylor 2010-05-09 20:36:09 UTC
Attachment 160652 [details] pushed as c4406d4 - Make getting the environment from gnome-session more robust