Suppose we are already root. Then,
# xdg-su -c whoami
Should simply print "root" without any difficulty. Instead,
Command (xdg-su -c whoami) gave exit code 3, expected 0
Incorrect output written to stdout, as shown below
Unexpected output written to stderr, as shown below:
stderr:xdg-su: no graphical method available for invoking 'whoami' as 'root'
See test case xdg-su/t.su_basic_asroot
Defer till after 1.0
xdg-su will be dropped from 1.0 release
works perfectly here
#./xdg-su -c whoami
can you still reproduce with a cvs snapshot ?
I can still reproduce this problem here:
# DISPLAY= xdg-su -c whoami
xprop: unable to open display ''
./xdg-su: 304: [: x: unexpected operator
xdg-su: no graphical method available for invoking 'whoami' as 'root'
xdg-su does say that it's meant 'for use inside a desktop session only'. But I still feel it would make sense to fix this (see the attached patch).
Created attachment 71041 [details] [review]
Don't depend on $DISPLAY if already in the right account
This bug is still present in b110b355 (2015/11/12).
Personally I don't think it makes sense to run xdg-su outside a graphical session, if one launches a desktop file calling xdg-su then a graphical prompt needs to be shown to ask for the password. If you are running from a terminal using "su -c".
There is of course the issues around wayland where I don't think xdg-su works currently.
-- GitLab Migration Automatic Message --
This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.
You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xdg/xdg-utils/issues/14.