Skip to content

build: Fix findstr syntax for Windows build - #7343

Merged
HuidaeCho merged 1 commit into
OSGeo:mainfrom
HuidaeCho:win_findstr_regex
Apr 28, 2026
Merged

HuidaeCho merged 1 commit into
OSGeo:mainfrom
HuidaeCho:win_findstr_regex

Conversation

@HuidaeCho

@HuidaeCho HuidaeCho commented Apr 27, 2026 •

Copy link
Copy Markdown
Member

This PR fixes findstr syntax. findstr uses spaces for or and sometimes requires /r for regex (even though it's the default?).

rem doesn't work
echo "a-b" | findstr "x a.b"

rem works
echo "a-b" | findstr /r "x a.b"

rem works?
echo "a-b" | findstr "a.b x"

Without this PR, generated HTML files are broken, causing:

  C:/Users/hcho/src/grass/grass/build/output/lib/grass86/docs/html/d.barscale.ht
ml:214:0: Error (IndexError('pop from empty list')): </div>

@github-actions github-actions Bot added the CMake label Apr 27, 2026
@HuidaeCho HuidaeCho added the windows Microsoft Windows specific label Apr 27, 2026
@HuidaeCho HuidaeCho self-assigned this Apr 27, 2026
@HuidaeCho HuidaeCho added the bug Something isn't working label Apr 27, 2026

@echoix echoix left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a weird previous behavior. Trusting your testing, as you're probable the one that will fix it if doesn't work.

Would there be an advantage to use CMake's file(READ), string(REPLACE), and file(WRITE)? Would it end up simpler or with better documentation, even if done in three steps? Probably wouldn't be faster on Linux, but might be easier to debug if it's the same on all platforms. But it differs from the autotools build

@HuidaeCho

Copy link
Copy Markdown
Member Author

This might be possible, but file() doesn't support piping as far as I know. For now, I'll merge it and focus on other Windows stuff. We can revisit this cross-platform option later.

file(READ "${IN}" txt)

string(REPLACE "</body>" "" txt "${txt}")
string(REPLACE "</html>" "" txt "${txt}")
string(REPLACE "</div> <!-- end container -->" "" txt "${txt}")

file(WRITE "${OUT}" "${txt}")

@HuidaeCho
HuidaeCho merged commit e41d35c into OSGeo:main Apr 28, 2026
27 checks passed
@github-actions github-actions Bot added this to the 8.6.0 milestone Apr 28, 2026
@nilason

nilason commented May 6, 2026

Copy link
Copy Markdown
Contributor

@HuidaeCho Shall we backport this to 8.5?

@nilason nilason added the backport to 8.5 PR needs to be backported to release branch 8.5 label May 6, 2026
@wenzeslaus wenzeslaus removed the backport to 8.5 PR needs to be backported to release branch 8.5 label May 8, 2026
ninsbl pushed a commit to ninsbl/grass that referenced this pull request Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working CMake windows Microsoft Windows specific

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants