du: adding ./ to the operand silently defeats --exclude=target/debug

Đang mở
#16,691 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@costajohnt đang làm issue này rồi.

Từ ngày 18/11/2026.

  • #16699 của @costajohnt — đang mở
  • #16701 của @nishant9144 — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
rust
Lĩnh vực
cli, testing

Hướng nghiên cứu

Read the traversal in src/uu/du/src/du.rs around lines 563–567 and the existing test_du_exclude_several_components fixture. Run that test with the ./a operand case described in the issue and compare the result with the reported du -bs --exclude=target/debug behavior. Done means the excluded target/debug subtree stays excluded when the operand is ./, and the regression is covered by a test.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

U - du

A size check run from a project root counts the build artifacts it explicitly excludes. Even target and ./target give different totals for the same directory.

(
  cd "$(mktemp -d)" || exit 1
  export LC_ALL=C
  mkdir -p target/debug docs/debug
  head -c 1048576 /dev/zero > target/debug/app
  printf 'keep\n' > docs/debug/guide
  for dir in . target ./target; do
    du -bs --exclude=target/debug "$dir"
  done
)
Operand uutils GNU 9.12
. 1048581 5
target 0 0
./target 1048576 0

All commands exit 0 with empty stderr. Reproduced on Linux x86_64 with uutils 0.12.0 and main at 293a724. With du -a --exclude=target/debug ., uutils also lists ./target/debug/app. The five-byte docs/debug/guide should be counted in the project total.

The traversal checks the full path (./target/debug) and the basename (debug), missing the matching suffix target/debug. The existing test_du_exclude_several_components covers an exact full-path match. Running its fixture again with ./a would exercise this case.

Ngôn ngữ chính
Rust
Star
24.4k
Fork
2.2k
Merge trung bình
2 ngày 23 giờ
Pull request đã merge (30 ngày)
402

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của uutils/coreutils

Tất cả issue của uutils/coreutils

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.