sdkman / sdkman-cli

The SDKMAN! Command Line Interface
https://sdkman.io
Apache License 2.0
6.06k stars 628 forks source link

Bug: Springboot installation and upgradefail on macOS #1000

Closed npalladium closed 2 years ago

npalladium commented 2 years ago

Bug report While trying to either install or update springboot, on macOS it fails with the following message:

  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of /Users/<user>/.sdkman/archives/springboot-2.5.5.zip or
        /Users/<user>/.sdkman/archives/springboot-2.5.5.zip.zip, and cannot find /Users/<user>/.sdkman/archives/springboot-2.5.5.zip.ZIP, period.

To reproduce

System info

Any help would be appreciated. Thank you.

marc0der commented 2 years ago

Hi @npalladium, I've just tried this in a clean environment and can't replicate it. Are you seeing this with anything other than springboot?

npalladium commented 2 years ago

@marc0der, I'm seeing it only with springboot. Updated Java, Kotlin, Micronaut etc today and all of them worked. Springboot has been giving me this message for a while.

Any debugging tips?

marc0der commented 2 years ago

Can you try to flush your archives folder and retry installation? Perhaps you have a corrupted cached archive.

npalladium commented 2 years ago

By flushing, I'm assuming you mean deleting all the files in the folder. 😅 Did that and issue persists.

marc0der commented 2 years ago

Just run sdk flush archives. If you could also enable debug mode (see the config section on our site) and dump all the console output. The bit you pasted in the issue doesn't give any context.

npalladium commented 2 years ago

Ran sdk flush archives with no change.

The output with sdkman_debug_mode:

No update at this time. Using existing cache: activemq,ant,asciidoctorj,ballerina,bpipe,btrace,concurnas,connor,cuba,cxf,doctoolchain,flink,gaiden,gradle,gradleprofiler,grails,groovy,groovyserv,hadoop,http4k,infrastructor,java,jbake,jbang,jmc,jmeter,jreleaser,karaf,kotlin,kscript,layrry,leiningen,maven,micronaut,mulefd,mvnd,pomchecker,quarkus,sbt,scala,spark,springboot,sshoogr,test,tomcat,vertx,visualvm,webtau,znai
Not refreshing version cache now...

Downloading: springboot 2.5.5

In progress...

#=#=#                                                                          
##O#- #                                                                        
##O=#  #                                                                       
#=#=-#  #                                                                      
-#O#- #   #                                                                    
-=#=#   #   #                                                                  
-=O#- #  #    #                                                                
-=O=#  #   #    #                                                              
-=O=-#  #    #    #                                                            
-=O=- #   #    #    #                                                          

Stop! The archive was corrupt and has been removed! Please try installing again.

The output upon using set -x (without debug mode):

