Skip to content

style: Strip stray control characters instead of excluding files - #691

Closed
echoix wants to merge 1 commit into
mainfrom
editorconfig-strip-control-bytes
Closed

echoix wants to merge 1 commit into
mainfrom
editorconfig-strip-control-bytes

Conversation

@echoix

@echoix echoix commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Follow-up to OSGeo#7459 and resolution of OSGeo#7888.

The editorconfig-checker bump to v3.11.3 added a pre-decode binary-detection
check that flags a file as binary, and so fails the utf-8 charset check, if it
contains any C0 control byte. Four files were marked charset = unset as a
mechanical workaround. In OSGeo#7888, @nilason confirmed the bytes in
three of them carry no meaning and are better removed, including the vendored
ccmath file, which is no longer maintained upstream.

Changes

  • raster/r.drain/README, scripts/r.drain/README: drop a stray 0x18 (CAN)
    in line 24, that <CAN>differ a little from r.drain.
  • lib/external/ccmath/C01-matrix: lines 880-881 held a 0x13/0x16
    (DC3/SYN) pair acting as a subscript toggle around U1. The same matrix is
    written plainly as U1 everywhere else in that file, including at lines
    682-694, 788, 803, 811 and 868, and in the very signature these two lines
    document (u1 = pointer to store of m by n transformation matrix U1), so
    the reading is confirmed rather than inferred.
  • .editorconfig: the exception now covers only configure, whose BEL byte is
    a legitimate awk field separator in autoconf-generated code.

No behavioral change; documentation and build-config text only.

Verification

pre-commit run editorconfig-checker --all-files reports zero charset, utf-8
or binary errors across the tree. lib/external/ccmath/C01-matrix is now
decoded and charset-checked without complaint rather than skipped, which is
the positive confirmation that the strip worked; the two READMEs no longer
appear at all.

The only errors in that run are line-ending ones, which are a local
core.autocrlf=true checkout artifact on Windows (git ls-files --eol shows
i/lf w/crlf on untouched files too), not something this PR introduces.

Opened against my own fork first for a look before it goes to OSGeo/grass.

AI (Claude Opus 5) was used to locate the byte sequences, verify the U1
reading against the rest of the file, and check the result with the hook.

The editorconfig-checker bump to v3.11.3 (OSGeo#7459) added a pre-decode
binary-detection check that flags a file as binary, and thus failing the
utf-8 charset check, if it contains any C0 control byte. Four files were
marked charset = unset as a workaround. Per the discussion in OSGeo#7888,
three of them hold no meaning in those bytes and are better cleaned up:

- raster/r.drain/README and scripts/r.drain/README contain a stray CAN
  (0x18) inside "that differ a little from r.drain".
- lib/external/ccmath/C01-matrix contains a DC3/SYN pair acting as a
  subscript toggle around "U1"; the same matrix is spelled U1 plainly
  everywhere else in that file.

Only configure still needs the exception: its BEL byte is a legitimate
awk field separator in autoconf-generated code.

Closes OSGeo#7888
@echoix echoix changed the title editorconfig: Strip stray control characters instead of excluding files style: Strip stray control characters instead of excluding files Sep 5, 2026
@echoix
echoix force-pushed the editorconfig-strip-control-bytes branch from 6b49fc6 to 831b864 Compare September 5, 2026 16:19
@echoix echoix closed this Sep 5, 2026
@echoix
echoix deleted the editorconfig-strip-control-bytes branch September 12, 2026 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant