Skip to content

Conversation

@jgarzik
Copy link
Contributor

@jgarzik jgarzik commented Dec 20, 2025

No description provided.

JRF63 and others added 2 commits August 15, 2025 07:28
  Fixes Applied to tree/du.rs

  1. Fixed -a option bug - Files now only print when -a is specified (was incorr
  2. Implemented -x option - Tracks initial device ID and skips files on differe
  3. Implemented hard link deduplication - Tracks (dev, ino) pairs; files with
  4. Fixed file operand handling - Non-directory file operands are now always li

  Tests Added to tree/tests/du/mod.rs

  - test_du_basic - Enhanced existing test
  - test_du_default_no_files - Verifies default doesn't list files
  - test_du_kilo - Tests -k option (1024-byte units)
  - test_du_nonexistent - Tests error handling for missing files
  - test_du_file_operand - Tests file operand always listed
  - test_du_symlink_h - Tests -H follows cmdline symlinks
  - test_du_symlink_l - Tests -L follows all symlinks
  - test_du_hardlink - Tests hard links counted once
@jgarzik jgarzik requested a review from Copilot December 20, 2025 07:18
@jgarzik jgarzik self-assigned this Dec 20, 2025
@jgarzik jgarzik added bug Something isn't working enhancement New feature or request labels Dec 20, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive test coverage for the du (disk usage) utility and implements missing POSIX features that were previously marked as TODO items.

Key Changes:

  • Implements -H (follow command-line symlinks), -L (dereference all symlinks), and -x (one filesystem) options
  • Adds hard link deduplication to prevent counting the same file multiple times
  • Adds 8 comprehensive integration tests covering basic functionality, default behavior, options, error handling, symlinks, and hard links

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.

File Description
tree/tests/tree-tests.rs Adds module declaration for new du tests
tree/tests/du/mod.rs New file containing 8 comprehensive integration tests for du utility functionality
tree/du.rs Complete rewrite of du implementation using ftw::traverse_directory with support for -H, -L, -x options and hard link deduplication
Cargo.lock Minor dependency version updates (bumpalo, cc, libredox, ntapi, portable-atomic, toml_*, tracing)

Summary of Changes

  1. tree/du.rs (already present from earlier fix)

  Fixed directory block counting - directories were being double-counted (once w

  2. tree/tests/du/mod.rs (my fix)

  Root Cause: The test directory test_du_symlink_l contains "link" in its name.
  - 8 .../test_du_symlink_l/subdir/link (actual symlink)
  - 16        .../test_du_symlink_l/subdir (directory - contains "link" in path!

  Fix: Changed line.contains("link") to line.ends_with("/link") so it only match
@jgarzik jgarzik merged commit bc8790b into main Dec 20, 2025
4 checks passed
@jgarzik jgarzik deleted the du branch December 20, 2025 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants