On Wed, 4 Sep 2024 20:10:54 GMT, Simon Tooke <sto...@openjdk.org> wrote:

>> This PR changes the status of realpath() from a Posix-specific API to a 
>> globally available API, i.e. adding it to the "Hotspot Porting API".  Code 
>> would refer to os::realpath() instead of os::Posix::realpath().
>> 
>> This requires the addition of a stub routine in os_posix.cpp and a Windows 
>> implementation of realpath(), using Windows _fullpath().
>> 
>> This PR depends on #20597 in that it removes the need for one #ifdef in that 
>> PR.  Because of that, this PR will be modified when and if #20597 is 
>> integrated.
>> 
>> Please note that guidelines for doing this appear in 
>> src/hotspot/share/runtime/os.hpp
>
> 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()

Windows version looks better now, though still one issue that isn't really 
solvable - so I'd let it slide (especially as I think the errno settings should 
be removed anyway).

Thanks

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.

src/hotspot/share/runtime/os.hpp line 672:

> 670: 
> 671:   // A safe implementation of realpath which will not cause a buffer 
> overflow if the resolved path
> 672:   //   is longer than PATH_MAX.

Nit: remove leading space to align with text on previous line.

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

Marked as reviewed by dholmes (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/20683#pullrequestreview-2284073591
PR Review Comment: https://git.openjdk.org/jdk/pull/20683#discussion_r1746155484
PR Review Comment: https://git.openjdk.org/jdk/pull/20683#discussion_r1746156066

Reply via email to