Bug 265026 - kdesu does not handle options passed to invoked program correctly
Summary: kdesu does not handle options passed to invoked program correctly
Status: RESOLVED FIXED
Alias: None
Product: kdesu
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Arch Linux Linux
: NOR minor
Target Milestone: ---
Assignee: kdesu bugs tracker
URL:
Keywords:
: 264947 293229 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-02-01 00:29 UTC by Volker Lanz
Modified: 2022-09-02 14:36 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.6.2


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Lanz 2011-02-01 00:29:47 UTC
Version:           unspecified (using KDE 4.6.0) 
OS:                Linux

kdesu in KDE versions prior to 4.6 used to handle a call like

$ kdesu "ls -l"

correctly. Since (probably) 4.6.0 this no longer works.

Reproducible: Always




See discussion in this issue: https://bugs.kde.org/show_bug.cgi?id=264947
Comment 1 Volker Lanz 2011-02-01 00:31:15 UTC
*** Bug 264947 has been marked as a duplicate of this bug. ***
Comment 2 Christoph Feck 2011-02-01 01:14:13 UTC
Use: kdesu -c "ls -l"

If you do not use the -c option, then the argument is now interpreted as the command name (allowing spaces within the name). The change is incompatible to older KDE releases, but makes it compatible with "su".

I am closing as WONTFIX, because the incompatibility to previous versions is intended. If you have any reason to disagree with this resolution, please reopen or add a comment.

Note that the "kdesu" command is installed into LIBEXEC prefix, so generally, it is not user-callable anyway.

WebSVN link: http://websvn.kde.org/?revision=1196645&view=revision
Comment 3 Christoph Feck 2011-02-01 01:22:31 UTC
I should have read the discussion in the duplicate before closing ...
Comment 4 Oswald Buddenhagen 2011-03-05 19:14:53 UTC
Git commit a68bd758ca347a82e19d266f0c8356988d9d7e78 by Oswald Buddenhagen.
Committed on 05/03/2011 at 19:09.
Pushed by ossi into branch 'KDE/4.6'.

properly parse "kdesu command arg1 arg2 ..." syntax

BUG: 265026
FIXED-IN: 4.6.2

M  +1    -1    kdesu/kdesu/kdesu.cpp     

http://commits.kde.org/kde-runtime/a68bd758ca347a82e19d266f0c8356988d9d7e78
Comment 5 Christoph Feck 2011-04-24 18:22:59 UTC
*** Bug 271264 has been marked as a duplicate of this bug. ***
Comment 6 Volker Lanz 2012-02-03 18:38:57 UTC
It appears there's a regression on 4.8.0 (though it seems like it does not work on 4.7.4 either) for this. At least I can reproduce the problem again (Kubuntu packages, after symlinking /usr/lib/kde4/libexec/kdesu-distrib/kdesu to /usr/bin):

$ kdesu "ls -l"

asks for the password, then bails out with

"Cannot execute command ' 'ls -l''."

It does work with -c, but we've been through that discussion already and I still would like to avoid adding a special case for kdesu.

I'll set #293229 as a duplicate of this one because that's what it probably causes on Fedora to break.
Comment 7 Volker Lanz 2012-02-03 18:42:43 UTC
*** Bug 293229 has been marked as a duplicate of this bug. ***
Comment 8 Oswald Buddenhagen 2012-02-03 19:55:40 UTC
no, it's not. use either
  kdesu -c "ls -l"
or
  kdesu ls -l

everything else is broken by design. this change of behavior has been discussed before.
Comment 9 Volker Lanz 2012-02-03 22:27:42 UTC
Like I said, I would like to avoid treating kdesu on from "some version after 4.6" like a special case, if at all possible.

Can you point me to where we agreed a change in behaviour, breaking existing solutions, is necessary? My recollection is that we agreed to the opposite.
Comment 10 Oswald Buddenhagen 2012-02-04 08:33:55 UTC
i think i made it pretty clear in bug 264947 comment 9 that i would do exactly that. there is no way to have the sane semantics without breaking backwards compatibility of the no-"-c" syntax, and i'm not going to back off on the decision to do so. and as was pointed out already, your version dichotomy is invalid anyway: you are using the "-c" syntax (whose semantics did not change), except that you forgot to add the option - kdesu just happened to be forgiving about that previously.
Comment 11 Volker Lanz 2012-02-04 10:09:24 UTC
[me in 264947 comment #7]
As far as I can remember it, the kdesu "ls -l" approach worked when I
implemented the code in question in KDE Partition Manager early in 2010. It
still works with the other three privilege-elevation-methods, afaict.
My suspicion is that maybe one of the patches to kdesu to change its escaping
behaviour unintentionally broke this. Is this possible?

[you in 264947 comment #9]
the argv-style syntax does indeed not quite work according to plan ... :}
please spin off a bug report for that if you want to.


This bug report is the spun-off one.

I take from your replies now that you never intended to fix it and this was some sort of communication error.

I don't expect discussing this any further will help users of my application, so I'll implement a workaround.