On Tue, 15 Nov 2022 09:55:38 GMT, Ludvig Janiuk <[email protected]> wrote:
> When jib tries to download itself behind a proxy, sometimes it can get a
> different file than it expected. This can result in cryptic errors that are
> hard to troubleshoot. Let's handle this a little more gracefully by detecting
> it in the bootstrapper and printing an error.
bin/jib.sh line 137:
> 135: FILEOUTPUT=`file ${installed_jib_script}.gz`
> 136: # ${X:${#Y}} gives X without the first ${#Y} characters, and ${#Y}
> is length of Y.
> 137: FILEOUTPUT=${FILEOUTPUT:${#PREFIX}}
I think this is a bashism. While we do have /bin/bash in the shebang, this does
not really matter since we have no executable bit on the script, so users will
have to explicitly call it with a shell. So many users are likely to do `sh
bin/jib.sh`, and then this will break.
My recommendation would be to use standard tools like cut or grep instead,
something like:
file $installedscript.gz | grep "gzip compressed data" -q
if test $? -neq 0; then
...
-------------
PR: https://git.openjdk.org/jdk/pull/11159