Skip to content

fix(demo): read file modes with GNU stat first - #201

Merged
tonibergholm-codento merged 1 commit into
mainfrom
demo-stat
Oct 19, 2026
Merged

tonibergholm-codento merged 1 commit into
mainfrom
demo-stat

Conversation

@tonibergholm

@tonibergholm tonibergholm commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

demo/run_tls_demo.sh failed on Linux at its key.pem mode check. file_mode tried stat -f "%Lp" first; on GNU stat -f means filesystem status and exits 0, so the stat -c fallback was never reached and the check compared filesystem info with 600. The GNU form now goes first; on macOS stat -c is invalid and falls through to the BSD form. The demo now ends RESULT: ok on Linux. No code change.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved compatibility of the TLS demo on GNU/Linux systems by correctly detecting file permissions. The demo continues to support macOS, so permission checks work across both platforms without requiring users to change their setup.

The comment said portable across BSD and GNU, but on GNU stat 'stat -f' means
filesystem status and succeeds, so the %Lp form never failed over to -c and the
mode check saw filesystem info. Try the GNU form first; on macOS 'stat -c' is
invalid and falls through to 'stat -f %Lp'.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T12:39:47.546679Z 6f99bb2 PR opened
🔒 Security Review ✅ Completed 2026-10-19T12:40:51.057120Z 6f99bb2 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: da571d14-898a-4358-adc3-ee922701f7c9
📥 Commits

Reviewing files that changed from the base of the PR and between 26bf01e and 6f99bb2.

📒 Files selected for processing: 1
  • demo/run_tls_demo.sh

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

📝 Walkthrough

The file_mode function now tries GNU stat -c "%a" first. If that command does not return a mode, the function falls back to BSD/macOS stat -f "%Lp".

Changes: File mode lookup

Layer / File(s) Summary
Stat fallback order
demo/run_tls_demo.sh
file_mode tries GNU stat -c "%a" before the BSD/macOS fallback.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 6f99b

The mode lookup uses the BSD/macOS fallback when the GNU form is unsupported, and the key-mode check remains in place. No actionable merge risk remains.

### Architecture Summary

Architecture risk: 🔵 Low · up to 6f99b

The change affects 1 system.

Changed systems: demo

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — demo (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in demo/run_tls_demo.sh: file_mode now tries GNU stat -c "%a" first and falls back to BSD/macOS stat -f "%Lp"; the previous order tried the BSD form first.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed 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 clearly and concisely describes the main change: using GNU stat first when reading file modes in the demo script.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@tonibergholm-codento
tonibergholm-codento merged commit 3a6d79e into main Oct 19, 2026
8 checks passed
@tonibergholm
tonibergholm deleted the demo-stat branch October 19, 2026 12:47
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.

2 participants