Closed alcir closed 1 year ago
This regression happened recently with https://github.com/fedora-iot/greenboot/commit/84bbd674a7da12ea7c07657129d489942c69e449
@alcir did you want to open a RHBZ for this issue so we can track it for F38? (if not I can)
Thanks for finding it!
@alcir did you want to open a RHBZ for this issue so we can track it for F38? (if not I can)
I will
It is already tracked https://bugzilla.redhat.com/show_bug.cgi?id=2062455
Again, I'm not a bash expert, but instead of disable shellcheck, here
https://github.com/fedora-iot/greenboot/blob/7ad3ea53fd4154005bb26d2d48d41d4dc42853e1/usr/lib/greenboot/check/wanted.d/01_update_platforms_check.sh#L8
we could actually populate the UPDATE_PLATFORM_URLS array simply in this way
UPDATE_PLATFORM_URLS=($(grep -P -ho 'http[s]?.*' $REPOS_DIRECTORY/*))
or
readarray -t UPDATE_PLATFORM_URLS < <(grep -P -ho 'http[s]?.*' $REPOS_DIRECTORY/*)
Again, I'm not a bash expert, but instead of disable shellcheck, here
we could actually populate the UPDATE_PLATFORM_URLS array simply in this way
UPDATE_PLATFORM_URLS=($(grep -P -ho 'http[s]?.*' $REPOS_DIRECTORY/*))
orreadarray -t UPDATE_PLATFORM_URLS < <(grep -P -ho 'http[s]?.*' $REPOS_DIRECTORY/*)
Could you make this same suggestion on the PR itself (#94)? Maintaining the context of the suggestion would make it easier to discuss.
Yes that works for me, I also I made this that works as well using the tr command.
UPDATE_PLATFORM_URLS=$(grep -P -ho 'http[s]?.' $REPOS_DIRECTORY/ | tr '\n' ' ')
I don't know if it is a duplicate of #90 and #71, so excuse me in advance:
On a fresh Fedora IoT 37 I always get
Also running
/usr/lib/greenboot/check/wanted.d/01_update_platforms_check.sh
by hand after the boot, it returns the same result.I'm not a great bash expert, but I suspect that the double quotes around the
${UPDATE_PLATFORM_URLS[@]}
will result in a single line containing all the UPDATE_PLATFORM_URLS making ineffective the for loop https://github.com/fedora-iot/greenboot/blob/7ad3ea53fd4154005bb26d2d48d41d4dc42853e1/usr/lib/greenboot/check/wanted.d/01_update_platforms_check.sh#L16At the end of the day, the curl command is
curl -o /dev/null -Isw '%{http_code}\n' "https://ostree.fedoraproject.org/iot https://ostree.fedoraproject.org/iot/mirrorlist"
leading to a 000 HTTP_STATUS variable (that is curl: (3) URL using bad/illegal format or missing URL)In short: if in such line I remove the double quotes
for UPDATE_PLATFORM_URL in ${UPDATE_PLATFORM_URLS[@]}; do
the script works as expected.