Skip to content

CMake: Guard script configure_file() calls with ENABLE_SCRIPTS#210

Closed
rzikm wants to merge 1 commit intotukaani-project:masterfrom
rzikm:cmake-guard-scripts-configure
Closed

CMake: Guard script configure_file() calls with ENABLE_SCRIPTS#210
rzikm wants to merge 1 commit intotukaani-project:masterfrom
rzikm:cmake-guard-scripts-configure

Conversation

@rzikm
Copy link
Copy Markdown
Contributor

@rzikm rzikm commented Feb 23, 2026

The configure_file() calls for xzdiff, xzgrep, xzmore, and xzless were running unconditionally within the if(UNIX) block, even when ENABLE_SCRIPTS was OFF. This would cause a build failure if the src/scripts/*.in files were not present (we do that since we want to only build liblzma and link it to our application and want to minimize vendored code size)

Move the foreach loop inside the existing if(ENABLE_SCRIPTS) guard so that configure_file() is only called when scripts are actually being built and installed.

The configure_file() calls for xzdiff, xzgrep, xzmore, and xzless
were running unconditionally within the if(UNIX) block, even when
ENABLE_SCRIPTS was OFF. This would cause a build failure if the
src/scripts/*.in files were not present.

Move the foreach loop inside the existing if(ENABLE_SCRIPTS) guard
so that configure_file() is only called when scripts are actually
being built and installed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Larhzu added a commit that referenced this pull request Feb 24, 2026
The configure_file() calls for xzdiff, xzgrep, xzmore, and xzless
were running unconditionally within the if(UNIX) block, even when
ENABLE_SCRIPTS was OFF. This would cause a build failure if the
src/scripts/*.in files were not present. Deleting those files can
simplify license compliance when the scripts aren't needed.

Move the foreach loop and related code inside if(ENABLE_SCRIPTS) guard
so that configure_file() is only called when scripts are actually needed.
This is most whitespace changes to adjust the indentation.

Co-authored-by: Lasse Collin <lasse.collin@tukaani.org>
Closes: #210
@Larhzu
Copy link
Copy Markdown
Member

Larhzu commented Feb 24, 2026

Thanks! I simplified it so that there is only one if(ENABLE_SCRIPTS) block. It's in the misc branch at the moment. I didn't merge it yet. Please check that the modified commit, including the commit message, are OK.

I noticed that a few issues were found in 124003 so I fixed those as well. The comment about _OPENBSD_SOURCE I didn't understand though; it looks like a false alarm, but I mention it anyway in case I missed something.

The file descriptor comment is a false positive. Opening with the opposite modes is intentional.

When sophisticated tools like static analyzers or LLMs are used to find and/or fix issues, mentioning it in the commit message might be good. However, Co-authored-by is a wrong trailer for this. A LLM isn't a legal entity, it cannot be a copyright holder, and it isn't responsible for the work.

When the work is very small in size (like this PR), it likely doesn't cross the copyrightability threshold. However, with bigger patches, the copyright status of LLM-generated works isn't clear to me, so I'm wary of accepting such patches for now.

@rzikm
Copy link
Copy Markdown
Contributor Author

rzikm commented Feb 24, 2026

Hey, thanks for taking time to go through the linked .NET runtime PR.

I didn't merge it yet. Please check that the modified commit, including the commit message, are OK.

LGTM!

I noticed that a few issues were found in dotnet/runtime#124003 so I fixed those as well. The dotnet/runtime#124003 (comment) about _OPENBSD_SOURCE I didn't understand though; it looks like a false alarm, but I mention it anyway in case I missed something.

The dotnet/runtime#124003 (comment) comment is a false positive. Opening with the opposite modes is intentional.

I didn't give too much attention to those LLM review comments because the intent of that PR is to vendor the source code with as little modifications as possible (to simplify future updates). My impression is that on giant PRs like those (+50k LOC) it might be more prone to hallucinations due to insufficient context window.

When sophisticated tools like static analyzers or LLMs are used to find and/or fix issues, mentioning it in the commit message might be good. However, Co-authored-by is a wrong trailer for this. A LLM isn't a legal entity, it cannot be a copyright holder, and it isn't responsible for the work.

I will pass that to relevant feedback channel. Personally, I would be fine with omitting it and keeping only myself as the commit author, as I would make the same change manually and wouldn't raise a generated PR that wouldn't be up to my standard.

@Larhzu Larhzu closed this in b51d67f Feb 25, 2026
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