[rfc][icedtea-web] improved home finding to use variables first
Jiri Vanek
jvanek at redhat.com
Fri Dec 7 09:10:28 UTC 2018
On 12/5/18 11:47 PM, Alex Kashchenko wrote:
> 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?
The fix is the same as for env:home_dir - to use implementation from crates.io
>
>
>> 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.
I'm still not sure how will be handled OsAccess = new Linux() x new Windows()
Theoretically this should be the onl palce where any #[cfg(unix)] shouldbe used.
Eh both
GetUserProfileDirectoryW [1] or SHGetKnownFolderPath [2].
and
getuid(), getpwuid(uid: uid_t)
Are compilable on both platforms, but failing in runtime if architecture goes wrong.
So if the getuid(), getpwuid(uid: uid_t) aar ehidne in Linux() then it should be ok.
Jsut thoughts...
>
>
>>>> 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.
>
>>
>> [...]
>>
>
--
Jiri Vanek
Senior QE engineer, OpenJDK QE lead, Mgr.
Red Hat Czech
jvanek at redhat.com M: +420775390109
More information about the distro-pkg-dev
mailing list