2009-06-26, 13:58(+02), Christian Krause: > Hi Chet, > > Thanks for the answers. The problem is now, that this behavior of the > bash creates some real problems outside, probably with a larger impact. > Before asking the kernel developers to change parts of linux kernel's > build system, I'd like to be sure whether bash-4.x's behavior is correct > or not. Please see my comments below: [...]
POSIX doesn't prevent bash to do so I suppose, and bash is not the only shell to do so, pdksh based shells (which many systems sh are based on) also do so. bash3 and ksh93 also strip some environment variables (and override others like IFS) bash3 strips the environment strings that have no = in them, and the environment variable with an empty name. ksh93 also strips the environment strings without "=" except the empty string. Now, I can't think of any good reason why shells would do things like that (removes things from the environment which they have no business with) and it seems wrong to me as well, but one shouldn't rely on shells preserving environment variables that can't be mapped to shell variables as in practice that's no the case for a few shells, and it seems it's unspecified by POSIX. -- Stéphane