Skip to content

fix(slsa): replace deprecated jq --argfile with --rawfile + fromjson - #209

Open
imlk0 wants to merge 1 commit into
openanolis:mainfrom
imlk0:no-argfile
Open

fix(slsa): replace deprecated jq --argfile with --rawfile + fromjson#209
imlk0 wants to merge 1 commit into
openanolis:mainfrom
imlk0:no-argfile

Conversation

@imlk0

@imlk0 imlk0 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

tools/slsa/slsa-generator used jq's --argfile option, which is deprecated as of jq 1.7, makes it failed to run on Alinux4. This replaces it with the non-deprecated, semantically equivalent --rawfile + fromjson.

Why

--argfile reads a file and parses it as JSON, storing the value in a variable. jq 1.7+ emits a deprecation warning for it and recommends moving off it. The drop-in replacement is --rawfile (reads the file contents as a raw string) combined with fromjson (parses that string back into a JSON value), producing an identical result.

Changes

  • tools/slsa/slsa-generator: the two jq -n invocations that built the trustee bundle now use --rawfile ... ($var|fromjson) instead of --argfile ... $var.

Verification

Confirmed the produced bundle is byte-identical between the old and new invocations using sample JSON inputs:

=== old --argfile (jq 1.6) ===
{ "sourceBundle": { "a": 1 }, "dsseEnvelope": { "b": 2 }, "rekorEntryV2": { "c": 3 } }
=== new --rawfile + fromjson ===
{ "sourceBundle": { "a": 1 }, "dsseEnvelope": { "b": 2 }, "rekorEntryV2": { "c": 3 } }

🤖 Generated with Claude Code

@ostest-bot

Copy link
Copy Markdown

@imlk0 ,您好,您的请求已接收,请耐心等待结果。

@ostest-bot

Copy link
Copy Markdown

@imlk0 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start

jq 1.7+ deprecates --argfile. Replace it with the semantically
equivalent --rawfile (reads the file as a raw string) combined with
fromjson, which parses the string back into a JSON value. Verified the
produced bundle is byte-identical to the previous --argfile output.

Co-Authored-By: Claude <noreply@anthropic.com>
@ostest-bot

Copy link
Copy Markdown

@imlk0 ,您好,您的请求已接收,请耐心等待结果。

@ostest-bot

Copy link
Copy Markdown

@imlk0 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start

@ostest-bot

Copy link
Copy Markdown

@imlk0 ,您好,您的请求已接收,请耐心等待结果。

@ostest-bot

Copy link
Copy Markdown

@imlk0 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start

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