Skip to content

du: apply --one-file-system to non-directory entries - #17133

Open
qodelicious wants to merge 1 commit into
uutils:mainfrom
qodelicious:du-one-file-system-non-dirs
Open

qodelicious wants to merge 1 commit into
uutils:mainfrom
qodelicious:du-one-file-system-non-dirs

Conversation

@qodelicious

Copy link
Copy Markdown
Contributor

With -x, du only compared devices for directories, so a regular file on another filesystem reached during traversal (for example through a symlink followed with -L) was still listed and counted. GNU du excludes any entry below the operand whose device differs from the operand's.

This moves the device check in both safe_du and du_regular so it applies to every entry below the operand, regardless of file type. Operands themselves are still exempt, so du -x file keeps working.

Added a Linux test that symlinks to a file in /dev/shm and checks that du -Lax neither lists nor counts it, while still counting it when given as an operand (skipped if /dev/shm is missing or on the same device).

Closes #17097

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

du -x counts a regular file on another filesystem when it is reached through a symlink with -L

1 participant