Skip to content

fix: add three more offline fix rules - #125

Merged
Sym-jay merged 2 commits into
Sym-jay:mainfrom
shounakjoshi88-a11y:fix/more-offline-rules
Nov 22, 2026
Merged

Sym-jay merged 2 commits into
Sym-jay:mainfrom
shounakjoshi88-a11y:fix/more-offline-rules

Conversation

@shounakjoshi88-a11y

Copy link
Copy Markdown
Contributor

Fixes #124.

Adds three offline rules to fix.py and registers them in RULES:

  • mkdir with No such file or directory → suggests mkdir -p (makes missing parents; no-op if they exist).
  • A dpkg was interrupted error → suggests sudo dpkg --configure -a && <original command>.
  • /bin/bash^M: bad interpreter on a .sh script → suggests stripping CRLF with sed -i 's/\r$//' then rerunning.

Each follows the existing (command, error) -> {"explanation", "command"} or None pattern. The rules suggest no data deletion and quote arguments.

Added three rows to the test_offline_fixes table: all three fail on the base (no rule matches) and pass with the change. tests/test_fix.py 32/32.

Two unrelated test modules (test_macos.py, test_tour.py) fail to collect in this environment; they fail identically on the unmodified tree.

@Sym-jay

Sym-jay commented Nov 21, 2026

Copy link
Copy Markdown
Owner

Thanks for picking this up so fast, nice clean rules! Three small things before merging:

  1. On macOS, sed -i 's/\r$//' doesn't work (BSD sed needs -i '' and doesn't know \r). My fault, that came from the issue. perl -pi -e 's/\r$//' <file> works on both Linux and macOS.
  2. Please add one case where a rule must stay quiet, e.g. mkdir -p a/b with that error should return nothing.
  3. Could the explanations use plainer words? e.g. "The script was saved on Windows, and its line endings confuse Linux" instead of CRLF/carriage return.

I've approved the CI run.

Review on Sym-jay#125: BSD sed lacks GNU's -i and \\r handling, so use perl which works on both Linux and macOS. Reword the explanation without CRLF jargon, and add a case where mkdir -p stays quiet.

Signed-off-by: Shounak Joshi <25joshiss_1@rbunagpur.in>
@shounakjoshi88-a11y

Copy link
Copy Markdown
Contributor Author

All three addressed in 95e1e3c, pushed:

  1. The line-ending fix now uses perl -pi -e 's/\r$//' <file>, which works on both GNU and BSD systems. The test expectation is updated.
  2. Added a quiet case to test_new_rules_stay_out_of_the_way: mkdir -p a/b with a "No such file or directory" error returns nothing, since -p is already present.
  3. Reworded the explanation to "The script was saved on Windows, and its line endings confuse Linux", without CRLF jargon.

tests/test_fix.py 32/32. Ready for another look.

@Sym-jay

Sym-jay commented Nov 22, 2026

Copy link
Copy Markdown
Owner

Thanks for addressing the issues. CI runs all passed.

Merging.

@Sym-jay
Sym-jay merged commit c5c3cd5 into Sym-jay:main Nov 22, 2026
4 checks passed
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.

fix that: mkdir -p, interrupted dpkg, Windows line endings

2 participants