[PATCH] Re: ash fails to read $HOME/.profile
Denys Vlasenko
vda.linux at googlemail.com
Sat Jul 1 21:10:20 UTC 2017
On Tue, Jun 27, 2017 at 9:47 PM, Xabier Oneca -- xOneca
<xoneca at gmail.com> wrote:
> Hello,
>
>> --- shell/ash.c.orig 2017-06-25 22:04:07.000000000 +0200
>> +++ shell/ash.c 2017-06-26 22:09:29.245454443 +0200
>> @@ -13629,8 +13629,15 @@ int ash_main(int argc UNUSED_PARAM, char
>> state1:
>> state = 2;
>> hp = lookupvar("HOME");
>> - if (hp)
>> + if (hp) {
>> +#if ENABLE_ASH_EXPAND_PRMT
>> read_profile("$HOME/.profile");
>> +#else
>> + hp = concat_path_file(hp, ".profile");
>> + read_profile(hp);
>> + free((char*)hp);
>> +#endif
>> + }
>> }
>> state2:
>> state = 3;
>
> What about always using the "else" part here and forget about
> ENABLE_ASH_EXPAND_PRMT at all?
read_profile() uses expandstr() on its argument.
This is needed to support this commit:
commit 2eb0a7e1b9a579ba34e4780c9ed8e74f38bc6b85
Author: Denys Vlasenko <vda.linux at googlemail.com>
Date: Thu Oct 27 11:28:59 2016 +0200
ash: [SHELL] Expand ENV before using it
The code in #else would try to expand $var et al in $HOME's _value_,
which is wrong.
More information about the busybox
mailing list