[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lynx-dev HTString.c patch for HTQuoteParameter()

From: Klaus Weide
Subject: lynx-dev HTString.c patch for HTQuoteParameter()
Date: Thu, 13 Jul 2000 13:56:34 -0500 (CDT)

(Diff made against 2.8.3rel.1)

To verify the problem, try operating on a file like '\' (one character
filename) or '\.html' (6 characters) with various actions that involve
shell commands - EXTERNAL, DOWNLOAD, VIEWER(?) ...  May have to "cheat"
to prevent lynx from URL-escaping the filename, e.g. start lynx as
  lynx 'file://localhost/home/kweide/\.html'
instead of
  lynx '/home/kweide/\.html' .
Backslash is a perfectly valid filename character for UNIX.  Maybe not
wise to have such files, but if they are there lynx should deal with
them correctly.  They shouldn't appear unencoded in URLs, but if they
do lynx should handle them consistenly just as it does for other
unusual characters.

* Don't double backslash characters in HTQuoteParameter(), since that
  changes the string a program invoked through system will see.  Note
  this assumes UNIX / POSIX interpretation of single-quoted strings
  by the shell.

(I hope this is right. It must be, but I haven't checked any docs except:
man bash:
       Enclosing  characters  in single quotes preserves the lit-
       eral value of each character within the quotes.  A  single
       quote  may not occur between single quotes, even when pre-
       ceded by a backslash.
man ash:
       Enclosing characters in single quotes preserves the lit-
       eral meaning of all the characters (except single quotes,
       making it impossible to put single-quotes in a single-
       quoted string).
man ksh (from pdksh):
                        [...] Second, a single quote  (')  quotes
       everything  up  to  the  next  single quote (this may span
       lines). [...]

Index: 3.1/WWW/Library/Implementation/HTString.c
--- 3.1/WWW/Library/Implementation/HTString.c Tue, 18 Apr 2000 10:26:31 -0500 
lynxdev (Lynx28/22_HTString.c 644)
+++ 2.57(w)/WWW/Library/Implementation/HTString.c Sat, 13 May 2000 22:42:49 
-0500 lynxdev (Lynx28/22_HTString.c 644)
@@ -864,10 +864,14 @@
            result[n++] = parameter[i];
            result[n++] = D_QUOTE;
            result[n++] = S_QUOTE;
-       } else if (parameter[i] == '\\') {
-           result[n++] = parameter[i];
-           result[n++] = parameter[i];
        } else {
+           /* Note:  No special handling of other characters, including
+              backslash, since we are constructing a single-quoted string!
+              Backslash has no special escape meaning within those for sh
+              and compatible shells, so trying to escape a beckslash by
+              doubling it is unnecessary and would be interpreted by the
+              shell as an additional data character. - kw 2000-05-02
+              */
            result[n++] = parameter[i];

; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]