On 25/09/2026 09:03, Collin Funk wrote:
For some reason, lib/canonicalize.c counted the number of links it saw
but never used the value beyond ensuring it never went over 20. This
causes the infinite loop mentioned in an Ubuntu bug report [1]:

     ln -s foo/bar foo
     realpath foo

It will take quite a bit of time (as in more than an hour), but if you
leave it running, your system will eventually run out of memory due to
the allocations used to combine the path components below the modified
section.

This patch fixes it, by using the condition from
lib/canonicalize-lgpl.c.

Collin

[1] https://bugs.launchpad.net/ubuntu/+source/coreutils/+bug/2161155

Ouch.

When merging to coreutils, for the NEWS entry
I confirmed the issue was introduced in v9.0.

Perhaps a ulimit -v test is warranted also.

thanks!
Padraig

Reply via email to