+ COMMAND=install
+ QUALIFIER=springboot
+ case "$COMMAND" in
+ [[ install == \h\o\m\e ]]
+ [[ install == \c\o\m\p\l\e\t\i\o\n ]]
+ [[ install != \u\p\d\a\t\e ]]
+ ___sdkman_check_candidates_cache /Users/<user>/.sdkman/var/candidates
+ local candidates_cache=/Users/<user>/.sdkman/var/candidates
+ [[ -f /Users/<user>/.sdkman/var/candidates ]]
+ [[ -n activemq,ant,asciidoctorj,ballerina,bpipe,btrace,concurnas,connor,cuba,cxf,doctoolchain,flink,gaiden,gradle,gradleprofiler,grails,groovy,groovyserv,hadoop,http4k,infrastructor,java,jbake,jbang,jmc,jmeter,jreleaser,karaf,kotlin,kscript,layrry,leiningen,maven,micronaut,mulefd,mvnd,pomchecker,quarkus,sbt,scala,spark,springboot,sshoogr,test,tomcat,vertx,visualvm,webtau,znai ]]
++ find /Users/<user>/.sdkman/var/candidates -mmin +43200
+ [[ -n '' ]]
+ [[ -f /Users/<user>/.sdkman/var/candidates ]]
+ [[ -z activemq,ant,asciidoctorj,ballerina,bpipe,btrace,concurnas,connor,cuba,cxf,doctoolchain,flink,gaiden,gradle,gradleprofiler,grails,groovy,groovyserv,hadoop,http4k,infrastructor,java,jbake,jbang,jmc,jmeter,jreleaser,karaf,kotlin,kscript,layrry,leiningen,maven,micronaut,mulefd,mvnd,pomchecker,quarkus,sbt,scala,spark,springboot,sshoogr,test,tomcat,vertx,visualvm,webtau,znai ]]
+ __sdkman_echo_debug 'No update at this time. Using existing cache: activemq,ant,asciidoctorj,ballerina,bpipe,btrace,concurnas,connor,cuba,cxf,doctoolchain,flink,gaiden,gradle,gradleprofiler,grails,groovy,groovyserv,hadoop,http4k,infrastructor,java,jbake,jbang,jmc,jmeter,jreleaser,karaf,kotlin,kscript,layrry,leiningen,maven,micronaut,mulefd,mvnd,pomchecker,quarkus,sbt,scala,spark,springboot,sshoogr,test,tomcat,vertx,visualvm,webtau,znai'
+ [[ false == \t\r\u\e ]]
+ return 0
+ ___sdkman_check_version_cache
+ local version_url
+ local version_file=/Users/<user>/.sdkman/var/version
+ [[ false != \t\r\u\e ]]
+ [[ -f /Users/<user>/.sdkman/var/version ]]
++ find /Users/<user>/.sdkman/var/version -mmin +1440
+ [[ -z '' ]]
+ __sdkman_echo_debug 'Not refreshing version cache now...'
+ [[ false == \t\r\u\e ]]
++ cat /Users/<user>/.sdkman/var/version
+ SDKMAN_REMOTE_VERSION=5.12.4
+ SDKMAN_AVAILABLE=true
+ '[' -z false ']'
+ __sdkman_update_broadcast_and_service_availability
++ __sdkman_determine_broadcast_id
++ [[ false == \t\r\u\e ]]
++ [[ install == \o\f\f\l\i\n\e ]]
+++ __sdkman_secure_curl_with_timeouts https://api.sdkman.io/2/broadcast/latest/id
+++ [[ false == \t\r\u\e ]]
+++ curl --silent --location --connect-timeout 7 --max-time 10 https://api.sdkman.io/2/broadcast/latest/id
++ echo 616a0821e03dd8000739ca2f
+ local broadcast_live_id=616a0821e03dd8000739ca2f
+ __sdkman_set_availability 616a0821e03dd8000739ca2f
+ local broadcast_id=616a0821e03dd8000739ca2f
++ echo 616a0821e03dd8000739ca2f
++ tr '[:upper:]' '[:lower:]'
++ grep html
+ local detect_html=
+ [[ -z 616a0821e03dd8000739ca2f ]]
+ [[ -n '' ]]
+ SDKMAN_AVAILABLE=true
+ __sdkman_update_broadcast 616a0821e03dd8000739ca2f
+ local broadcast_live_id broadcast_id_file broadcast_text_file broadcast_old_id
+ broadcast_live_id=616a0821e03dd8000739ca2f
+ broadcast_id_file=/Users/<user>/.sdkman/var/broadcast_id
+ broadcast_text_file=/Users/<user>/.sdkman/var/broadcast
+ broadcast_old_id=
+ [[ -f /Users/<user>/.sdkman/var/broadcast_id ]]
+ broadcast_old_id=616a0821e03dd8000739ca2f
+ [[ -f /Users/<user>/.sdkman/var/broadcast ]]
+ BROADCAST_OLD_TEXT='==== BROADCAST =================================================================
* 2021-10-15: webtau 1.44.1 available on SDKMAN!
* 2021-10-12: grails 5.0.0 available on SDKMAN!
* 2021-10-12: gradle 7.3-rc-1 available on SDKMAN!
================================================================================'
+ [[ true == \t\r\u\e ]]
+ [[ 616a0821e03dd8000739ca2f != \6\1\6\a\0\8\2\1\e\0\3\d\d\8\0\0\0\7\3\9\c\a\2\f ]]
+ '[' -f /Users/<user>/.sdkman/etc/config ']'
+ source /Users/<user>/.sdkman/etc/config
++ sdkman_auto_answer=false
++ sdkman_auto_selfupdate=false
++ sdkman_insecure_ssl=false
++ sdkman_curl_connect_timeout=7
++ sdkman_curl_max_time=10
++ sdkman_beta_channel=false
++ sdkman_debug_mode=false
++ sdkman_colour_enable=true
++ sdkman_auto_env=false
++ sdkman_rosetta2_compatible=true
++ sdkman_auto_complete=true
++ sdkman_selfupdate_enable=true
+ [[ -z install ]]
+ CMD_FOUND=
+ CMD_TARGET=/Users/<user>/.sdkman/src/sdkman-install.sh
+ [[ -f /Users/<user>/.sdkman/src/sdkman-install.sh ]]
+ CMD_FOUND=/Users/<user>/.sdkman/src/sdkman-install.sh
+ CMD_TARGET=/Users/<user>/.sdkman/ext/sdkman-install.sh
+ [[ -f /Users/<user>/.sdkman/ext/sdkman-install.sh ]]
+ [[ -z /Users/<user>/.sdkman/src/sdkman-install.sh ]]
++ echo activemq ant asciidoctorj ballerina bpipe btrace concurnas connor cuba cxf doctoolchain flink gaiden gradle gradleprofiler grails groovy groovyserv hadoop http4k infrastructor java jbake jbang jmc jmeter jreleaser karaf kotlin kscript layrry leiningen maven micronaut mulefd mvnd pomchecker quarkus sbt scala spark springboot sshoogr test tomcat vertx visualvm webtau znai
++ grep -w springboot
+ local 'sdkman_valid_candidate=activemq ant asciidoctorj ballerina bpipe btrace concurnas connor cuba cxf doctoolchain flink gaiden gradle gradleprofiler grails groovy groovyserv hadoop http4k infrastructor java jbake jbang jmc jmeter jreleaser karaf kotlin kscript layrry leiningen maven micronaut mulefd mvnd pomchecker quarkus sbt scala spark springboot sshoogr test tomcat vertx visualvm webtau znai'
+ [[ -n springboot ]]
+ [[ install != \o\f\f\l\i\n\e ]]
+ [[ install != \f\l\u\s\h ]]
+ [[ install != \s\e\l\f\u\p\d\a\t\e ]]
+ [[ install != \e\n\v ]]
+ [[ install != \c\o\m\p\l\e\t\i\o\n ]]
+ [[ install != \e\d\i\t ]]
+ [[ -z activemq ant asciidoctorj ballerina bpipe btrace concurnas connor cuba cxf doctoolchain flink gaiden gradle gradleprofiler grails groovy groovyserv hadoop http4k infrastructor java jbake jbang jmc jmeter jreleaser karaf kotlin kscript layrry leiningen maven micronaut mulefd mvnd pomchecker quarkus sbt scala spark springboot sshoogr test tomcat vertx visualvm webtau znai ]]
+ [[ install == \o\f\f\l\i\n\e ]]
++ echo install
++ tr - _
+ CONVERTED_CMD_NAME=install
+ local final_rc=0
+ '[' -n /Users/<user>/.sdkman/src/sdkman-install.sh ']'
+ __sdk_install springboot '' ''
+ local candidate version folder
+ candidate=springboot
+ version=
+ folder=
+ __sdkman_check_candidate_present springboot
+ local candidate=springboot
+ '[' -z springboot ']'
+ __sdkman_determine_version springboot '' ''
+ local candidate version folder
+ candidate=springboot
+ version=
+ folder=
+ [[ true == \f\a\l\s\e ]]
+ [[ true == \f\a\l\s\e ]]
+ [[ true == \f\a\l\s\e ]]
+ [[ true == \f\a\l\s\e ]]
+ [[ -z '' ]]
++ __sdkman_secure_curl https://api.sdkman.io/2/candidates/default/springboot
++ [[ false == \t\r\u\e ]]
++ curl --silent --location https://api.sdkman.io/2/candidates/default/springboot
+ version=2.5.5
++ echo darwinx64
++ tr '[:upper:]' '[:lower:]'
+ local validation_url=https://api.sdkman.io/2/candidates/validate/springboot/2.5.5/darwinx64
++ __sdkman_secure_curl https://api.sdkman.io/2/candidates/validate/springboot/2.5.5/darwinx64
++ [[ false == \t\r\u\e ]]
++ curl --silent --location https://api.sdkman.io/2/candidates/validate/springboot/2.5.5/darwinx64
+ VERSION_VALID=valid
+ __sdkman_echo_debug 'Validate springboot 2.5.5 for darwinx64: valid'
+ [[ false == \t\r\u\e ]]
+ __sdkman_echo_debug 'Validation URL: https://api.sdkman.io/2/candidates/validate/springboot/2.5.5/darwinx64'
+ [[ false == \t\r\u\e ]]
+ [[ valid == \v\a\l\i\d ]]
+ VERSION=2.5.5
+ [[ -d /Users/<user>/.sdkman/candidates/springboot/2.5.5 ]]
+ [[ -L /Users/<user>/.sdkman/candidates/springboot/2.5.5 ]]
+ [[ valid == \v\a\l\i\d ]]
+ __sdkman_determine_current_version springboot
+ local candidate present
+ candidate=springboot
++ __sdkman_path_contains /Users/<user>/.sdkman/candidates/springboot
++ local candidate exists
++ candidate=/Users/<user>/.sdkman/candidates/springboot
+++ echo /Users/<user>/.sdkman/candidates/springboot/current/bin:/Users/<user>/.sdkman/candidates/micronaut/current/bin:/Users/<user>/.sdkman/candidates/maven/current/bin:/Users/<user>/.sdkman/candidates/leiningen/current/bin:/Users/<user>/.sdkman/candidates/kscript/current/bin:/Users/<user>/.sdkman/candidates/kotlin/current/bin:/Users/<user>/.sdkman/candidates/java/current/bin:./.venv/bin:/Users/<user>/bin:/Users/<user>/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:./node_modules/.bin:/Users/<user>/.rvm/bin:/Users/<user>/.go/bin:/Users/<user>/go/bin:/Users/<user>/.emacs.d/bin/
+++ grep /Users/<user>/.sdkman/candidates/springboot
++ exists=/Users/<user>/.sdkman/candidates/springboot/current/bin:/Users/<user>/.sdkman/candidates/micronaut/current/bin:/Users/<user>/.sdkman/candidates/maven/current/bin:/Users/<user>/.sdkman/candidates/leiningen/current/bin:/Users/<user>/.sdkman/candidates/kscript/current/bin:/Users/<user>/.sdkman/candidates/kotlin/current/bin:/Users/<user>/.sdkman/candidates/java/current/bin:./.venv/bin:/Users/<user>/bin:/Users/<user>/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:./node_modules/.bin:/Users/<user>/.rvm/bin:/Users/<user>/.go/bin:/Users/<user>/go/bin:/Users/<user>/.emacs.d/bin/
++ [[ -n /Users/<user>/.sdkman/candidates/springboot/current/bin:/Users/<user>/.sdkman/candidates/micronaut/current/bin:/Users/<user>/.sdkman/candidates/maven/current/bin:/Users/<user>/.sdkman/candidates/leiningen/current/bin:/Users/<user>/.sdkman/candidates/kscript/current/bin:/Users/<user>/.sdkman/candidates/kotlin/current/bin:/Users/<user>/.sdkman/candidates/java/current/bin:./.venv/bin:/Users/<user>/bin:/Users/<user>/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:./node_modules/.bin:/Users/<user>/.rvm/bin:/Users/<user>/.go/bin:/Users/<user>/go/bin:/Users/<user>/.emacs.d/bin/ ]]
++ echo true
+ present=true
+ [[ true == \t\r\u\e ]]
+ [[ /Users/<user>/.sdkman/candidates/springboot/current/bin:/Users/<user>/.sdkman/candidates/micronaut/current/bin:/Users/<user>/.sdkman/candidates/maven/current/bin:/Users/<user>/.sdkman/candidates/leiningen/current/bin:/Users/<user>/.sdkman/candidates/kscript/current/bin:/Users/<user>/.sdkman/candidates/kotlin/current/bin:/Users/<user>/.sdkman/candidates/java/current/bin:./.venv/bin:/Users/<user>/bin:/Users/<user>/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:./node_modules/.bin:/Users/<user>/.rvm/bin:/Users/<user>/.go/bin:/Users/<user>/go/bin:/Users/<user>/.emacs.d/bin/ =~ /Users/<user>/.sdkman/candidates/springboot/([^/]+)/bin ]]
+ [[ false == \t\r\u\e ]]
+ CURRENT=current
+ [[ current == \c\u\r\r\e\n\t ]]
++ readlink /Users/<user>/.sdkman/candidates/springboot/current
++ sed 's!/Users/<user>/.sdkman/candidates/springboot/!!g'
+ CURRENT=2.5.3
+ __sdkman_install_candidate_version springboot 2.5.5
+ local candidate version
+ candidate=springboot
+ version=2.5.5
+ __sdkman_download springboot 2.5.5
+ local candidate version archives_folder
+ candidate=springboot
+ version=2.5.5
+ archives_folder=/Users/<user>/.sdkman/archives
+ metadata_folder=/Users/<user>/.sdkman/var/metadata
+ mkdir -p /Users/<user>/.sdkman/var/metadata
+ '[' '!' -f /Users/<user>/.sdkman/archives/springboot-2.5.5.zip ']'
++ echo darwinx64
++ tr '[:upper:]' '[:lower:]'
+ local platform_parameter=darwinx64
+ local download_url=https://api.sdkman.io/2/broker/download/springboot/2.5.5/darwinx64
+ local base_name=springboot-2.5.5
+ local zip_archive_target=/Users/<user>/.sdkman/archives/springboot-2.5.5.zip
+ local headers=/Users/<user>/.sdkman/var/metadata/springboot-2.5.5.headers
+ local pre_installation_hook=/Users/<user>/.sdkman/tmp/hook_pre_springboot_2.5.5.sh
+ __sdkman_echo_debug 'Get pre-installation hook: https://api.sdkman.io/2/hooks/pre/springboot/2.5.5/darwinx64'
+ [[ false == \t\r\u\e ]]
+ __sdkman_secure_curl https://api.sdkman.io/2/hooks/pre/springboot/2.5.5/darwinx64
+ [[ false == \t\r\u\e ]]
+ curl --silent --location https://api.sdkman.io/2/hooks/pre/springboot/2.5.5/darwinx64
+ __sdkman_echo_debug 'Copy remote pre-installation hook: /Users/<user>/.sdkman/tmp/hook_pre_springboot_2.5.5.sh'
+ [[ false == \t\r\u\e ]]
+ source /Users/<user>/.sdkman/tmp/hook_pre_springboot_2.5.5.sh
+ __sdkman_pre_installation_hook
+ __sdkman_echo_debug 'No Mac OSX pre-install hook found for Springboot 2.5.5.'
+ [[ false == \t\r\u\e ]]
+ __sdkman_echo_debug 'Completed pre-installation hook...'
+ [[ false == \t\r\u\e ]]
+ export local binary_input=/Users/<user>/.sdkman/tmp/springboot-2.5.5.bin
+ binary_input=/Users/<user>/.sdkman/tmp/springboot-2.5.5.bin
+ export local zip_output=/Users/<user>/.sdkman/tmp/springboot-2.5.5.zip
+ zip_output=/Users/<user>/.sdkman/tmp/springboot-2.5.5.zip
+ echo ''

