RFR: 8338851: Hoist os::Posix::realpath() to os::realpath() and implement on Windows [v2]

Simon Tooke stooke at openjdk.org
Wed Sep 11 14:46:12 UTC 2024


On Thu, 5 Sep 2024 21:03:56 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Simon Tooke has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - simplify windwos realpath() implementation
>>  - get rid of os::posix::realpath() and os::win32::realpath()
>
> src/hotspot/os/windows/os_windows.cpp line 5330:
> 
>> 5328:   if (result == nullptr) {
>> 5329:     errno = ENAMETOOLONG;
>> 5330:   }
> 
> This is a bit of an assumption. What if the name "includes a drive letter that isn't valid or can't be found"? Unfortunately Windows doesn't specify any further details beyond returning null.

I probably cleaned up this code too much, and should've left it more like the Posix implementation.  
What I used to have would do one call (with buffer NULL) to get the real full path, then copy it if it fit or ENAMETOOLONG.  In attempting to speed up the code I changed the semantics.  I will change this code back to my previous implementation

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/20683#discussion_r1754801308


More information about the serviceability-dev mailing list