Skip to content

fix(scripts): replace GNU find -printf with POSIX basename#1484

Open
dknos wants to merge 1 commit intoNVIDIA:mainfrom
dknos:fix/backup-posix-find-1431
Open

fix(scripts): replace GNU find -printf with POSIX basename#1484
dknos wants to merge 1 commit intoNVIDIA:mainfrom
dknos:fix/backup-posix-find-1431

Conversation

@dknos
Copy link
Copy Markdown

@dknos dknos commented Apr 5, 2026

Summary

  • Replaces GNU-only find -printf '%f\n' with POSIX-compatible find ... -exec basename {} \;
  • Fixes silent failure on macOS/BSD where -printf is not available

Test plan

  • Run backup-workspace.sh on Linux
  • Verify output matches previous behavior
  • Run shellcheck on the modified script

Fixes #1431

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved backup restore path selection logic to ensure correct identification of the most recent backup when restoring without a specific timestamp.

…workspace.sh

The -printf flag is GNU-specific and silently fails on macOS/BSD.
Use -exec basename instead for cross-platform compatibility.

Fixes NVIDIA#1431

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 5, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fae032b8-6d0f-4847-bf73-e8ae841f2533

📥 Commits

Reviewing files that changed from the base of the PR and between c99e3e8 and 0f1334c.

📒 Files selected for processing (1)
  • scripts/backup-workspace.sh

📝 Walkthrough

Walkthrough

The script replaces a GNU-specific find -printf '%f\n' command with a POSIX-compatible alternative using find -exec basename {}. This fixes silent failures on macOS/BSD systems where the -printf option is unsupported.

Changes

Cohort / File(s) Summary
Backup script compatibility
scripts/backup-workspace.sh
Replaced GNU-only find -printf with POSIX-compatible find -exec basename in restore path selection logic to enable cross-platform functionality.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

A rabbit hops through backup trees,
Where BSD find was brought to knees—
GNU extensions caused dismay,
But POSIX fixes save the day! 🐰
Now every system finds its way.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: replacing GNU-only find -printf with POSIX-compatible basename, which directly addresses the core issue being fixed.
Linked Issues check ✅ Passed The PR successfully addresses issue #1431 by replacing the GNU-only find -printf with POSIX-compatible find -exec basename, enabling cross-platform compatibility on macOS/BSD.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the find -printf compatibility issue; no unrelated modifications are present in this minimal, focused changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

backup-workspace.sh Uses GNU-Only find -printf — Silently Fails on macOS - IssueFinder - SN 09

2 participants