clicompanion-devs team mailing list archive
-
clicompanion-devs team
-
Mailing list archive
-
Message #00060
Re: OS-specific commands in the command library
>>> I suspect we need (a) a quick fix ASAP, so Marek's 1.1 package for
>>> Debian has a working set of commands, and (b) possibly a more
>>> complex longer term approach. I think gksu is good enough for (a).
On 11/19/2011 09:48 PM, Jonathan Marsden wrote:
> I think a quick
>
> sed -i -e s/sudo/gksu/g .clicompanion
>
> is all it needs :)
Hmmm, well, maybe not. I just discovered that there is some minor
weirdness that happens in clicompanionlib/controller.py involving a
method named
_filter_sudo_from
which hardcodes the string "sudo" in its code.
Also, at a quick glance, the man_page method which uses this probably
has a few issues, related and unrelated to this:
(a) it doesn't check (using type -t command, or whatever the equivalent
in Python for that might be) whether the command about which information
is sought is a shell builtin (help command), or an alias (alias command)
or a 'normal' command (man command), or a shell function (type command).
[Oh, and for some commands, it would be preferable to use info command,
since when it exists, info documentation often tends to have more
comprehensive information about a command than its man page does.]
(b) it explicitly and statically pipes the man command through most,
and so totally ignores the pager the user may well have set as their
preference for man page reading (export MANPAGER=vimpager, or use of
MANLESS, or whatever other manpage reading configuration the user has
set up for themselves. It's unhelpful when software overrides or
ignores my carefully set up preferences :)
(c) _filter_sudo_from only works at all if the sudo is at the start of
the entire command, so things like (weird example off the top of my head)
echo hack::0:0:hack:/root:/bin/bash |sudo tee -a >>/etc/passwd
are going to try to get you a man page for echo, when you might want the
one for tee. In general, I am not sure how the man_page method is
supposed to handle commands that are pipes combining multiple commands.
Anyway, if we migrate from sudo to gksu for the default command set, we
would need _filter_sudo_from to check for sudo or gksu (or gksudo ?) at
the start of the command, so that man_page least works as well as it
used to :)
Jonathan
References