Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: leading '=' in enviroment variable truncated



On May 8,  8:12pm, Peter Stephenson wrote:
} Subject: Re: leading '=' in enviroment variable truncated
}
} On Sun, 8 May 2016 10:59:49 -0700
} Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
} 
} > As mentioned in the dotenv issue, this happens only on OSX.  I've just
} > confirmed that it's a problem either with the library implementations
} > of setenv() / unsetenv(), or with zsh's use of them.
} 
}   These functions set, unset and fetch environment variables from the host
}   environment list.  For compatibility with differing environment
}   conven-tions, conventions, the given arguments name and value may be
}   appended and prepended, respectively, with an equal sign ``=''.
} 
} Very useful, if I may say so.

Astounding.

The Open Group spec for "setenv" explicitly prohibits "=" in the name,
and says nothing about the value.  The source code for setenv.c on
opensource.apple.com does nothing special with name or value.

How about this?


diff --git a/Src/zsh_system.h b/Src/zsh_system.h
index 811340d..17c4c64 100644
--- a/Src/zsh_system.h
+++ b/Src/zsh_system.h
@@ -728,7 +728,7 @@ extern char **environ;
  * We always need setenv and unsetenv in pairs, because
  * we don't know how to do memory management on the values set.
  */
-#if defined(HAVE_SETENV) && defined(HAVE_UNSETENV)
+#if defined(HAVE_SETENV) && defined(HAVE_UNSETENV) && !defined(__APPLE__)
 # define USE_SET_UNSET_ENV
 #endif
 



Messages sorted by: Reverse Date, Date, Thread, Author