diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-06-13 00:55:31 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-06-13 00:55:31 +0000 |
commit | e6a6561121ef4475a0fd136524983bb22afbb3dc (patch) | |
tree | cf9233d705f964bfdfad43ef31c8a1d702a7e48b | |
parent | fe5a15251fb931fad3823b5aacb297ccc2335d61 (diff) | |
download | ruby-e6a6561121ef4475a0fd136524983bb22afbb3dc.tar.gz |
process.c: treat '=' only in the first word
* process.c (rb_exec_fillarg): treat '=' only in the first word. if
the first word does not contain '=', it is the command name and
environment assignments cannot be anymore.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36048 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | process.c | 7 |
2 files changed, 12 insertions, 1 deletions
@@ -1,3 +1,9 @@ +Wed Jun 13 09:55:29 2012 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * process.c (rb_exec_fillarg): treat '=' only in the first word. if + the first word does not contain '=', it is the command name and + environment assignments cannot be anymore. + Tue Jun 12 23:45:36 2012 NARUSE, Yui <naruse@ruby-lang.org> * lib/mkmf.rb: add dummy clean-static target to prevent errors for the @@ -1851,6 +1851,7 @@ rb_exec_fillarg(VALUE prog, int argc, VALUE *argv, VALUE env, VALUE opthash, str #ifndef _WIN32 if (e->use_shell) { const char *p; + int first = 1; int has_meta = 0; int has_nonspace = 0; /* @@ -1880,8 +1881,12 @@ rb_exec_fillarg(VALUE prog, int argc, VALUE *argv, VALUE env, VALUE opthash, str for (p = RSTRING_PTR(prog); *p; p++) { if (!has_nonspace && *p != ' ' && *p != '\t') has_nonspace = 1; - if (!has_meta && strchr("*?{}[]<>()~&|\\$;'`\"\n#=", *p)) + if (has_nonspace && (*p == ' ' || *p == '\t')) + first = 0; + if (!has_meta && strchr("*?{}[]<>()~&|\\$;'`\"\n#", *p)) has_meta = 1; + if (first && *p == '=') + has_meta = 1; if (has_nonspace && has_meta) break; } |