Description of problem: I have a directory with about 40000 subdirectories, each containing several small files and symlinks outside that directory. When copying the directory with cp -r and running du on the new directory to see how much data was already copied, du sometimes crashes. I have seen this with coreutils-8.27-17.fc27.x86_64 and coreutils-8.27-19.fc27.x86_64, but not coreutils-8.29-3.fc28.x86_64. Backtrace: #0 0x00007ffff6dc666b in raise () from /lib64/libc.so.6 #1 0x00007ffff6dc8381 in abort () from /lib64/libc.so.6 #2 0x000055555562762b in leave_dir (ent=ent@entry=0x5555558ef5f0, fts=<optimized out>, fts=<optimized out>) at ../lib/fts-cycle.c:136 #3 0x0000555555627b71 in fts_build (sp=sp@entry=0x55555589d510, type=type@entry=3) at ../lib/fts.c:1355 #4 0x000055555562899d in fts_read (sp=sp@entry=0x55555589d510) at ../lib/fts.c:931 #5 0x0000555555594017 in du_files (files=0x5555558867d0 <temp_argv>, bit_flags=280) at ../src/du.c:691 #6 single_binary_main_du (argc=<optimized out>, argv=<optimized out>) at ../src/du.c:1123 #7 0x0000555555564752 in launch_program (prog_name=<optimized out>, prog_argc=1, prog_argv=0x7fffffffd688) at ../src/coreutils.c:127 #8 0x0000555555564542 in launch_program (prog_argv=<optimized out>, prog_argc=1, prog_name=0x7fffffffda3b "du") at ../src/coreutils.c:195 #9 main (argc=<optimized out>, argv=0x7fffffffd678) at ../src/coreutils.c:177
There are not many relevant changes in FTS between those releases of coreutils. Anyway, I have submitted a scratch build of f27 coreutils with f29 version of FTS: https://koji.fedoraproject.org/koji/taskinfo?taskID=24965509 Could you please give it a try in case it is something easy to test for you?
It doesn't seem to crash with du from the scratch build.
Not that I understand why, but I will submit it as an update anyway. Hopefully it will not come back again. Thank you for testing the scratch build!
Note that findutils shares the code in question with coreutils. If you were by any chance able to reproduce the crash in your environment with find(1), please create a separate bug for it and I will update the FTS code in findutils, too.
Thanks! It is crashing with find too. I'll clone the bug.
findutils-4.6.0-16.fc27 coreutils-8.27-20.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2018-89733ea3d9
coreutils-8.27-20.fc27, findutils-4.6.0-16.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-89733ea3d9
coreutils-8.27-20.fc27, findutils-4.6.0-16.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.