[kupfer] desktop_parse: Unescape unquoted backslashes in commandlines
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [kupfer] desktop_parse: Unescape unquoted backslashes in commandlines
- Date: Mon, 4 Apr 2011 13:27:23 +0000 (UTC)
commit 4f24bd53f22d40f5ed37fea57519af46039d4202
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Mon Apr 4 15:24:06 2011 +0200
desktop_parse: Unescape unquoted backslashes in commandlines
Backslashes ``\`` must always be inside quoted parts in commandlines
(desktop spec Exec key), but we try to handle the case where they are
not.
kupfer/desktop_parse.py | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/kupfer/desktop_parse.py b/kupfer/desktop_parse.py
index 6a48a36..bb8f7a2 100644
--- a/kupfer/desktop_parse.py
+++ b/kupfer/desktop_parse.py
@@ -9,6 +9,7 @@ The unescaping we are doing is only one way.. so we unescape according to the
rules, but we accept everything, if validly quoted or not.
"""
+import warnings
# This is the "string" type encoding escapes
# this is unescaped before we process anything..
@@ -81,6 +82,10 @@ def quote_scanner(s, reptable):
_ps = "".join(part)
if is_quoted:
parts.append(two_part_unescaper(rmquotes(_ps), reptable))
+ elif '\\' in _ps:
+ warnings.warn(RuntimeWarning("Broken unquoted Exec= %s" % repr(s)))
+ parts.extend([two_part_unescaper(_ps_part, reptable) for _ps_part
+ in _ps.split()])
else:
parts.extend(_ps.split())
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]