Re: Git clean enumerates ignored directories (since 2.27)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 06, 2021 at 07:31:40PM -0700, Elijah Newren wrote:

> On alpine linux-musl, I get an "error: Tests passed but test cleanup
> failed; aborting", which makes it report as a failed build.  I'm not
> sure how to fix it and am asking for ideas.
> 
> Apparently the deeply nested directory hierarchy cannot be removed on
> that platform with a simple "rm -rf $dirname".  It throws a "rm: can't
> stat '/__w/git/git/t/trash
> directory.t7300-clean/avoid-traversing-deep-hierarchy/directory400/directory399/directory398/.....(you
> get the idea)....': Filename too long" error message.[1]
> 
> Adding a "test_when_finished find directory400 -delete" also gives a
> "Filename too long" message followed by a lot of "Directory not empty"
> messages.[2]
> 
> Anyone have any bright ideas about how to tweak this test?  See [3]
> for the current incarnation of the code, which was basically taken
> from Brian's sample testcase.

My guess is that that version of "rm" is trying to feed the entire
pathname directly to unlink() and rmdir(), and it exceeds PATH_MAX.

Even with GNU tools, for instance, I get:

  $ rmdir $(find avoid-traversing-deep-hierarchy -type d | tail -1)
  rmdir: failed to remove 'avoid-traversing-deep-hierarchy/directory400/
    [...and so on...]/directory1': File name too long

because it feeds the whole to a single rmdir() call. Whereas stracing
GNU "rm -rf", it uses unlinkat() and openat() to delete each level
individually (probably to avoid this exact problem).

Is the actual path length important, or just the depth? If the latter,
then calling it "d400/d399/.../d2/d1" would likely help, as that's less
than 2000 bytes.

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux