>> --- a/shell/ash.c
>> +++ b/shell/ash.c
>> @@ -13198,7 +13198,10 @@ int ash_main(int argc UNUSED_PARAM, char **argv)
>>              read_profile("/etc/profile");
>>   state1:
>>              state = 2;
>> -            read_profile(".profile");
>> +            const char *hp = lookupvar("HOME");
>> +            hp = concat_path_file(hp, ".profile");
>> +            read_profile(hp);
>> +            free(hp);
> This is a good point :)
>
> NTL the code (reading histfile) assumed that HOME can be empty.
> can you save drop this assumption here ?

concat_path_file already special cases hp=NULL, in this case the output
is "/.profile". We have 3 options if HOME is empty:

1) don't read .profile at all
2) read .profile in the current $(pwd)  (before patch)
3) read /.profile                       (after patch)

I think option 1) is even better, maybe with a warning.
If there is no HOME, don't try to read the profile from
a random folder.
I will send a new patch.
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to