diff options
author | Leah Rowe <leah@libreboot.org> | 2025-04-29 11:48:39 +0100 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2025-04-29 11:53:32 +0100 |
commit | 3045079947be1f88c76badcfa0df99e96097fb44 (patch) | |
tree | 27992b82e1c041ffad1ca9e0ff8da6ec7e3ccec1 | |
parent | da108d1c045582af0b81ca05c758125071155f03 (diff) |
init.sh: use backslash for dotfiles in eval
see:
commit f0c629dcc6c3f2242a735567cdd6855fa108d1a5
Author: Leah Rowe <leah@libreboot.org>
Date: Sat Apr 12 13:51:49 2025 +0100
lib.sh: write version/versiondate to dotfiles
and this bug report:
https://codeberg.org/libreboot/lbmk/issues/284
The report indicates that the above commit broke bash,
when sh (on the user's system) is bash.
I know sometimes when using bash, I need to use the
back slash when dealing with dots, e.g. when grepping
something.
Also double quote references to dotfiles, e.g. when
directing the output of printf.
I never noticed the issue myself, since I use dash.
Signed-off-by: Leah Rowe <leah@libreboot.org>
-rw-r--r-- | include/init.sh | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/include/init.sh b/include/init.sh index a88bd13f..b515cebc 100644 --- a/include/init.sh +++ b/include/init.sh @@ -162,10 +162,10 @@ xbmk_set_env() xbmk_set_version() { for fv in version versiondate; do - eval "[ ! -f \".$fv\" ] || read -r $fv < \".$fv\" || :" + eval "[ ! -f \"\.$fv\" ] || read -r $fv < \"\.$fv\" || :" done - [ -e ".git" ] || [ -f ".version" ] || printf "unknown\n" > .version \ + [ -e ".git" ] || [ -f ".version" ] || printf "unknown\n" > ".version" \ || $err "Cannot generate unknown .version file" [ -e ".git" ] || [ -f ".versiondate" ] || printf "1716415872\n" > \ .versiondate || $err "Cannot generate unknown .versiondate file"; : @@ -178,8 +178,8 @@ xbmk_set_version() --pretty='%ct' HEAD)" || versiondate="$versiondate_" chkvars version versiondate - printf "%s\n" "$version" > .version || $err "can't save version" - printf "%s\n" "$versiondate" > .versiondate || $err "can't save date" + printf "%s\n" "$version" > ".version" || $err "can't save version" + printf "%s\n" "$versiondate" > ".versiondate" || $err "can't save date" relname="$projectname-$version" export LOCALVERSION="-$projectname-${version%%-*}" |