Quellcode durchsuchen

Fix missing version number while building step-ca

The .version.sh file fails at line 4 with the following error:
./.version.sh: 4: Bad substitution ' out of the ' make build GOFLAGS=""

The above error results in 'step-ca --version' not including the version number after the build:
Smallstep CA/ (linux/arm64)
Release Date: 2026-01-02 16:32 UTC

Modern *nix-like operating systems symlink the sh shell to bash/dash/sh.
Because of this, the output of .version.sh is not consistent across different operating systems.
The goal of this change is to make the code POSIX-neutral so that it executes correctly in bash/dash/sh shells.
Tested on Ubuntu 24.04 (amd64), Debian 13 (arm64), and MacOS 15.7.1 (arm).

Fixes #2013
Gerard Samuel vor 11 Monaten
Ursprung
Commit
2a2238476f
1 geänderte Dateien mit 5 neuen und 3 gelöschten Zeilen
  1. 5 3
      .version.sh

+ 5 - 3
.version.sh

@@ -1,7 +1,9 @@
 #!/usr/bin/env sh
 read -r firstline < .VERSION
 last_half="${firstline##*tag: }"
-if [[ ${last_half::1} == "v" ]]; then
-    version_string="${last_half%%[,)]*}"
-fi
+case "$last_half" in
+    v*)
+        version_string="${last_half%%[,)]*}"
+        ;;
+esac
 echo "${version_string:-v0.0.0}"