[pseudo] pseudo env corruption with bash
Richard Purdie <[email protected]>
| Newsgroups | org.yoctoproject.lists.yocto-patches |
|---|---|
| Message-ID | <67ec48c8598922257469ce1fc62a0bd8c68e742f.camel@linuxfoundation.org> |
I thought I'd write down what I've discovered when looking into a segfault in pseudo on the autobuilder. The bug in question is this one: https://bugzilla.yoctoproject.org/show_bug.cgi?id=16078 opkg-build is a bash script. The issue is that bash implements its own setenv/getenv/unsetenv functions which operate on bash variables as well as environ. What that means is that bash's view is environ+delta. bash does swap between different environ copies depending on what it is doing but it only updates that when it is about to exec something that needs it. Pseudo noticed problems in this area a while ago and bypassed the bash wrappers: https://git.yoctoproject.org/pseudo/commit/?id=80c6334a2e4204cdc7132216f64d1660eed62fd9 The trouble is that glibc's functions alter environ in a way which is not compatible with bash and the two conflict. Whether there are issues depends on which variables are set/modified in bash's local delta to environ. If I remove the glibc calls and just use bash's wrappers when they are present, all the valgrind memory errors are removed and things look much cleaner. pseudo doesn't access environ directly that I've spotted yet, just via setenv/getenv. I'll ponder the right fix a bit more, the hard part will be getting a list of all the envvars without using environ directly... Cheers, Richard