revision 1283:2cbafe321d6f
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 1283:2cbafe321d6f |
parent | 1282:9f445c5e252b |
child | 1284:0db0a5e72698 |
author | nkeynes |
date | Tue Mar 27 17:39:05 2012 +1000 (12 years ago) |
Treat quotes as entering a double-quoted string (mostly redundant, but we
generate them in the path escaping for some reason)
generate them in the path escaping for some reason)
1.1 --- a/src/lxpaths.c Tue Mar 27 08:23:52 2012 +10001.2 +++ b/src/lxpaths.c Tue Mar 27 17:39:05 2012 +10001.3 @@ -79,6 +79,7 @@1.4 d = result;1.5 e = result+sizeof(result)-1;1.6 s = input;1.7 + gboolean inDQstring = FALSE;1.9 if( input == NULL )1.10 return NULL;1.11 @@ -137,11 +138,20 @@1.12 } else {1.13 *d++ = '\\';1.14 }1.15 + } else if( c == '\"' ) {1.16 + /* Unescaped double-quotes start a DQ string. Although we treat the1.17 + * string as if it were double-quoted for most purposes anyway, so1.18 + * this has little effect.1.19 + */1.20 + inDQstring = !inDQstring;1.21 } else {1.22 *d++ = c;1.23 }1.24 }1.25 *d = '\0';1.26 + if( inDQstring ) {1.27 + WARN( "Unterminated double-quoted string '%s'", input );1.28 + }1.29 return g_strdup(result);1.30 }1.31 gchar *get_absolute_path( const gchar *in_path )
2.1 --- a/src/test/testlxpaths.c Tue Mar 27 08:23:52 2012 +10002.2 +++ b/src/test/testlxpaths.c Tue Mar 27 17:39:05 2012 +10002.3 @@ -23,6 +23,7 @@2.4 #include "lxpaths.h"2.6 char *lxdream_get_global_config_path_value() { }2.7 +void log_message( void *ptr, int level, const gchar *source, const char *msg, ... ) { }2.9 struct expanded_path_case_t {2.10 const char *input;2.11 @@ -45,6 +46,7 @@2.12 {"/home/$TEST1/blah", "/home/quux/blah"},2.13 {"/tmp/${TEST2}/abcd", "/tmp/${BLAH}/abcd"},2.14 {"$TEST1$TEST2$TEST3$1$2", "quux${BLAH}3"},2.15 + {"\"/home/foo\"", "/home/foo"},2.16 {NULL,NULL}2.17 };
.