[Libreoffice-commits] .: dmake/getinp.c

Jan Holesovsky kendy at kemper.freedesktop.org
Fri Oct 15 02:19:36 PDT 2010


 dmake/getinp.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

New commits:
commit 9cf5bad89b1718d59308629051edd8673f12af5e
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Fri Oct 15 11:15:45 2010 +0200

    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

diff --git a/dmake/getinp.c b/dmake/getinp.c
index c2a0c80..033374e 100644
--- a/dmake/getinp.c
+++ b/dmake/getinp.c
@@ -88,17 +88,23 @@ FILE *fil;
       /* Reading the internal rule table.  Set rule_ind to zero after the
        * 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
       * passing conventions used by MKS to pass arguments.  We want to
       * skip those environment entries. Also CYGWIN likes to export '!'
-      * prefixed environment variables that cause severe pain, axe them too */
-     if( !Readenv || (Readenv && (strchr(p,'=') != NIL(char)) && *p!='~' && *p!='!')){
+      * prefixed environment variables that cause severe pain, axe them too.
+      * 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 );
 
         DB_PRINT( "io", ("Returning [%s]", buf) );
         DB_RETURN( FALSE );
      }
+      }
 
       rule_ind = 0;
 


More information about the Libreoffice-commits mailing list