Skip to content

Fix LegacyKeyValueFormat report from docker build: aarch64-gnu-debug#153109

Open
homersimpsons wants to merge 1 commit intorust-lang:mainfrom
homersimpsons:chore/fix-LegacyKeyValueFormat-aarch64-gnu-debug
Open

Fix LegacyKeyValueFormat report from docker build: aarch64-gnu-debug#153109
homersimpsons wants to merge 1 commit intorust-lang:mainfrom
homersimpsons:chore/fix-LegacyKeyValueFormat-aarch64-gnu-debug

Conversation

@homersimpsons
Copy link
Contributor

@homersimpsons homersimpsons commented Feb 25, 2026

Part of #152305

r? @marcoieni

@rustbot rustbot added A-CI Area: Our Github Actions CI A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. labels Feb 25, 2026
@marcoieni
Copy link
Member

The multiline way in which you set environment variables isn't equivalent to before.

Try with this Dockerfile:

FROM alpine:3.20

ENV SCRIPT \
  python3 ../x.py --stage 2 build && \
  python3 ../x.py --stage 2 test tests/run-make tests/run-make-cargo

CMD ["sh", "-lc", "printf 'SCRIPT=<%s>\\n' \"$SCRIPT\""]
$ docker build -t env-test .
docker run --rm env-test

prints an output that is trimmed (no space at begin or end)

SCRIPT=<python3 ../x.py --stage 2 build &&   python3 ../x.py --stage 2 test tests/run-make tests/run-make-cargo>

While the following dockerfile (taken from your pr):

FROM alpine:3.20

ENV SCRIPT=" \
  python3 ../x.py --stage 2 build && \
  python3 ../x.py --stage 2 test tests/run-make tests/run-make-cargo"

CMD ["sh", "-lc", "printf 'SCRIPT=<%s>\\n' \"$SCRIPT\""]

prints an output that has spaces at the beginning:

SCRIPT=<   python3 ../x.py --stage 2 build &&   python3 ../x.py --stage 2 test tests/run-make tests/run-make-cargo>

@homersimpsons
Copy link
Contributor Author

homersimpsons commented Feb 26, 2026

Thanks for your feedback @marcoieni. In fact there is a leading space change. I do not recall if I spotted this, but I think this is not an issue.

The only alternative I can think of is to inline the first line making this potentially harder to read:

-ENV SCRIPT=" \
-  python3 ../x.py --stage 2 build && \
+ENV SCRIPT="python3 ../x.py --stage 2 build && \
  python3 ../x.py --stage 2 test tests/run-make tests/run-make-cargo"

In fact the \ does not trim the leading space in the subsequent lines (this can be observed with the second set of whitespaces after the &&) so ENV SCRIPT="\ still has 2 leading whitespaces.

The documentation https://docs.docker.com/reference/build-checks/legacy-key-value-format/ does not mention this difference, so I do not know if that is expected on docker side. I opened docker/docs#24227.

Do you prefer:

  1. I keep it like this (with leading space)? (I can remove 1 out of 3 leading space with "\ instead of " \)
  2. I inline the first line (remove the leading spaces)?
  3. Other?

@marcoieni
Copy link
Member

I prefer option 2, so that the env var doesn't have leading whitespaces. Your diff looks good! 👍

Probably the scripts will work anyway, but bash is weird so I prefer to change the Dockerfiles without affecting their behavior.

@homersimpsons homersimpsons force-pushed the chore/fix-LegacyKeyValueFormat-aarch64-gnu-debug branch from 8142d08 to 934e9a1 Compare February 27, 2026 12:03
@homersimpsons homersimpsons force-pushed the chore/fix-LegacyKeyValueFormat-aarch64-gnu-debug branch from 934e9a1 to 6df2169 Compare February 27, 2026 12:03
@homersimpsons
Copy link
Contributor Author

I prefer option 2, so that the env var doesn't have leading whitespaces.

Okay, I updated both SCRIPT and RUST_CONFIGURE_ARGS so this is consistent.

Probably the scripts will work anyway, but bash is weird so I prefer to change the Dockerfiles without affecting their behavior.

I can alternatively update only the SCRIPT environment variable if we want to distinguish between "bash scripts" and the other.

@marcoieni
Copy link
Member

@bors try jobs=aarch64-gnu-debug

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Feb 27, 2026
…aarch64-gnu-debug, r=<try>

Fix LegacyKeyValueFormat report from docker build: aarch64-gnu-debug


try-job: aarch64-gnu-debug
@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 27, 2026

☀️ Try build successful (CI)
Build commit: 1d1589a (1d1589a68549b48bb33fe49281c4f8aeb006159e, parent: 6f54d591c3116ee7f8ce9321ddeca286810cc142)

@marcoieni
Copy link
Member

@bors r+ rollup=always

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 27, 2026

📌 Commit 6df2169 has been approved by marcoieni

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CI Area: Our Github Actions CI A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants