Skip to contentSkip to conversation

kbuild: deb-pkg: use default string when variable is unset or null

PATCH In review Masahiro Yamada 2 participants 2 messages Jul 4, 2024 – Jul 5, 2024 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kbuild: deb-pkg: use default string when variable is unset or null

${DEBFULLNAME-${user}} falls back to ${user} when DEBFULLNAME is unset. It is more reasonable to do so when DEBFULLNAME is unset or null.

Otherwise, the command:

  $ DEBFULLNAME= make deb-pkg

will leave the name field blank.

The same applies to KBUILD_BUILD_USER and KBUILD_BUILD_HOST.

---

 scripts/package/mkdebian | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/package/mkdebian +3 -3
index 0cc1913aad30..196b14e8ad47 100755
@@ -125,12 +125,12 @@ gen_source ()
 rm -rf debian
 mkdir debian
 
-user=${KBUILD_BUILD_USER-$(id -nu)}
-name=${DEBFULLNAME-${user}}
+user=${KBUILD_BUILD_USER:-$(id -nu)}
+name=${DEBFULLNAME:-${user}}
 if [ "${DEBEMAIL:+set}" ]; then
 	email=${DEBEMAIL}
 else
-	buildhost=${KBUILD_BUILD_HOST-$(hostname -f 2>/dev/null || hostname)}
+	buildhost=${KBUILD_BUILD_HOST:-$(hostname -f 2>/dev/null || hostname)}
 	email="${user}@${buildhost}"
 fi
 maintainer="${name} <${email}>"
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Masahiro Yamada

${DEBFULLNAME-${user}} falls back to ${user} when DEBFULLNAME is unset. It is more reasonable to do so when DEBFULLNAME is unset or null.

Otherwise, the command:

Quoted 7 lines
  $ DEBFULLNAME= make deb-pkg

will leave the name field blank.

The same applies to KBUILD_BUILD_USER and KBUILD_BUILD_HOST.

Yeah, it definitely does not really make sense to let someone do that, although I am not really sure why anyone would...

Quoted 28 lines

---

 scripts/package/mkdebian | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/package/mkdebian +3 -3
index 0cc1913aad30..196b14e8ad47 100755
@@ -125,12 +125,12 @@ gen_source ()
 rm -rf debian
 mkdir debian
 
-user=${KBUILD_BUILD_USER-$(id -nu)}
-name=${DEBFULLNAME-${user}}
+user=${KBUILD_BUILD_USER:-$(id -nu)}
+name=${DEBFULLNAME:-${user}}
 if [ "${DEBEMAIL:+set}" ]; then
 	email=${DEBEMAIL}
 else
-	buildhost=${KBUILD_BUILD_HOST-$(hostname -f 2>/dev/null || hostname)}
+	buildhost=${KBUILD_BUILD_HOST:-$(hostname -f 2>/dev/null || hostname)}
 	email="${user}@${buildhost}"
 fi
 maintainer="${name} <${email}>"
Signature · 1 line
2.43.0