kdesudo incompatibility with kdesu

Bug #258799 reported by hoganrobert on 2008-08-17
Affects Status Importance Assigned to Milestone
kdesudo (Ubuntu)
Nominated for Jaunty by tbjablin

Bug Description

kdesu.distrib -c 'printf \"ControlPort 9051\" >> /etc/tor/torrc' - WORKS
kdesudo -c 'printf \"ControlPort 9051\" >> /etc/tor/torrc' - DOES NOT WORK

The latter reports:

printf: warning: ignoring excess arguments, starting with `9051"'

Related branches

Running kdesudo - 2.5.1-0ubuntu3. Seems related to bug 109831, but was not fixed by the patch applied for it.

More accurate description:

kdesu.distrib -c 'printf "ControlPort 9051\n" >> /etc/tor/torrc' - WORKS
kdesudo -c 'printf "ControlPort 9051\n" >> /etc/tor/torrc' - DOES NOT WORK

The latter gives:

ControlPort 9051
printf: warning: ignoring excess arguments, starting with `>>'

and nothing gets written to /etc/tor/torrc.

The command displayed in the kdesudo dialog is:

printf 'ControlPort 9051\n' '>>' '/etc/tor/torrc'

so each element of the command is being treated as a separate command.

This patch:

- Fixes an infinite loop in 'kdesudo -s'
- Removes a compiler warning.
- Documents the escape sequences and quoting required to run shell commands.
  (Not sure about the docbook patch.)

I've experimented quite a bit with the command parsing required to make
kdesudo functionally equivalent with kdesu. I tried using the parsing found in
kdesu and while this fixes the quoting of each element for some commands, the
fact that kdesudo is not using the Suprocess/ttyprocess and kdesud abstraction
layers seems fatal. The code required to take a naively quoted/escaped command
such as this one used by KDevelop:

kdesu -t -c 'cd '/home/robert/kdesudo-2.6-new' && WANT_AUTOCONF_2_5="1" WANT_AUTOMAKE_1_6="1" LC_MESSAGES="C" LC_CTYPE="C" make install'

and make it work with kdesudo is beyond me. AFAICS, kdesudo would need to prepend
a shell to the command (sh -c) and properly quote and escape each element before
passing it to sudo. This would be a huge job and extremely brittle.

Since kdesudo is kubuntu-specific the more pragmatic approach would seem to be to
document the command format kdesudo requires and patch kdesu-using packages as

So kubuntu-KDevelop should use:

kdesudo -t -c "sh -c 'cd '/home/robert/kdesudo-2.6-new' && WANT_AUTOCONF_2_5=\"1\" WANT_AUTOMAKE_1_6=\"1\" LC_MESSAGES=\"C\" LC_CTYPE=\"C\" make install'"

This could also be passed upstream since it also works with kdesu.distrib.

For my own case the command required by kdesudo is:

kdesudo -c "sh -c 'printf \"ControlPort 9051\n\" >> /etc/tor/torrc'"

This also works with kdesu.distrib.

Changed in kdesudo:
status: New → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package kdesudo - 3.4.2-0ubuntu1

kdesudo (3.4.2-0ubuntu1) karmic; urgency=low

  [ Anthony Mercatante ]
  * New upstream release:
    - Closes LP: #281877
    - Closes LP: #258799
    - Closes Debian #525292
    - Closes LP: #365956

  [ Florian Reinhard ]
  * Closes LP: #285084

 -- Florian Reinhard <email address hidden> Thu, 25 Jun 2009 23:02:47 +0200

Changed in kdesudo (Ubuntu):
status: New → Fix Released
Changed in kdesudo:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers