Summary: | Pre-shell command does not accept space in path | ||
---|---|---|---|
Product: | [Applications] konversation | Reporter: | Reshad Patuck <reshad> |
Component: | general | Assignee: | Konversation Developers <konversation-devel> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | hein, reshad |
Priority: | NOR | ||
Version First Reported In: | 1.4 | ||
Target Milestone: | --- | ||
Platform: | Arch Linux | ||
OS: | Linux | ||
Latest Commit: | http://commits.kde.org/konversation/af4c36335ea14c3273b48ab22f14723975e8d3e5 | Version Fixed In: | |
Sentry Crash Report: |
Description
Reshad Patuck
2013-03-19 20:38:14 UTC
I'm actually not sure we can economically solve that programmatically without splitting the field in two for command and arguments respectively, because there's no good way to determine where command ends and arguments begin, other than doing filesystem existence tests. Can you check if escaping the spaces with \ works? I can confirm that escaping with \ does not work. Will try and dig into the code myself a bit too. Cheers Thanks. Basically, QProcess/KProcess have methods that would take care of the quoting/escaping for us - you can hand it program and argument list separately, and spaces in the program or path work fine then, but that just changes the problem into "figuring out which part of the space-separated list is supposed to be the program". What we _could_ do, other than the two-field approach, is to require users to backslash escape, and then actually parse the escaping. The "Command" field in KDE .desktop links has the same problem btw, but backslash escape works there. correct me if I'm wrong, const QStringList commandList = command.split(' '); basically says if you see a space treat the string as a new command. Not really, rather it's that K/QProcess, like most subprocess APIs on POSIX-like platforms, want a list as input, where the first entry in the list becomes the program and every other entry an argument. (Ever written a C program and dealt with argv? That's the other side of that.) So we split by space to separate the arguments; the problem is that this also turns everything after the first space into an argument, and only the part before the first space is considered the command. Git commit af4c36335ea14c3273b48ab22f14723975e8d3e5 by eli mackenzie. Committed on 29/03/2013 at 09:58. Pushed by argonel into branch '1.4'. Handle spaces in pre-shell commands Switches to using KShell::splitArgs to build the list of arguements to feed to KProcess instead of doing it here. As a bonus, tilde expansion works now as well. This patch also adds a check to ensure the connection only gets set up once. M +2 -0 ChangeLog M +30 -15 src/irc/server.cpp http://commits.kde.org/konversation/af4c36335ea14c3273b48ab22f14723975e8d3e5 |