Open
Description
Observed Behavior
When I run install-vmod -h
in a Docker container (e.g. varnish:7.5.0
) with --platform=linux/arm64
or similar it breaks with the following exception:
#10 [builder 4/13] RUN set -ex; /usr/local/bin/install-vmod -h
#10 0.087 + /usr/local/bin/install-vmod -h
#10 0.096 Error while loading /usr/local/bin/install-vmod: Exec format error
#10 ERROR: process "/dev/.buildkit_qemu_emulator /bin/sh -c set -ex; /usr/local/bin/install-vmod -h" did not complete successfully: exit code: 1
------
> [builder 4/13] RUN set -ex; /usr/local/bin/install-vmod -h:
/usr/local/bin/install-vmod -h
0.096 Error while loading /usr/local/bin/install-vmod: Exec format error
------
Dockerfile:31
--------------------
30 |
31 | >>> RUN set -ex; \
32 | >>> /usr/local/bin/install-vmod -h
33 |
--------------------
Expected Behavior
I tracked it down to the shebang in https://github.com/varnish/toolbox/blob/master/install-vmod/install-vmod#L1 not being recognized somehow on ARM based docker images or runtimes.
Possible Solution
After changing the shebang to either #!/bin/sh
or #!/usr/bin/env bash
the script magically worked. To keep compatbility with the existing script and also keep minimal distros like Alpine in mind, the fixt might be:
- #/bin/sh
+ #!/bin/sh
Background
Wikipedia also mentiones the special syntax for shebangs as #!
so the current implementation might only work due to luck or amd variants having special fallbacks or syntax for first-line during execution.
Metadata
Metadata
Assignees
Labels
No labels