This patch uses an strncmp to not incorporate gentoo python-wrapper related environment variables into the os.environ, namely GENTOO_PYTHON_PROCESS_NAME, GENTOO_PYTHON_TARGET_SCRIPT_PATH, GENTOO_PYTHON_WRAPPER_SCRIPT_PATH. As written it is broken, and blocks incorporating many other variables which breaks environment set up in posixmodule.so in an impossible to work around way. Any environment variable that begins with G, GE, GEN, GENT, GENTO, etc. is blocked from incorporation. For example, try G=1 python2 -c 'import os; print os.environ["G"]'. This is because the length of the new variable (p - *e) in the code, will be 1, 2, 3, 4, 5, etc. respectively. The strncmp will then yield zero (equality) since the prefix matches. You can fix this easily safely, and securely by first checking that the length matches, i.e. (p - *e == 26 && strncmp("GENTOO_PYTHON_PROCESS_NAME"...)) || ... with 32 and 33 for the other variables. { This also represents a tiny, unimportant in context optimization since by boolean short-circuit rules the strncmp will not be called unless the lengths match. } If the hard coded constants strike you as too fragile, you can use strlen. I believe gcc can compile-time optimize that to the constants. It's surprising that gentoo developers don't need to receive variables in python with a GENTOO prefix. :) But really everyone should be allowed to get variables like $G, $GEN, $GENT.
Created attachment 240011 [details, diff] Fix strncmp bug that matches any variable that is a prefix to target vars This is a fix for just the posixmodule.c portion of 61_all_process_data.patch. I will also attach an entire 61_all_process_data.patch in case that is helpful.
Created attachment 240013 [details, diff] Entire all_process_data replacement for strncmp bug in Python env vars skipping This is the same as the last patch, but is the entire replacement file.
Fixed in r367.
Fixed in 2.6.5_p20100801, 2.7_p20100801, 3.1.2_p20100801 and 3.2_pre20100801.