[rfc][icedtea-web] improved home finding to use variables first

Alex Kashchenko akashche at redhat.com
Wed Dec 5 22:47:40 UTC 2018


On 12/05/2018 06:15 PM, Jiri Vanek wrote:
> On 12/5/18 11:48 AM, Alex Kashchenko wrote:
>> On 12/04/2018 01:46 PM, Jiri Vanek wrote:
>>> On 12/4/18 1:44 PM, Alex Kashchenko wrote:
>>>> On 12/03/2018 02:33 PM, Jiri Vanek wrote:
>>>>> On 11/30/18 5:41 PM, Alex Kashchenko wrote:
>>>>>> Hi,
>>>>>>
>>>>>> On 11/29/2018 12:32 PM, Jiri Vanek wrote:
>>>>>>>
>>>>>>
>>>>>> env::home_dir is deprecated since 1.29, it should not be used in get_home.
>>>>>>
>>>>>> Probing for HOME and USERPROFILE should be OS-specific (to not pickup HOME on windows).
>>>>>>
>>>>>
>>>>>
>>>>> Here you go!
>>>>>
>>>>> The number of os-specific functions is growing :(
>>>>
>>>> Looks good, except the usage of a deprecated env::home_dir inside get_home, please use something
>>>> like this instead:
>>>
>>> Oh pleeeease.... I think it is much nicer to survive one deprecation, especially when the direction
>>> was made clear exactly by following the deprection pointers.
>>> Are you sure you want this duplicate from env::home_dir  instead of  callto env::home_dir?
>>
>> I think it is better to avoid using deprecated API in a new code, especially with Rust fast pacing
>> release cycle.
> 
> Thsi is very very bad idea... We replaced one waring by six warnings...

Why not fix the warnings which can be fixed and suppress others?


> Udated patch attached... But I heavily vote for initial env::home_dir

linux_pwd module uses linux-specific calls and is not compilable on 
windows. Please guard it with #[cfg(unix)] where appropriate. Even if we 
use env::home_dir (that I think is a bad idea) in this patch, we are 
going to have some platform-specific code anyway that needs to be 
conditionally excluded.


>>> How will windows counterpart handle home?
>>
>> With GetUserProfileDirectoryW [1] or SHGetKnownFolderPath [2].
> So you will be calling directly those , similar to sugested:
>        fn getuid() -> uid_t;
>        fn getpwuid(uid: uid_t) -> *mut passwd;

Yes, they are similar.

>
> [...]
>

-- 
-Alex


More information about the distro-pkg-dev mailing list