Kaydet (Commit) 9fcbf781 authored tarafından Jan Holesovsky's avatar Jan Holesovsky

Fix dmake's behavior when the environment is broken.

You can have environment with spaces in the name of the environment variable.
Even though this is broken, it does not cause trouble to most of the tools
around, so we should work that around in dmake too ;-)

dmake-space-in-envvar-name.diff, i#101786
üst f0687908
...@@ -88,17 +88,23 @@ FILE *fil; ...@@ -88,17 +88,23 @@ FILE *fil;
/* Reading the internal rule table. Set rule_ind to zero after the /* Reading the internal rule table. Set rule_ind to zero after the
* last entry so that ReadEnvironment() works as expected every time. */ * last entry so that ReadEnvironment() works as expected every time. */
while( (p = Rule_tab[ rule_ind++ ]) != NIL(char) ) while( (p = Rule_tab[ rule_ind++ ]) != NIL(char) ) {
/* The last test in this if *p != '~', handles the environment /* The last test in this if *p != '~', handles the environment
* passing conventions used by MKS to pass arguments. We want to * passing conventions used by MKS to pass arguments. We want to
* skip those environment entries. Also CYGWIN likes to export '!' * skip those environment entries. Also CYGWIN likes to export '!'
* prefixed environment variables that cause severe pain, axe them too */ * prefixed environment variables that cause severe pain, axe them too.
if( !Readenv || (Readenv && (strchr(p,'=') != NIL(char)) && *p!='~' && *p!='!')){ * And finally it is possible to do "env 'GGG HHH'='some value' bash"
* which causes that there are env variables with spaces in the name
* defined which causes dmake to malfunction too */
char *equal = strchr(p,'=');
char *space = strchr(p,' ');
if( !Readenv || (Readenv && (equal != NIL(char)) && (space == NIL(char) || space > equal) && *p!='~' && *p!='!')){
strcpy( buf, p ); strcpy( buf, p );
DB_PRINT( "io", ("Returning [%s]", buf) ); DB_PRINT( "io", ("Returning [%s]", buf) );
DB_RETURN( FALSE ); DB_RETURN( FALSE );
} }
}
rule_ind = 0; rule_ind = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment