bug: /usr/bin/imds fails with printf format in user-data
Closed this issue · 1 comments
What happened:
I use /usr/bin/imds latest/user-data
to get the instance user-data and get the error /usr/bin/imds: line 40: printf: `D': invalid format character
at some point.
My user-data contains an URL with the sequence %3D
("=") which get interpreted by the "printf" command in the imds script and then fails.
What you expected to happen:
No error and the full user-data returned.
How to reproduce it (as minimally and precisely as possible):
- Create an instance with user-data containing "%D" (I use karpenter)
- On the instance, run
imds latest/user-data
- See error
Environment:
- AWS Region: N/A
- Instance Type(s): N/A
- Cluster Kubernetes version: N/A
- Node Kubernetes version: 1.30
- AMI Version: Amazon Linux 2023.6.20241111
I do not think that calling printf "$(cat $OUTPUT_FILE)\n"
with no additional arguments is needed. A simple cat $OUTPUT_FILE; echo
should be sufficient.
This is not blocking as I can read the user-data from the cloud-init
command or file directly.
@vflaux thanks for the report! Should be fixed 👍