Bug 278388 - du: fts_read: No such file or directory; failed on directory with symlink to another partition
Summary: du: fts_read: No such file or directory; failed on directory with symlink to ...
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 13.2-RELEASE
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-16 11:28 UTC by Miroslav Lachman
Modified: 2024-04-30 14:33 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Miroslav Lachman 2024-04-16 11:28:57 UTC
I have a symlink from /var/crash to /vol0/crash on another partition and when I tried to check the directory usage in /var, it failed with an error:

# du -d 1 -h /var/
4.0K    /var/.snap
 24K    /var/mail
 12K    /var/audit
du: fts_read: No such file or directory


Full directory list

# ll /var/
total 32900
drwxrwxr-x   2 root     operator   512B Aug 12  2015 .snap/
-r--------   1 root     wheel       32M Aug 12  2015 .sujournal
drwxr-xr-x   2 root     wheel      512B Apr 16 03:01 account/
drwxr-xr-x   2 certbot  www        512B Apr 12 10:04 acme_sh/
drwxr-xr-x   4 root     wheel      512B Jul 25  2019 at/
drwxr-x---   4 root     audit      512B Jul 25  2019 audit/
drwxrwx---   2 root     authpf     512B Jul 25  2019 authpf/
drwxr-x---   2 root     wheel      1.0K Apr 16 03:13 backups/
drwxr-xr-x   3 root     wheel      512B Jul 25  2019 cache/
lrwxr-xr-x   1 root     wheel       11B Dec  3 15:15 crash@ -> /vol0/crash
drwxr-x---   3 root     wheel      512B Jul 25  2019 cron/
drwxr-xr-x  18 root     wheel      512B Feb 14 21:42 db/
dr-xr-xr-x   2 root     wheel      512B Nov 11  2014 empty/
drwxrwxr-x   2 root     games      512B Jul 25  2019 games/
drwx------   2 root     wheel      512B Jul 25  2019 heimdal/
drwxr-xr-x   7 root     wheel       11K Apr 16 03:01 log/
drwxrwxr-x   2 root     mail       1.0K Dec  6 22:57 mail/
drwxr-xr-x   2 daemon   wheel      512B Jul 25  2019 msgs/
drwxr-xr-x   2 root     wheel      512B Jul 25  2019 preserve/
drwxr-xr-x  11 root     wheel      1.0K Apr 16 03:13 run/
drwxrwxr-x   2 root     daemon     512B Jul 25  2019 rwho/
drwxr-xr-x  10 root     wheel      512B Jul 25  2019 spool/
drwxrwxrwt   4 root     wheel      512B Apr 16 13:14 tmp/
drwxr-xr-x   3 unbound  unbound    512B Apr 15 18:00 unbound/
drwxr-xr-x   2 root     wheel      512B Apr 17  2023 yp/


I added -x to not traverse filesystem, then it works

# du -d 1 -h -x /var/
4.0K    /var/.snap
 24K    /var/mail
 12K    /var/audit
180K    /var/run
 15M    /var/backups
4.0K    /var/preserve
8.0K    /var/msgs
4.0K    /var/heimdal
713M    /var/cache
 41M    /var/db
8.7M    /var/tmp
228K    /var/spool
 46M    /var/account
4.0K    /var/authpf
 28K    /var/yp
4.0K    /var/rwho
 28K    /var/cron
892M    /var/log
4.0K    /var/empty
 12K    /var/at
 32K    /var/unbound
4.0K    /var/games
4.0K    /var/acme_sh
1.7G    /var/

But I think it should not ends by the error or the error messages should be more specific. The -x was just my blind try.

This is on FreeBSD 13.2-RELEASE-p11 amd64 GENERIC with UFS filesystems.