Re: [PATCH 5/5] stdlib: Remove lstat usage from realpath [BZ #24970]

2020-12-28 Thread Paul Eggert
On 12/28/20 3:42 AM, Adhemerval Zanella wrote: On 24/12/2020 21:27, Paul Eggert wrote: Also, shouldn't we merge the already-existing Gnulib scratch_buffer changes into glibc, along with this new change? Which changes are you referring? Checking against bbaba6ce5 I see all glibc files for s

Re: [PATCH 5/5] stdlib: Remove lstat usage from realpath [BZ #24970]

2020-12-28 Thread Adhemerval Zanella
On 28/12/2020 08:42, Adhemerval Zanella wrote: >>>   static idx_t >>> +readlink_scratch_buffer (const char *path, struct scratch_buffer *buf) >>> +{ >>> +  ssize_t r; >>> +  while (true) >>> +    { >>> +  ptrdiff_t bufsize = buf->length; >>> +  r = __readlink (path, buf->data, bufsize -

Re: [PATCH 5/5] stdlib: Remove lstat usage from realpath [BZ #24970]

2020-12-28 Thread Adhemerval Zanella
On 24/12/2020 21:27, Paul Eggert wrote: > This email finishes the review of this proposed glibc patchset. (I didn't > look at patch 4/5 for test cases.) > > On 12/24/20 7:17 AM, Adhemerval Zanella wrote: > >> +/* Check if BUFFER is using the internal buffer.  */ >> +static __always_inline boo

Re: [PATCH 5/5] stdlib: Remove lstat usage from realpath [BZ #24970]

2020-12-24 Thread Paul Eggert
This email finishes the review of this proposed glibc patchset. (I didn't look at patch 4/5 for test cases.) On 12/24/20 7:17 AM, Adhemerval Zanella wrote: +/* Check if BUFFER is using the internal buffer. */ +static __always_inline bool +scratch_buffer_using_internal (struct scratch_buffer *

[PATCH 5/5] stdlib: Remove lstat usage from realpath [BZ #24970]

2020-12-24 Thread Adhemerval Zanella
The readlink already tells whether the file is a symlink, so there is no need to call lstat to check it. However for '..' it requires an extra readlink check if the previous component can be really accessed, otherwise the next iteration will check a possible valid path and end early. It should pe