+ __sdkman_echo_no_colour 'Downloading: springboot 2.5.5'
+ echo 'Downloading: springboot 2.5.5'
Downloading: springboot 2.5.5
+ echo ''

+ __sdkman_echo_no_colour 'In progress...'
+ echo 'In progress...'
In progress...
+ echo ''

+ __sdkman_secure_curl_download https://api.sdkman.io/2/broker/download/springboot/2.5.5/darwinx64 --output /Users/<user>/.sdkman/tmp/springboot-2.5.5.bin --dump-header /Users/<user>/.sdkman/var/metadata/springboot-2.5.5.headers
+ local curl_params
+ curl_params=('--progress-bar' '--location')
+ [[ false == \t\r\u\e ]]
+ [[ true == \t\r\u\e ]]
+ curl_params+=('-C' '-')
+ [[ -n 60 ]]
+ curl_params+=('--retry-max-time' "${sdkman_curl_retry_max_time}")
+ [[ -n 0 ]]
+ curl_params+=('--retry' "${sdkman_curl_retry}")
+ [[ false == \t\r\u\e ]]
+ curl --progress-bar --location -C - --retry-max-time 60 --retry 0 https://api.sdkman.io/2/broker/download/springboot/2.5.5/darwinx64 --output /Users/<user>/.sdkman/tmp/springboot-2.5.5.bin --dump-header /Users/<user>/.sdkman/var/metadata/springboot-2.5.5.headers
#=#=#                                                                          
##O#- #                                                                        
##O=#  #                                                                       
#=#=-#  #                                                                      
-#O#- #   #                                                                    
-=#=#   #   #                                                                  
-=O#- #  #    #                                                                
-=O=#  #   #    #                                                              
-=O=-#  #    #    #                                                            
-=O=- #   #    #    #                                                          
-=O=-   #   #    #    #                                                        
+ __sdkman_echo_debug 'Downloaded binary to: /Users/<user>/.sdkman/tmp/springboot-2.5.5.bin (HTTP headers written to: /Users/<user>/.sdkman/var/metadata/springboot-2.5.5.headers)'
+ [[ false == \t\r\u\e ]]
+ local post_installation_hook=/Users/<user>/.sdkman/tmp/hook_post_springboot_2.5.5.sh
+ __sdkman_echo_debug 'Get post-installation hook: https://api.sdkman.io/2/hooks/post/springboot/2.5.5/darwinx64'
+ [[ false == \t\r\u\e ]]
+ __sdkman_secure_curl https://api.sdkman.io/2/hooks/post/springboot/2.5.5/darwinx64
+ [[ false == \t\r\u\e ]]
+ curl --silent --location https://api.sdkman.io/2/hooks/post/springboot/2.5.5/darwinx64
+ __sdkman_echo_debug 'Copy remote post-installation hook: /Users/<user>/.sdkman/tmp/hook_post_springboot_2.5.5.sh'
+ [[ false == \t\r\u\e ]]
+ source /Users/<user>/.sdkman/tmp/hook_post_springboot_2.5.5.sh
+ __sdkman_post_installation_hook
+ __sdkman_echo_debug 'No Mac OSX post-install hook found for Springboot 2.5.5.'
+ [[ false == \t\r\u\e ]]
+ __sdkman_echo_debug 'Moving /Users/<user>/.sdkman/tmp/springboot-2.5.5.bin to /Users/<user>/.sdkman/tmp/springboot-2.5.5.zip'
+ [[ false == \t\r\u\e ]]
+ mv -f /Users/<user>/.sdkman/tmp/springboot-2.5.5.bin /Users/<user>/.sdkman/tmp/springboot-2.5.5.zip
+ __sdkman_echo_debug 'Processed binary as: /Users/<user>/.sdkman/tmp/springboot-2.5.5.zip'
+ [[ false == \t\r\u\e ]]
+ __sdkman_echo_debug 'Completed post-installation hook...'
+ [[ false == \t\r\u\e ]]
+ mv -f /Users/<user>/.sdkman/tmp/springboot-2.5.5.zip /Users/<user>/.sdkman/archives/springboot-2.5.5.zip
+ __sdkman_echo_debug 'Moved to archive folder: /Users/<user>/.sdkman/archives/springboot-2.5.5.zip'
+ [[ false == \t\r\u\e ]]
+ __sdkman_validate_zip /Users/<user>/.sdkman/archives/springboot-2.5.5.zip
+ local zip_archive zip_ok
+ zip_archive=/Users/<user>/.sdkman/archives/springboot-2.5.5.zip
++ unzip -t /Users/<user>/.sdkman/archives/springboot-2.5.5.zip
++ grep 'No errors detected in compressed data'
+ zip_ok=
+ '[' -z '' ']'
+ rm -f /Users/<user>/.sdkman/archives/springboot-2.5.5.zip
+ echo ''

