From 0490f70d43790ac0d2160b63f9bd5c98b95ba83e Mon Sep 17 00:00:00 2001 From: Tristan Everitt Date: Thu, 19 Dec 2024 10:54:04 +0000 Subject: [PATCH 1/2] Added defensive quoting to XDG_SESSION_TYPE #4252 --- assemblies/static/src/main/resources/hop-gui.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assemblies/static/src/main/resources/hop-gui.sh b/assemblies/static/src/main/resources/hop-gui.sh index c8f1ae8ba1..da509a0928 100755 --- a/assemblies/static/src/main/resources/hop-gui.sh +++ b/assemblies/static/src/main/resources/hop-gui.sh @@ -74,7 +74,7 @@ Linux) # Workaround for https://github.com/apache/hop/issues/4252 # Related to https://github.com/eclipse-platform/eclipse.platform.swt/issues/639 # And to some extent also https://github.com/eclipse-platform/eclipse.platform.swt/issues/790 - if [[ $XDG_SESSION_TYPE == "wayland" ]]; then + if [[ "${XDG_SESSION_TYPE}" == "wayland" ]]; then export GDK_BACKEND=x11 fi if "${_HOP_JAVA}" -XshowSettings:properties -version 2>&1 | grep -q "os.arch = aarch64"; then From e2acd14c3edb835e403fd44e27ff7d91a139f961 Mon Sep 17 00:00:00 2001 From: Hans Van Akelyen Date: Tue, 24 Dec 2024 14:07:43 +0100 Subject: [PATCH 2/2] Switched to single brackets to keep consistent, added to all scripts to be safe --- .../static/src/main/resources/hop-conf.sh | 20 +++++++++----- .../static/src/main/resources/hop-encrypt.sh | 20 +++++++++----- .../static/src/main/resources/hop-gui.sh | 26 +++++++++---------- .../static/src/main/resources/hop-import.sh | 20 +++++++++----- .../static/src/main/resources/hop-run.sh | 20 +++++++++----- .../static/src/main/resources/hop-search.sh | 20 +++++++++----- .../static/src/main/resources/hop-server.sh | 20 +++++++++----- 7 files changed, 91 insertions(+), 55 deletions(-) diff --git a/assemblies/static/src/main/resources/hop-conf.sh b/assemblies/static/src/main/resources/hop-conf.sh index b600d663d1..1ef1c4e7d1 100755 --- a/assemblies/static/src/main/resources/hop-conf.sh +++ b/assemblies/static/src/main/resources/hop-conf.sh @@ -69,17 +69,23 @@ HOP_OPTIONS="${HOP_OPTIONS} --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED -- case $(uname -s) in Linux) - if "${_HOP_JAVA}" -XshowSettings:properties -version 2>&1 | grep -q "os.arch = aarch64"; then - CLASSPATH="lib/core/*:lib/beam/*:lib/swt/linux/arm64/*" - else - CLASSPATH="lib/core/*:lib/beam/*:lib/swt/linux/$(uname -m)/*" - fi + # Workaround for https://github.com/apache/hop/issues/4252 + # Related to https://github.com/eclipse-platform/eclipse.platform.swt/issues/639 + # And to some extent also https://github.com/eclipse-platform/eclipse.platform.swt/issues/790 + if [ "${XDG_SESSION_TYPE}" == "wayland" ]; then + export GDK_BACKEND=x11 + fi + if "${_HOP_JAVA}" -XshowSettings:properties -version 2>&1 | grep -q "os.arch = aarch64"; then + CLASSPATH="lib/core/*:lib/beam/*:lib/swt/linux/arm64/*" + else + CLASSPATH="lib/core/*:lib/beam/*:lib/swt/linux/$(uname -m)/*" + fi ;; Darwin) if "${_HOP_JAVA}" -XshowSettings:properties -version 2>&1 | grep -q "os.arch = aarch64"; then - CLASSPATH="lib/core/*:lib/beam/*:lib/swt/osx/arm64/*" + CLASSPATH="lib/core/*:lib/beam/*:lib/swt/osx/arm64/*" else - CLASSPATH="lib/core/*:lib/beam/*:lib/swt/osx/x86_64/*" + CLASSPATH="lib/core/*:lib/beam/*:lib/swt/osx/x86_64/*" fi HOP_OPTIONS="${HOP_OPTIONS} -XstartOnFirstThread" ;; diff --git a/assemblies/static/src/main/resources/hop-encrypt.sh b/assemblies/static/src/main/resources/hop-encrypt.sh index dbfdbae250..481a4b2182 100755 --- a/assemblies/static/src/main/resources/hop-encrypt.sh +++ b/assemblies/static/src/main/resources/hop-encrypt.sh @@ -69,17 +69,23 @@ HOP_OPTIONS="${HOP_OPTIONS} --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED -- case $(uname -s) in Linux) - if "${_HOP_JAVA}" -XshowSettings:properties -version 2>&1 | grep -q "os.arch = aarch64"; then - CLASSPATH="lib/core/*:lib/beam/*:lib/swt/linux/arm64/*" - else - CLASSPATH="lib/core/*:lib/beam/*:lib/swt/linux/$(uname -m)/*" - fi + # Workaround for https://github.com/apache/hop/issues/4252 + # Related to https://github.com/eclipse-platform/eclipse.platform.swt/issues/639 + # And to some extent also https://github.com/eclipse-platform/eclipse.platform.swt/issues/790 + if [ "${XDG_SESSION_TYPE}" == "wayland" ]; then + export GDK_BACKEND=x11 + fi + if "${_HOP_JAVA}" -XshowSettings:properties -version 2>&1 | grep -q "os.arch = aarch64"; then + CLASSPATH="lib/core/*:lib/beam/*:lib/swt/linux/arm64/*" + else + CLASSPATH="lib/core/*:lib/beam/*:lib/swt/linux/$(uname -m)/*" + fi ;; Darwin) if "${_HOP_JAVA}" -XshowSettings:properties -version 2>&1 | grep -q "os.arch = aarch64"; then - CLASSPATH="lib/core/*:lib/beam/*:lib/swt/osx/arm64/*" + CLASSPATH="lib/core/*:lib/beam/*:lib/swt/osx/arm64/*" else - CLASSPATH="lib/core/*:lib/beam/*:lib/swt/osx/x86_64/*" + CLASSPATH="lib/core/*:lib/beam/*:lib/swt/osx/x86_64/*" fi HOP_OPTIONS="${HOP_OPTIONS} -XstartOnFirstThread" ;; diff --git a/assemblies/static/src/main/resources/hop-gui.sh b/assemblies/static/src/main/resources/hop-gui.sh index da509a0928..a66e582e38 100755 --- a/assemblies/static/src/main/resources/hop-gui.sh +++ b/assemblies/static/src/main/resources/hop-gui.sh @@ -71,23 +71,23 @@ HOP_OPTIONS="${HOP_OPTIONS} --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED -- case $(uname -s) in Linux) - # Workaround for https://github.com/apache/hop/issues/4252 - # Related to https://github.com/eclipse-platform/eclipse.platform.swt/issues/639 - # And to some extent also https://github.com/eclipse-platform/eclipse.platform.swt/issues/790 - if [[ "${XDG_SESSION_TYPE}" == "wayland" ]]; then - export GDK_BACKEND=x11 - fi - if "${_HOP_JAVA}" -XshowSettings:properties -version 2>&1 | grep -q "os.arch = aarch64"; then - CLASSPATH="lib/core/*:lib/beam/*:lib/swt/linux/arm64/*" - else - CLASSPATH="lib/core/*:lib/beam/*:lib/swt/linux/$(uname -m)/*" - fi + # Workaround for https://github.com/apache/hop/issues/4252 + # Related to https://github.com/eclipse-platform/eclipse.platform.swt/issues/639 + # And to some extent also https://github.com/eclipse-platform/eclipse.platform.swt/issues/790 + if [ "${XDG_SESSION_TYPE}" == "wayland" ]; then + export GDK_BACKEND=x11 + fi + if "${_HOP_JAVA}" -XshowSettings:properties -version 2>&1 | grep -q "os.arch = aarch64"; then + CLASSPATH="lib/core/*:lib/beam/*:lib/swt/linux/arm64/*" + else + CLASSPATH="lib/core/*:lib/beam/*:lib/swt/linux/$(uname -m)/*" + fi ;; Darwin) if "${_HOP_JAVA}" -XshowSettings:properties -version 2>&1 | grep -q "os.arch = aarch64"; then - CLASSPATH="lib/core/*:lib/beam/*:lib/swt/osx/arm64/*" + CLASSPATH="lib/core/*:lib/beam/*:lib/swt/osx/arm64/*" else - CLASSPATH="lib/core/*:lib/beam/*:lib/swt/osx/x86_64/*" + CLASSPATH="lib/core/*:lib/beam/*:lib/swt/osx/x86_64/*" fi HOP_OPTIONS="${HOP_OPTIONS} -XstartOnFirstThread" ;; diff --git a/assemblies/static/src/main/resources/hop-import.sh b/assemblies/static/src/main/resources/hop-import.sh index af66303079..cf156475ec 100755 --- a/assemblies/static/src/main/resources/hop-import.sh +++ b/assemblies/static/src/main/resources/hop-import.sh @@ -69,17 +69,23 @@ HOP_OPTIONS="${HOP_OPTIONS} --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED -- case $(uname -s) in Linux) - if "${_HOP_JAVA}" -XshowSettings:properties -version 2>&1 | grep -q "os.arch = aarch64"; then - CLASSPATH="lib/core/*:lib/beam/*:lib/swt/linux/arm64/*" - else - CLASSPATH="lib/core/*:lib/beam/*:lib/swt/linux/$(uname -m)/*" - fi + # Workaround for https://github.com/apache/hop/issues/4252 + # Related to https://github.com/eclipse-platform/eclipse.platform.swt/issues/639 + # And to some extent also https://github.com/eclipse-platform/eclipse.platform.swt/issues/790 + if [ "${XDG_SESSION_TYPE}" == "wayland" ]; then + export GDK_BACKEND=x11 + fi + if "${_HOP_JAVA}" -XshowSettings:properties -version 2>&1 | grep -q "os.arch = aarch64"; then + CLASSPATH="lib/core/*:lib/beam/*:lib/swt/linux/arm64/*" + else + CLASSPATH="lib/core/*:lib/beam/*:lib/swt/linux/$(uname -m)/*" + fi ;; Darwin) if "${_HOP_JAVA}" -XshowSettings:properties -version 2>&1 | grep -q "os.arch = aarch64"; then - CLASSPATH="lib/core/*:lib/beam/*:lib/swt/osx/arm64/*" + CLASSPATH="lib/core/*:lib/beam/*:lib/swt/osx/arm64/*" else - CLASSPATH="lib/core/*:lib/beam/*:lib/swt/osx/x86_64/*" + CLASSPATH="lib/core/*:lib/beam/*:lib/swt/osx/x86_64/*" fi HOP_OPTIONS="${HOP_OPTIONS} -XstartOnFirstThread" ;; diff --git a/assemblies/static/src/main/resources/hop-run.sh b/assemblies/static/src/main/resources/hop-run.sh index e69d4a688e..6c6284193b 100755 --- a/assemblies/static/src/main/resources/hop-run.sh +++ b/assemblies/static/src/main/resources/hop-run.sh @@ -69,17 +69,23 @@ HOP_OPTIONS="${HOP_OPTIONS} --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED -- case $(uname -s) in Linux) - if "${_HOP_JAVA}" -XshowSettings:properties -version 2>&1 | grep -q "os.arch = aarch64"; then - CLASSPATH="lib/core/*:lib/beam/*:lib/swt/linux/arm64/*" - else - CLASSPATH="lib/core/*:lib/beam/*:lib/swt/linux/$(uname -m)/*" - fi + # Workaround for https://github.com/apache/hop/issues/4252 + # Related to https://github.com/eclipse-platform/eclipse.platform.swt/issues/639 + # And to some extent also https://github.com/eclipse-platform/eclipse.platform.swt/issues/790 + if [ "${XDG_SESSION_TYPE}" == "wayland" ]; then + export GDK_BACKEND=x11 + fi + if "${_HOP_JAVA}" -XshowSettings:properties -version 2>&1 | grep -q "os.arch = aarch64"; then + CLASSPATH="lib/core/*:lib/beam/*:lib/swt/linux/arm64/*" + else + CLASSPATH="lib/core/*:lib/beam/*:lib/swt/linux/$(uname -m)/*" + fi ;; Darwin) if "${_HOP_JAVA}" -XshowSettings:properties -version 2>&1 | grep -q "os.arch = aarch64"; then - CLASSPATH="lib/core/*:lib/beam/*:lib/swt/osx/arm64/*" + CLASSPATH="lib/core/*:lib/beam/*:lib/swt/osx/arm64/*" else - CLASSPATH="lib/core/*:lib/beam/*:lib/swt/osx/x86_64/*" + CLASSPATH="lib/core/*:lib/beam/*:lib/swt/osx/x86_64/*" fi HOP_OPTIONS="${HOP_OPTIONS} -XstartOnFirstThread" ;; diff --git a/assemblies/static/src/main/resources/hop-search.sh b/assemblies/static/src/main/resources/hop-search.sh index 4b3539de8a..d0f905f215 100755 --- a/assemblies/static/src/main/resources/hop-search.sh +++ b/assemblies/static/src/main/resources/hop-search.sh @@ -69,17 +69,23 @@ HOP_OPTIONS="${HOP_OPTIONS} --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED -- case $(uname -s) in Linux) - if "${_HOP_JAVA}" -XshowSettings:properties -version 2>&1 | grep -q "os.arch = aarch64"; then - CLASSPATH="lib/core/*:lib/beam/*:lib/swt/linux/arm64/*" - else - CLASSPATH="lib/core/*:lib/beam/*:lib/swt/linux/$(uname -m)/*" - fi + # Workaround for https://github.com/apache/hop/issues/4252 + # Related to https://github.com/eclipse-platform/eclipse.platform.swt/issues/639 + # And to some extent also https://github.com/eclipse-platform/eclipse.platform.swt/issues/790 + if [ "${XDG_SESSION_TYPE}" == "wayland" ]; then + export GDK_BACKEND=x11 + fi + if "${_HOP_JAVA}" -XshowSettings:properties -version 2>&1 | grep -q "os.arch = aarch64"; then + CLASSPATH="lib/core/*:lib/beam/*:lib/swt/linux/arm64/*" + else + CLASSPATH="lib/core/*:lib/beam/*:lib/swt/linux/$(uname -m)/*" + fi ;; Darwin) if "${_HOP_JAVA}" -XshowSettings:properties -version 2>&1 | grep -q "os.arch = aarch64"; then - CLASSPATH="lib/core/*:lib/beam/*:lib/swt/osx/arm64/*" + CLASSPATH="lib/core/*:lib/beam/*:lib/swt/osx/arm64/*" else - CLASSPATH="lib/core/*:lib/beam/*:lib/swt/osx/x86_64/*" + CLASSPATH="lib/core/*:lib/beam/*:lib/swt/osx/x86_64/*" fi HOP_OPTIONS="${HOP_OPTIONS} -XstartOnFirstThread" ;; diff --git a/assemblies/static/src/main/resources/hop-server.sh b/assemblies/static/src/main/resources/hop-server.sh index 7adf281dd2..054a3ade3c 100755 --- a/assemblies/static/src/main/resources/hop-server.sh +++ b/assemblies/static/src/main/resources/hop-server.sh @@ -69,17 +69,23 @@ HOP_OPTIONS="${HOP_OPTIONS} --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED -- case $(uname -s) in Linux) - if "${_HOP_JAVA}" -XshowSettings:properties -version 2>&1 | grep -q "os.arch = aarch64"; then - CLASSPATH="lib/core/*:lib/beam/*:lib/swt/linux/arm64/*" - else - CLASSPATH="lib/core/*:lib/beam/*:lib/swt/linux/$(uname -m)/*" - fi + # Workaround for https://github.com/apache/hop/issues/4252 + # Related to https://github.com/eclipse-platform/eclipse.platform.swt/issues/639 + # And to some extent also https://github.com/eclipse-platform/eclipse.platform.swt/issues/790 + if [ "${XDG_SESSION_TYPE}" == "wayland" ]; then + export GDK_BACKEND=x11 + fi + if "${_HOP_JAVA}" -XshowSettings:properties -version 2>&1 | grep -q "os.arch = aarch64"; then + CLASSPATH="lib/core/*:lib/beam/*:lib/swt/linux/arm64/*" + else + CLASSPATH="lib/core/*:lib/beam/*:lib/swt/linux/$(uname -m)/*" + fi ;; Darwin) if "${_HOP_JAVA}" -XshowSettings:properties -version 2>&1 | grep -q "os.arch = aarch64"; then - CLASSPATH="lib/core/*:lib/beam/*:lib/swt/osx/arm64/*" + CLASSPATH="lib/core/*:lib/beam/*:lib/swt/osx/arm64/*" else - CLASSPATH="lib/core/*:lib/beam/*:lib/swt/osx/x86_64/*" + CLASSPATH="lib/core/*:lib/beam/*:lib/swt/osx/x86_64/*" fi HOP_OPTIONS="${HOP_OPTIONS} -XstartOnFirstThread" ;;