Skip to content

du: different output compared to GNU when links and targets in args #10312

Description

@svlv

Summary

This reveals some additional differences in output compared to GNU du when links and targets are passed as arguments.

One difference was already mentioned in #10241.

  1. Two hard links are passed as arguments, the -L option does not change the behavior.
# Preparation
mkdir dir1
dd if=/dev/random of=dir1/file count=1
ln dir1/file dir1/link

# GNU dd
$ du dir1/file dir1/link
4	dir1/file

# coreutils dd
$ coreutils du dir1/file dir1/link
4	dir1/file
4	dir1/link
  1. When both a symlink and its target are included in the arguments.
# Preparation
mkdir dir2
dd if=/dev/random of=dir2/file count=1
ln -s file dir2/link

# GNU dd
du -L dir2/file dir2/link
4	dir2/file

du dir2/file dir2/link
4	dir2/file
0	dir2/link

# coreutils dd
coreutils du -L dir2/file dir2/link
4	dir2/file
4	dir2/link

coreutils du dir2/file dir2/link # it prints the same as GNU du does
4	dir2/file
0	dir2/link

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions