bug#70586: cp walks dir differently than rm and is hitting "File name too long" where this could be avoided

Collin Funk <[email protected]>
Newsgroups gmane.comp.gnu.core-utils.bugs
Message-ID <[email protected]>
Collin Funk <[email protected]> writes:

> It is known about, and has been mentioned in the TODO file for a very
> long time:
>
>     cp --recursive: use fts and *at functions to perform directory
>     traversals in source and destination hierarchy rather than forming
>     full file names. The latter (current) approach fails unnecessarily
>     when the names become very long, and requires space and time that is
>     quadratic in the depth of the hierarchy.
>
> I suppose very few have run into the limit with real usage.
>
> I agree it should be fixed though. I'll have a look at it.

Also, 'ls -R' has the same problem.

     $ mkdir -p `python3 -c 'print("./" + "a/" * 32768)'`
     $ ls -R a > /dev/null
     ls: cannot open directory '[long file name]': File name too long

I'll have a look at that one too. Finding a reasonable way to define the
sort functions in terms of 'FTSENT **' will not be very fun though.

Collin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.