[PATCH] Re: ash fails to read $HOME/.profile
Denys Vlasenko
vda.linux at googlemail.com
Sat Jul 1 21:25:40 UTC 2017
On Tue, Jun 27, 2017 at 9:32 PM, Tito <farmatito at tiscali.it> wrote:
> On 06/27/2017 05:53 PM, Denys Vlasenko wrote:
>> On Mon, Jun 26, 2017 at 10:11 PM, Tito <farmatito at tiscali.it> wrote:
>>> Hi,
>>> the attached patch should fix the "ash fails to read $HOME/.profile" bug
>>> when ENABLE_ASH_EXPAND_PRMT is not set.
>>> Kp could you please test if it fixes your problem when
>>> ENABLE_ASH_EXPAND_PRMT is not set?
>>>
>>> Ciao,
>>> Tito
>>>
>>> --- 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;
>>>
>>
>> I think expandstr() should be made independent of ASH_EXPAND_PRMT.
>>
> Hi Denys,
> the fix you committed doesn't seem to work.
> If you put a few debug statements in read_profile
>
> static void
> read_profile(const char *name)
> {
> + ash_msg("ENABLE_ASH_EXPAND_PRMT is %sset", ENABLE_ASH_EXPAND_PRMT ? "" : "not ");
> + ash_msg("%s", name); /* Tito */
> name = expandstr(name);
> + ash_msg("%s", name); /* Tito */
>
> you will notice that when CONFIG_ASH_EXPAND_PRMT is not set
> $HOME is not expanded and ~/.profile is not read:
>
> WITH CONFIG_ASH_EXPAND_PRMT
>
> -ash: ENABLE_ASH_EXPAND_PRMT is set
> -ash: /etc/profile
> -ash: /etc/profile
> -ash: ENABLE_ASH_EXPAND_PRMT is set
> -ash: $HOME/.profile
> -ash: /root/.profile
>
> WITHOUT CONFIG_ASH_EXPAND_PRMT
>
> -ash: ENABLE_ASH_EXPAND_PRMT is not set
> -ash: /etc/profile
> -ash: /etc/profile
> -ash: ENABLE_ASH_EXPAND_PRMT is not set
> -ash: $HOME/.profile
> -ash: $HOME/.profile
Thanks for noticing it. Fixed now, please try current git.
More information about the busybox
mailing list