+ __sdkman_echo_red 'Stop! The archive was corrupt and has been removed! Please try installing again.'
+ __sdkman_echo 31m 'Stop! The archive was corrupt and has been removed! Please try installing again.'
+ [[ true == \f\a\l\s\e ]]
+ echo -e '\033[1;31mStop! The archive was corrupt and has been removed! Please try installing again.\033[0m'
Stop! The archive was corrupt and has been removed! Please try installing again.
+ return 1
+ return 1
+ return 1
+ return 1
+ final_rc=1
+ [[ install != \s\e\l\f\u\p\d\a\t\e ]]
+ [[ true == true ]]
+ __sdkman_auto_update 5.12.4 5.12.4
+ local remote_version version delay_upgrade
+ remote_version=5.12.4
+ version=5.12.4
+ delay_upgrade=/Users/<user>/.sdkman/var/delay_upgrade
++ find /Users/<user>/.sdkman/var/delay_upgrade -mtime +1
+ [[ -n /Users/<user>/.sdkman/var/delay_upgrade ]]
+ [[ 5.12.4 != \5\.\1\2\.\4 ]]
+ return 1
jamesdh commented 2 years ago

I'm seeing the same but with Groovy. Gradle, Java, Kotlin, Micronaut, and VIsualVM all installed fine. But after attempting multiple different versions of Groovy, no luck.

