Package: hibernate
Version: 1.96~pre-svn.r1136-1
Severity: wishlist
Hello
The sylpheed_claws scriptlet makes the implicit assumption that the XAUTHORITY
variable is exported when calling get_env_var_of_process.
Given my poor understanding of the X session mechanism, I might probably be
wrong, but I suspect that XAUTHORITY is not always exported and that even more,
it is not mandatory at all to export it.
Provided the here above assumption is correct, the xauthority variable obtained
thru get_env_var_of_process might sometimes be empty and the commands using the
variable in the scriptlet might fail.
Shouldn't sylpheed_claws scriptlet make the additional checking that xauthority
variable is not empty and fall back to $HOME/.Xauthority to give itself a
chance to succeed? It seems that it is what the main script does within
FindXServer(): it does not rely only on /proc/<pid>/environ and proceeds to
additional checkings.
The proposed patch for sylpheed_claws in attachment is inspired by
FindXServer() and proceeds to the same checkings. It applies to current SVN
upstream trunk (rev. 1161).
In the other hand I might be completely wrong because maybe my
x-session-manager does not behave correctly or because I should always export
XAUTHORITY in my .Xession (I used to export XAUTHORITY as a simple mean to be
able to launch X applications after su to root but I recently dropped it in
favor of pam_xauth...and hibernate is the only drawback I found).
Best regards.
Pascal D.
--- sylpheed_claws 2007-10-15 20:55:33.000000000 +0200
+++ sylpheed_claws.new 2007-10-15 21:37:20.000000000 +0200
@@ -20,11 +20,17 @@
local pid i=0
for pid in `pidof sylpheed-claws`; do
- local user display xauthority
+ local user display xauthority xhome
+
+ [ -d "/proc/$pid/" ] || continue
user=$(get_env_var_of_process $pid USER)
display=$(get_env_var_of_process $pid DISPLAY)
xauthority=$(get_env_var_of_process $pid XAUTHORITY)
+ xhome=$(get_env_var_of_process $pid HOME)
+ [ -z $xauthority ] && [ -n $xhome ] && [ -f $xhome/.Xauthority ] && xauthority=$xhome/.Xauthority
+
+ [ -z $xauthority ] && continue
# using this eval-crap to be POSIX-compliant (arrays are nonstandard)
eval "SYLPHEEDCLAWS_LOGGED_OUT_SESSIONS_USER_$i='$user'"