Skip to content

Fix SQLite analyzer permission error flags#598

Open
sjh9714 wants to merge 1 commit into
dundee:masterfrom
sjh9714:codex/sqlite-permission-flags
Open

Fix SQLite analyzer permission error flags#598
sjh9714 wants to merge 1 commit into
dundee:masterfrom
sjh9714:codex/sqlite-permission-flags

Conversation

@sjh9714

@sjh9714 sjh9714 commented Jul 5, 2026

Copy link
Copy Markdown

Summary

Fixes #591.

When the SQLite analyzer scanned a readable directory that contained an unreadable descendant, the descendant kept its ! flag but the parent directory row kept its original blank flag. This made non-interactive --db output miss the . warning prefix for parent directories whose totals may be incomplete.

Changes

  • Persist directory flags when final SQLite analyzer stats are written.
  • Propagate child !/. flags to the finalized parent directory flag.
  • Add a regression test for a nested chmod-000 directory scanned through the SQLite analyzer.

Testing

  • go test ./pkg/analyze -run TestSqliteAnalyzerPropagatesChildPermissionError -count=1 (failed before the fix, passed after)
  • go test -v -covermode=count ./...
  • go build -o /tmp/gdu-pr-591-fixed ./cmd/gdu
  • go vet ./...
  • Manual CLI check with a nested unreadable directory: gdu --no-progress --no-color --no-prefix --non-interactive --db <tmp>/gdu.sqlite <tmp>/myfolder

Note: I used Codex while preparing this change, and I reviewed the final diff and ran the listed checks locally.

@codecov

codecov Bot commented Jul 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 85.49%. Comparing base (da4d262) to head (55697a2).

Files with missing lines Patch % Lines
pkg/analyze/sqlite.go 91.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #598      +/-   ##
==========================================
+ Coverage   85.45%   85.49%   +0.04%     
==========================================
  Files          55       55              
  Lines        6173     6177       +4     
==========================================
+ Hits         5275     5281       +6     
+ Misses        691      690       -1     
+ Partials      207      206       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Permission errors silently ignored when using --db

1 participant