ruby-changes:23997
From: nobu <ko1@a...>
Date: Wed, 13 Jun 2012 09:55:41 +0900 (JST)
Subject: [ruby-changes:23997] nobu:r36048 (trunk): process.c: treat '=' only in the first word
nobu 2012-06-13 09:55:31 +0900 (Wed, 13 Jun 2012) New Revision: 36048 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36048 Log: 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. Modified files: trunk/ChangeLog trunk/process.c Index: ChangeLog =================================================================== --- ChangeLog (revision 36047) +++ ChangeLog (revision 36048) @@ -1,3 +1,9 @@ +Wed Jun 13 09:55:29 2012 Nobuyoshi Nakada <nobu@r...> + + * 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@r...> * lib/mkmf.rb: add dummy clean-static target to prevent errors for the Index: process.c =================================================================== --- process.c (revision 36047) +++ process.c (revision 36048) @@ -1851,6 +1851,7 @@ #ifndef _WIN32 if (e->use_shell) { const char *p; + int first = 1; int has_meta = 0; int has_nonspace = 0; /* @@ -1880,8 +1881,12 @@ 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; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/