I'm on MacOS 12.0.1 on a new arm-based MacBook Pro. sdk flush archives does nothing.

$ sdk install groovy

Downloading: groovy 3.0.9

In progress...

-#O=#    #      #                                                                                                                                                           

  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of /Users/jamesdh/.sdkman/archives/groovy-3.0.9.zip or
        /Users/jamesdh/.sdkman/archives/groovy-3.0.9.zip.zip, and cannot find /Users/jamesdh/.sdkman/archives/groovy-3.0.9.zip.ZIP, period.

Stop! The archive was corrupt and has been removed! Please try installing again.
jamesdh commented 2 years ago
$ sdk install groovy
Validate groovy 3.0.9 for darwinx64: valid
Validation URL: https://api.sdkman.io/2/candidates/validate/groovy/3.0.9/darwinx64
Get pre-installation hook: https://api.sdkman.io/2/hooks/pre/groovy/3.0.9/darwinx64
Copy remote pre-installation hook: /Users/jamesdh/.sdkman/tmp/hook_pre_groovy_3.0.9.sh
No Mac OSX pre-install hook found for Groovy 3.0.9.
Completed pre-installation hook...

Downloading: groovy 3.0.9

In progress...

*   Trying 45.55.42.78:443...
* Connected to api.sdkman.io (45.55.42.78) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*  CAfile: /etc/ssl/cert.pem
*  CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
} [227 bytes data]
* TLSv1.2 (IN), TLS handshake, Server hello (2):
{ [108 bytes data]
* TLSv1.2 (IN), TLS handshake, Certificate (11):
{ [5651 bytes data]
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
{ [300 bytes data]
* TLSv1.2 (IN), TLS handshake, Server finished (14):
{ [4 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
} [37 bytes data]
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
} [1 bytes data]
* TLSv1.2 (OUT), TLS handshake, Finished (20):
} [16 bytes data]
* TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
{ [1 bytes data]
* TLSv1.2 (IN), TLS handshake, Finished (20):
{ [16 bytes data]
* SSL connection using TLSv1.2 / ECDHE-RSA-CHACHA20-POLY1305
* ALPN, server accepted to use http/1.1
* Server certificate:
*  subject: CN=*.sdkman.io
*  start date: May 30 00:00:00 2020 GMT
*  expire date: Apr 28 23:59:59 2022 GMT
*  subjectAltName: host "api.sdkman.io" matched cert's "*.sdkman.io"
*  issuer: C=GB; ST=Greater Manchester; L=Salford; O=Sectigo Limited; CN=Sectigo RSA Domain Validation Secure Server CA
*  SSL certificate verify ok.
> GET /2/broker/download/groovy/3.0.9/darwinx64 HTTP/1.1                                                                                                                    
> Host: api.sdkman.io
> User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 302 Found
< Server: nginx/1.19.1
< Date: Fri, 05 Nov 2021 04:35:23 GMT
< Content-Length: 0
< Connection: keep-alive
< location: https://groovy.jfrog.io/artifactory/dist-release-local/groovy-zips/apache-groovy-sdk-3.0.9.zip
< 
* Connection #0 to host api.sdkman.io left intact
* Issue another request to this URL: 'https://groovy.jfrog.io/artifactory/dist-release-local/groovy-zips/apache-groovy-sdk-3.0.9.zip'
*   Trying 35.224.162.219:443...
* Connected to groovy.jfrog.io (35.224.162.219) port 443 (#1)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*  CAfile: /etc/ssl/cert.pem
*  CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
} [229 bytes data]
* TLSv1.2 (IN), TLS handshake, Server hello (2):
{ [108 bytes data]
* TLSv1.2 (IN), TLS handshake, Certificate (11):
{ [3706 bytes data]
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
{ [300 bytes data]
* TLSv1.2 (IN), TLS handshake, Server finished (14):
{ [4 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
} [37 bytes data]
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
} [1 bytes data]
* TLSv1.2 (OUT), TLS handshake, Finished (20):
} [16 bytes data]
* TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):                                                                                                                  
{ [1 bytes data]
* TLSv1.2 (IN), TLS handshake, Finished (20):
{ [16 bytes data]
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use http/1.1
* Server certificate:
*  subject: CN=*.jfrog.io
*  start date: Feb  4 00:00:00 2020 GMT
*  expire date: Feb 18 12:00:00 2022 GMT
*  subjectAltName: host "groovy.jfrog.io" matched cert's "*.jfrog.io"
*  issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=GeoTrust RSA CA 2018
*  SSL certificate verify ok.
> GET /artifactory/dist-release-local/groovy-zips/apache-groovy-sdk-3.0.9.zip HTTP/1.1
> Host: groovy.jfrog.io
> User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
> Accept: */*
> Referer: https://api.sdkman.io/2/broker/download/groovy/3.0.9/darwinx64
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 302 Found
< Date: Fri, 05 Nov 2021 04:35:23 GMT
< Content-Length: 0
< Connection: keep-alive
< Location: https://groovy.jfrog.io/ui/native/dist-release-local/groovy-zips/apache-groovy-sdk-3.0.9.zip
< Strict-Transport-Security: max-age=15724800; includeSubDomains
< X-Request-ID: fe8f80c444b4b63b67bb182aa9aa043b
< 
* Connection #1 to host groovy.jfrog.io left intact
* Issue another request to this URL: 'https://groovy.jfrog.io/ui/native/dist-release-local/groovy-zips/apache-groovy-sdk-3.0.9.zip'
* Found bundle for host groovy.jfrog.io: 0x600003234090 [serially]
* Can not multiplex, even if we wanted to!
* Re-using existing connection! (#1) with host groovy.jfrog.io
* Connected to groovy.jfrog.io (35.224.162.219) port 443 (#1)
> GET /ui/native/dist-release-local/groovy-zips/apache-groovy-sdk-3.0.9.zip HTTP/1.1
> Host: groovy.jfrog.io
> User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
> Accept: */*
> Referer: https://groovy.jfrog.io/artifactory/dist-release-local/groovy-zips/apache-groovy-sdk-3.0.9.zip
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Date: Fri, 05 Nov 2021 04:35:23 GMT
< Content-Type: text/html; charset=UTF-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< Accept-Ranges: bytes
< Cache-Control: no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0
< Etag: W/"3832-17ae92c9920"
< Expires: 0
< Feature-Policy: geolocation 'none';microphone 'none';camera 'none';payment 'none'
< Last-Modified: Tue, 27 Jul 2021 18:14:12 GMT
< Pragma: no-cache
< Referrer-Policy: no-referrer
< Surrogate-Control: no-store
< Vary: Accept-Encoding
< X-Content-Security-Policy: script-src 'self' cdn.heapanalytics.com www.google-analytics.com 'nonce-1yewb4nptf' 'unsafe-eval'; font-src 'self' data: https://heapanalytics.com; base-uri 'self'; style-src 'self' 'unsafe-inline' https://heapanalytics.com; form-action 'self'; frame-ancestors 'self'
< X-Content-Type-Options: nosniff
< X-Frame-Options: SAMEORIGIN
< X-Xss-Protection: 1; mode=block
< Strict-Transport-Security: max-age=15724800; includeSubDomains
< X-Request-ID: 9ad1de24094f3e715e1592a860999aba
< 
{ [377 bytes data]
* Connection #1 to host groovy.jfrog.io left intact                                                                                                                         

Downloaded binary to: /Users/jamesdh/.sdkman/tmp/groovy-3.0.9.bin (HTTP headers written to: /Users/jamesdh/.sdkman/var/metadata/groovy-3.0.9.headers)
Get post-installation hook: https://api.sdkman.io/2/hooks/post/groovy/3.0.9/darwinx64
Copy remote post-installation hook: /Users/jamesdh/.sdkman/tmp/hook_post_groovy_3.0.9.sh
No Mac OSX post-install hook found for Groovy 3.0.9.
Moving /Users/jamesdh/.sdkman/tmp/groovy-3.0.9.bin to /Users/jamesdh/.sdkman/tmp/groovy-3.0.9.zip
Processed binary as: /Users/jamesdh/.sdkman/tmp/groovy-3.0.9.zip
Completed post-installation hook...
Moved to archive folder: /Users/jamesdh/.sdkman/archives/groovy-3.0.9.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of /Users/jamesdh/.sdkman/archives/groovy-3.0.9.zip or
        /Users/jamesdh/.sdkman/archives/groovy-3.0.9.zip.zip, and cannot find /Users/jamesdh/.sdkman/archives/groovy-3.0.9.zip.ZIP, period.

Stop! The archive was corrupt and has been removed! Please try installing again.
jamesdh commented 2 years ago

It appears the downloader may be getting JFrog's index page + redirects mixed up with the actual binary somehow?

jamesdh commented 2 years ago

@marc0der is there a way to prevent sdkman from removing the corrupt archive? I'd like to take a closer look at it.

jamesdh commented 2 years ago

FWIW, I'm also seeing the same issue with springboot.

marc0der commented 2 years ago

Hi @jamesdh,

I suspect that you have some proxy issues. I tried installing both Groovy and Spring Boot on a clean docker container and experienced no problems. I also tried using curl to download the binary directly, which works fine for me.

curl -O https://groovy.jfrog.io/artifactory/dist-release-local/groovy-zips/apache-groovy-sdk-3.0.9.zip

Please feel free to chat with us on Slack if you have any further issues.

jamesdh commented 2 years ago

I was experiencing this issue because my .curlrc file defined a user-agent. That, in turn, broke curl (v7.77) somehow when making a request against jfrog's servers.

martinreck commented 2 years ago

I was experiencing this issue because my .curlrc file defined a user-agent. That, in turn, broke curl (v7.77) somehow when making a request against jfrog's servers.

I set the user agent for curl in the ~/.curlrc file. Curl impersonated as a browser. Now when you send a request to the JFrog server, it delivers an intermediate page before the download starts. This JFrog page needs JavaScript to be executed to start the download. If you disable JavaScript in the browser, you have the same behavior as SDKMAN.

In the curl (v7.81.0) help I found a switch to ignore a .curlrc file. This could be a possibility to avoid this kind of errors.

curl --help all
...
 -q, --disable            Disable .curlrc
...
npalladium commented 2 years ago

Getting rid of the user-agent from .curlrc fixed it for me. Thanks a bunch @martinreck!

marc0der commented 2 years ago

Glad to hear that this is resolved. Closing this issue for now.

jamesdh commented 2 years ago

@marc0der I'm not sure I'd consider this resolved. I think @martinreck's suggestion about ignoring the .curlrc from the sdkman scripts is a great idea. Otherwise you're going to see this issue reappear in the future from another user experiencing it, especially given how vague and unrelated the error messages are.

marc0der commented 2 years ago

@jamesdh I don't think that ignoring the curlrc is a viable option. Curl is a standalone system binary that is not provided or managed by SDKMAN. Many people rely on this file to configure proxies etc, so it would cause many problems if we ignored it.

One thing we could perhaps consider is to have a copy of the curlrc in our etc folder that takes precedence over the one in the home directory. I'd consider this as a new feature request.

For now, I'd say this bug report is resolved as I don't see it as a bug but rather as a user configuration issue.