Environment variable issue

Adrian Sendroiu molecula2788 at gmail.com
Mon Aug 12 12:46:20 CEST 2013


Hello,

I noticed a strange behaviour when urxvt is started in an environment
which contains an empty string.

char *argv[] = { "urxvt", NULL };
char *envp[] = { "a=bbbbbbb", "", "c=dddddddddd", "e=fffffffffffff", NULL };

execve("/usr/local/bin/urxvt", argv, envp);

$ env
=c
a=bbbbbbb
COLORTERM=rxvt-xpm
WINDOWID=46137365
COLORFGBG=11;default;15
TERM=rxvt-unicode
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
DISPLAY=:0
dddddddddd=e
fffffffffffff=
PWD=/tmp

As you can see, some variables get corrupted.

I managed to track it up to the init2 -> HOOK_INVOKE ((this,
HOOK_START, DT_END)) -> rxvt_perl_interp::invoke. However, since I'm
not familiar with perl, I can't investigate further.

One thing I observed is that at the end of rxvt_perl_interp::invoke,
when set_environ's destructor is called, the orig_env field has a
different value from the one it had at the beginning, but I don't know
if this is the expected behavior or not.

Adrian




More information about the rxvt-unicode mailing list