[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#992457: Broken by irresponsible removal of tempfile in debianutils



Control: retitle -1 FTBFS: uses tempfile in build, appears to use deprecated which(1)

A closer look indicates that tempfile is only actually used to build the package. The apparent use of which(1) is actually a shell function, however…

On Wed, Aug 18, 2021, at 16:18, Cyril Brulebois wrote:
> > Presumably /installer-team/console-setup would be a better package to
> > patch, unless cdebconf uses tempfile somehow. 😉 I'll see what I can
> > do this evening. 🙂
> 
> Sure thing, miscompleted in my browser history plus slightly distracted,
> sorry.

As suggested before, I'm fluent in IRC, so I read what you meant. 😁 

MY goof was breaking my initramfs, being _completely_ unable to read the tiny font, reverting to backup, futzing with it, seeing tempfile and which being called in setupcon, and having to go to work before I could dig much deeper.

As noted, tempfile is only actually used to build the package. Fixed that. Left the function in setupcon alone.

The apparent use of which all over the place is also a shell function, but the shell function just emulates command -v, so I subbed that out and removed the functions while I was at it. Tested the result on amd64 with amdgpu added to initramfs for early KMS so that I can take advantage of Plymouth for status messages I have some chance of being able to use, and a crypttab prompt that doesn't get lost in the impossibly small console text.

I realized while composing the email that my patch has some trailing whitespace removal—nvim is configured to do that to source files as it's usually desirable for git sanity, but I should've trimmed those hunks out of the patch and retested. I don't have time to do that tonight because I can't conveniently just reboot right now, so I'll send you the patch as tested. Feel free to omit purely whitespace change hunks.

You can maybe guess the major thrust of my attempts to fiddle with console-setup around the time this all happened: You don't even try to set the font in the initramfs anymore, and I've never actually figured out why Ubuntu's combination of console-setup and plymouth manages to just work and Debian's just doesn't—I've spent a little time prodding at packages from both.

I mostly know my way around a Debian system I think—when I reinstalled this machine about two weeks ago, I found that neither old nor new installer was really set up to preserve my LUKS devices with LVM on them, keep some partitions and format others, etc … so I just grabbed a live USB and installed the system with debootstrap. It … was faster than trying ti figure out if or how Calamares could do that, and I know the shell of the old debian installer didn't provide shell UI I'd need to open the LUKS partitions so the partitioner could use them without obliterating anything "helpfully" for me. *shrug*

I've gotten way off topic now, but I think I just need to write a hook to throw in setfont and the font to set along with some quick and dirty initramfs scripts to make sure it dances around plymouth. I had to do something similar with a MBP to work around proprietary Apple crap.

Anyway, hope this is useful. Salsa didn't exist when last I might've had an account on it to be able to actually finish this up as a PR. I've considered changing that a time or two. Perhaps when the Covidium passes.

Joseph

diff -Nru console-setup.orig/debian/console-setup.config console-setup/debian/console-setup.config
--- console-setup.orig/debian/console-setup.config	2021-08-18 22:17:59.892444554 -0700
+++ console-setup/debian/console-setup.config	2021-08-18 22:42:21.524213193 -0700
@@ -64,7 +64,7 @@
 # fontsets='Arabic-Fixed15
 # Arabic-Fixed16
 # Arabic-VGA14
-# ... 
+# ...
 # Vietnamese-Fixed18
 # '
 
@@ -104,18 +104,6 @@
 
 db_capb backup
 
-which () {
-    local IFS
-    IFS=:
-    for i in $PATH; do
-	if [ -f "$i/$1" -a -x "$i/$1" ]; then
-	    echo "$i/$1"
-	    return 0
-	fi
-    done
-    return 1
-}
-
 available_fontfaces () {
     local prefix
     case "$CODESET" in
@@ -195,14 +183,14 @@
 }
 
 kernel=unknown
-if which uname >/dev/null; then
+if command -v uname >/dev/null; then
     case "`uname`" in
         *Linux*) kernel=linux ;;
         *FreeBSD*) kernel=freebsd ;;
     esac
 fi
 
-if which locale 2>/dev/null >/dev/null; then
+if command -v locale 2>/dev/null >/dev/null; then
     eval `locale`
 fi
 
@@ -217,7 +205,7 @@
 if [ "$locale" = C ]; then
     CHARMAP=ISO-8859-15
     charmap_priority=high
-elif which locale 2>/dev/null >/dev/null; then
+elif command -v locale 2>/dev/null >/dev/null; then
     CHARMAP=`locale charmap`
 else
     CHARMAP=unknown
diff -Nru console-setup.orig/debian/console-setup-udeb.postinst console-setup/debian/console-setup-udeb.postinst
--- console-setup.orig/debian/console-setup-udeb.postinst	2021-08-18 22:17:59.892444554 -0700
+++ console-setup/debian/console-setup-udeb.postinst	2021-08-18 22:43:48.226081884 -0700
@@ -5,20 +5,6 @@
 # Source debconf library.
 . /usr/share/debconf/confmodule
 
-# The same as /usr/bin/which - in order to make "which" available before
-# /usr is mounted
-which () {
-    local IFS
-    IFS=:
-    for i in $PATH; do
-	if [ -x "$i/$1" ]; then
-	    echo "$i/$1"
-	    return 0
-	fi
-    done
-    return 1
-}
-
 # In d-i the config script is not executed automatically
 if [ -f /usr/share/console-setup/keyboard-configuration.config ]; then
     /usr/share/console-setup/keyboard-configuration.config || exit $?
@@ -37,7 +23,7 @@
 CONFIGFILE=/etc/default/keyboard
 
 if [ "$1" = "configure" -a ! -L "$CONFIGFILE" ]; then
-    
+
     db_get keyboard-configuration/modelcode
     model="$RET"
 
@@ -64,8 +50,8 @@
         if ! grep "^ *${var}=" $CONFIGFILE >/dev/null; then
 	    echo "${var}=" >>$CONFIGFILE
 	fi
-    done    
-    
+    done
+
     sed \
 	-e "s|^ *XKBMODEL=.*|XKBMODEL=\"$model\"|" \
 	-e "s|^ *XKBLAYOUT=.*|XKBLAYOUT=\"$layout\"|" \
@@ -73,7 +59,7 @@
 	-e "s|^ *XKBOPTIONS=.*|XKBOPTIONS=\"$options\"|" \
 	-e "s|^ *BACKSPACE=.*|BACKSPACE=\"${BACKSPACE:-guess}\"|" \
 	<$CONFIGFILE >$CONFIGFILE.tmp
-    
+
     mv -f $CONFIGFILE.tmp $CONFIGFILE
 
     db_set keyboard-configuration/store_defaults_in_debconf_db true
@@ -82,7 +68,7 @@
 if \
     [ -d /lib/debian-installer.d ] && keyboard_present
 then
-    if [ "$DISPLAY" ] && which setxkbmap >/dev/null; then
+    if [ "$DISPLAY" ] && command -v setxkbmap >/dev/null; then
 	setxkbmap -option '' -model "$model" "$layout" "$variant" "$options"
     else
 	case "`uname`" in
diff -Nru console-setup.orig/debian/keyboard-configuration.config console-setup/debian/keyboard-configuration.config
--- console-setup.orig/debian/keyboard-configuration.config	2021-08-18 22:17:59.892444554 -0700
+++ console-setup/debian/keyboard-configuration.config	2021-08-18 22:43:19.410790210 -0700
@@ -91,18 +91,6 @@
 #    regex_pattern_escape and regex_unescape.
 ######################################################################
 
-which () {
-    local IFS
-    IFS=:
-    for i in $PATH; do
-	if [ -f "$i/$1" -a -x "$i/$1" ]; then
-	    echo "$i/$1"
-	    return 0
-	fi
-    done
-    return 1
-}
-
 # Store default value into debconf db.  Workaround #352697.
 db_default () {
     db_get keyboard-configuration/store_defaults_in_debconf_db
@@ -160,7 +148,7 @@
 ## KBDNAMES ## Will be replaced by all_kbdnames function:
 
 # all_kbdnames () {
-#  cat <<'EOF' 
+#  cat <<'EOF'
 # C*model*logidinovo*Logitech diNovo Keyboard
 # C*model*amiga*Amiga
 # ...
@@ -200,9 +188,9 @@
     add="
 $add"
 
-    choices1=`echo "$kbdnames" | grep "^$prefix\*" | 
+    choices1=`echo "$kbdnames" | grep "^$prefix\*" |
         sed -e "s/^$prefix\*[^\*]*\*//" -e 's/,/\\\\,/g' | sort`
-    choices2=`echo "$add" | grep "^$prefix\*" | 
+    choices2=`echo "$add" | grep "^$prefix\*" |
         sed -e "s/^$prefix\*[^\*]*\*//" -e 's/,/\\\\,/g'`
     choices=`echo "$choices1
 $choices2" | sed -e 's/$/,/'`
@@ -212,13 +200,13 @@
 
     if echo "$choices" | grep '[^\\\\],' >/dev/null; then
 	db_subst $template CHOICES "$choices"
-	default_description=`echo "$kbdnames$add" |  
+	default_description=`echo "$kbdnames$add" |
             grep "^$prefix\*${default_code}\*" |
             sed -e "s/^$prefix\*${default_code}\*//" |
 	    regex_unescape`
 	if [ -z "$default_description" ]; then
 	    # For XkbVariant the empty string is usually a sensible default
-	    default_description=`echo "$kbdnames$add" |  
+	    default_description=`echo "$kbdnames$add" |
                 grep "^$prefix\*\*" |
 		sed -e "s/^$prefix\*\*//" |
 		regex_unescape `
@@ -230,7 +218,7 @@
 	    # description, so we'd better ask.
 	    priority=critical
 	fi
-	
+
         db_input $priority $template || true
 	db_go || return 255
 	db_get $template
@@ -277,13 +265,13 @@
 guess_arch () {
     local arch subarch line
 
-    if which archdetect 2>/dev/null >/dev/null; then
+    if command -v archdetect 2>/dev/null >/dev/null; then
 	archdetect
 	return 0
     fi
 
     arch=`dpkg --print-architecture`
-    
+
     if [ "$arch" = 'powerpc' -o "$arch" = 'm68k' ]; then
 	if [ "$arch" = powerpc ]; then
 	    line=`sed -n 's/^platform.*: *//p' /proc/cpuinfo`
@@ -341,7 +329,7 @@
 # Set $locale.  Extract the strings for the chosen language in $kbdnames
 #########################################################################
 
-if which locale 2>/dev/null >/dev/null; then
+if command -v locale 2>/dev/null >/dev/null; then
     eval `locale`
 fi
 
@@ -381,7 +369,7 @@
 
 if [ "$is_not_debian_installer" ]; then
     if \
-        ! which iconv >/dev/null \
+        ! command -v iconv >/dev/null \
         || ! kbdnames="$(echo "$kbdnames" |
                 iconv -f UTF-8 -t $(locale charmap)//TRANSLIT)"
     then
@@ -488,7 +476,7 @@
 	XKBMODEL=pc105 # UNKNOWN
 	model_priority=critical
 	;;
-esac    
+esac
 
 layout_priority=critical
 case "$locale" in
@@ -879,7 +867,7 @@
 if db_get debian-installer/keymap && [ "$RET" ]; then
     di_keymap="${RET##mac-usb-}"
     di_keymap="${di_keymap%%-latin1}"
-    
+
     old_xkbvariant="$XKBVARIANT"
     XKBVARIANT=''
     old_layout_priority=$layout_priority
@@ -912,7 +900,7 @@
 	kr|kr106) XKBLAYOUT="kr"; XKBVARIANT='';;
 	kr104) XKBLAYOUT="kr"; XKBVARIANT="kr104";;
 	la) XKBLAYOUT="latam";;
-	lt) XKBLAYOUT="lt";; 
+	lt) XKBLAYOUT="lt";;
 	lv-latin4) XKBLAYOUT="lv";;
 	mac-us-std) XKBLAYOUT="us";;
 	mac-de2-ext) XKBLAYOUT="de"; XKBVARIANT="nodeadkeys";;
@@ -937,7 +925,7 @@
 	ua) XKBLAYOUT="us,ua";;
 	uk) XKBLAYOUT="gb";;
 	us) XKBLAYOUT="us";;
-	*) 
+	*)
 	    XKBVARIANT="$old_xkbvariant"
 	    layout_priority=$old_layout_priority
 	    ;;
@@ -948,7 +936,7 @@
 # Lower the priority of the Debconf question to medium.
 if \
     [ -f /etc/X11/xorg.conf -a ! -e $CONFIGFILE ] \
-    && which awk 2>/dev/null >/dev/null
+    && command -v awk 2>/dev/null >/dev/null
 then
     awk_expr='
 {
@@ -968,7 +956,7 @@
 	} else if ($2 == "\"xkbvariant\"") {
 	    xkb = "XKBVARIANT";
 	} else if ($2 == "\"xkboptions\"") {
-	    xkb = "XKBOPTIONS"; 
+	    xkb = "XKBOPTIONS";
 	}
 	$0 = line;
 	$1 = "";
@@ -1088,7 +1076,7 @@
 	    else
 		unsupported_layout=yes
 	    fi
-	    ;;	    
+	    ;;
 	*,*)
 	    unsupported_layout=yes
 	    ;;
@@ -1371,7 +1359,7 @@
 		    layout "$debconf_layout"
 	    then
 		debconf_layout="$RET"
-		STATE=$(($STATE + 1)) 
+		STATE=$(($STATE + 1))
 	    else
 		# always to the next question
 		STATE=$(($STATE + 1))
@@ -1610,7 +1598,7 @@
 		if [ "$toggle" ]; then
 		    toggle=grp:$toggle
 		fi
-		
+
 		db_get keyboard-configuration/switch
 		switch=''
 		case "$RET" in
@@ -1653,7 +1641,7 @@
 		if [ "$switch" ]; then
 		    switch=grp:$switch
 		fi
-		
+
 		db_get keyboard-configuration/altgr
 		altgr=''
 		case "$RET" in
@@ -1740,12 +1728,12 @@
 			fi;;
 		    Left?Logo?key)
 			if [ "$lwin_allocated" != yes ]; then
-			    compose=lwin 
+			    compose=lwin
 			    lwin_allocated=yes
 			fi;;
 		    Right?Control)
 			if [ "$rctrl_allocated" != yes ]; then
-			    compose=rctrl 
+			    compose=rctrl
 			    rctrl_allocated=yes
 			fi;;
 		    Menu?key)
@@ -1766,14 +1754,14 @@
 		if [ "$compose" ]; then
 		    compose=compose:$compose
 		fi
-		
+
 		db_get keyboard-configuration/ctrl_alt_bksp
 		if [ "$RET" = true ]; then
 		    terminate=terminate:ctrl_alt_bksp
 		else
 		    terminate=''
 		fi
-		
+
 		# A fix for #566009
 		if [ "$ralt_allocated" = yes -a "$altgr" = lv3:ralt_alt ]; then
 		    altgr=''
@@ -1785,7 +1773,7 @@
 		    *)
 			leds='';;
 		esac
-		
+
 		options=$(
 		    echo $toggle $switch $altgr $compose $terminate $leds \
 			| sed -e 's/^ *//' -e 's/ *$//' -e 's/  */,/g'
diff -Nru console-setup.orig/debian/keyboard-configuration.postinst console-setup/debian/keyboard-configuration.postinst
--- console-setup.orig/debian/keyboard-configuration.postinst	2021-08-18 22:17:59.892444554 -0700
+++ console-setup/debian/keyboard-configuration.postinst	2021-08-18 22:43:48.226081884 -0700
@@ -5,20 +5,6 @@
 # Source debconf library.
 . /usr/share/debconf/confmodule
 
-# The same as /usr/bin/which - in order to make "which" available before
-# /usr is mounted
-which () {
-    local IFS
-    IFS=:
-    for i in $PATH; do
-	if [ -x "$i/$1" ]; then
-	    echo "$i/$1"
-	    return 0
-	fi
-    done
-    return 1
-}
-
 # In d-i the config script is not executed automatically
 if [ -f /usr/share/console-setup/keyboard-configuration.config ]; then
     /usr/share/console-setup/keyboard-configuration.config || exit $?
@@ -37,7 +23,7 @@
 CONFIGFILE=/etc/default/keyboard
 
 if [ "$1" = "configure" -a ! -L "$CONFIGFILE" ]; then
-    
+
     db_get keyboard-configuration/modelcode
     model="$RET"
 
@@ -64,8 +50,8 @@
         if ! grep "^ *${var}=" $CONFIGFILE >/dev/null; then
 	    echo "${var}=" >>$CONFIGFILE
 	fi
-    done    
-    
+    done
+
     sed \
 	-e "s|^ *XKBMODEL=.*|XKBMODEL=\"$model\"|" \
 	-e "s|^ *XKBLAYOUT=.*|XKBLAYOUT=\"$layout\"|" \
@@ -73,7 +59,7 @@
 	-e "s|^ *XKBOPTIONS=.*|XKBOPTIONS=\"$options\"|" \
 	-e "s|^ *BACKSPACE=.*|BACKSPACE=\"${BACKSPACE:-guess}\"|" \
 	<$CONFIGFILE >$CONFIGFILE.tmp
-    
+
     mv -f $CONFIGFILE.tmp $CONFIGFILE
 
     db_set keyboard-configuration/store_defaults_in_debconf_db true
@@ -82,7 +68,7 @@
 if \
     [ -d /lib/debian-installer.d ] && keyboard_present
 then
-    if [ "$DISPLAY" ] && which setxkbmap >/dev/null; then
+    if [ "$DISPLAY" ] && command -v setxkbmap >/dev/null; then
 	setxkbmap -option '' -model "$model" "$layout" "$variant" "$options"
     else
 	case "`uname`" in
diff -Nru console-setup.orig/debian/preprocessor console-setup/debian/preprocessor
--- console-setup.orig/debian/preprocessor	2021-08-18 22:17:59.900444354 -0700
+++ console-setup/debian/preprocessor	2021-08-18 22:23:08.680765008 -0700
@@ -1,7 +1,7 @@
 #!/bin/sh
 set -e
 
-tmp=`tempfile`
+tmp=`mktemp console-setup.XXXXXXXXXX`
 
 mini=''
 file=''
diff -Nru console-setup.orig/Keyboard/ckbcomp-mini console-setup/Keyboard/ckbcomp-mini
--- console-setup.orig/Keyboard/ckbcomp-mini	2021-08-18 22:17:59.884444752 -0700
+++ console-setup/Keyboard/ckbcomp-mini	2021-08-18 22:45:53.239009017 -0700
@@ -39,20 +39,6 @@
 datadir=$installdir/share/console-setup
 [ -d "$datadir" ] || datadir=/usr/share/console-setup
 
-# The same as /usr/bin/which - in order to make "which" available in
-# environments where "which" does not exist
-which () {
-    local IFS
-    IFS=:
-    for i in $PATH; do
-	if [ -x "$i/$1" ]; then
-	    echo "$i/$1"
-	    return 0
-	fi
-    done
-    return 1
-}
-
 while [ "$*" ]; do
     case "$1" in
 	-I*)
diff -Nru console-setup.orig/setupcon console-setup/setupcon
--- console-setup.orig/setupcon	2021-08-18 22:17:59.900444354 -0700
+++ console-setup/setupcon	2021-08-18 22:33:32.013233908 -0700
@@ -37,20 +37,6 @@
 setupdir=''      # directory for --setup-dir
 SETUP=''
 
-# The same as /usr/bin/which - in order to make "which" available before
-# /usr is mounted
-which () {
-    local IFS
-    IFS=:
-    for i in $PATH; do
-	if [ -f "$i/$1" -a -x "$i/$1" ]; then
-	    echo "$i/$1"
-	    return 0
-	fi
-    done
-    return 1
-}
-
 # Create a temporary file name and set TMPFILE to its name.  Early in
 # the boot process /tmp is mounted read-only, so lets have some other
 # options...  I am not sure all non-GNU versions of mktemp understand
@@ -257,7 +243,7 @@
 test_console () {
     local ok
     ok=0
-    if which tty >/dev/null; then
+    if command -v tty >/dev/null; then
         case "`tty`" in
 	    /dev/tty[1-9]*|/dev/vc/[0-9]*|/dev/console|/dev/ttyv[0-9]*)
                 return 0
@@ -266,7 +252,7 @@
         ok=1
     fi
 
-    if which kbd_mode >/dev/null; then
+    if command -v kbd_mode >/dev/null; then
         mode="`(LC_ALL=C; export LC_ALL; kbd_mode) 2>&1`"
         mode=${mode#The keyboard is in }
         case "$mode" in
@@ -275,7 +261,7 @@
         ok=1
     fi
 
-    if which vidcontrol >/dev/null; then
+    if command -v vidcontrol >/dev/null; then
         if vidcontrol -i adapter >&- 2>&-; then
             return 0
         fi
@@ -449,7 +435,7 @@
 
 # kernel
 kernel=unknown
-if which uname >/dev/null; then
+if command -v uname >/dev/null; then
     case "`uname`" in
         *Linux*) kernel=linux ;;
         *FreeBSD*) kernel=freebsd ;;
@@ -513,7 +499,7 @@
 # CHARMAP
 if [ "$CHARMAP" = guess -o -z "$CHARMAP" ]; then
     CHARMAP=''
-    if which locale >/dev/null; then
+    if command -v locale >/dev/null; then
         CHARMAP=`locale charmap`
     fi
 fi
@@ -538,9 +524,9 @@
 if [ "$do_font" ]; then
     case "$kernel" in
         linux)
-            if which consolechars >/dev/null ; then
+            if command -v consolechars >/dev/null ; then
                 do_font=linuxct
-            elif which setfont >/dev/null ; then
+            elif command -v setfont >/dev/null ; then
                 do_font=linuxkbd
             else
                 echo "setupcon: Neither setfont nor consolechars is accessible. No font will be configured." >&2
@@ -548,7 +534,7 @@
             fi
             ;;
         freebsd)
-            if which vidcontrol >/dev/null ; then
+            if command -v vidcontrol >/dev/null ; then
                 do_font=freebsd
             else
                 echo "setupcon: vidcontrol is not accessible. No font will be configured." >&2
@@ -558,7 +544,7 @@
     esac
 fi
 # Due to bug in splashy and usplash: do not load fonts (#540314)
-if which pidof >/dev/null; then
+if command -v pidof >/dev/null; then
     if pidof splashy > /dev/null || pidof usplash > /dev/null; then
         do_font=''
     fi
@@ -654,7 +640,7 @@
         stdmap=$CHARMAP.acm.gz
         fontdir=share/consolefonts
         stdfont=$CODESET-$FONTFACE$FONTSIZE.psf.gz
-        # [A-WXYZa-wyz] is a funny way to say [A-Za-wyz].  In some locales 
+        # [A-WXYZa-wyz] is a funny way to say [A-Za-wyz].  In some locales
         # [A-Z] includes x and we don't want this.
         stdfontfallback=$CODESET-*[A-WXYZa-wyz]$FONTSIZE.psf.gz
         ;;
@@ -693,7 +679,7 @@
             [ "$FONTFILES" ] || FONTFILES=`findfile $fontdir $stdfontfallback`
             case "$FONTFILES" in
                 *[0-9]x[1-9]*.psf.gz)
-                    if which consolechars >/dev/null; then
+                    if command -v consolechars >/dev/null; then
 		        echo "\
 The consolechars utility from the \"console-tools\" package can load only fonts
 with 8 pixel width matrix.  Please install the setfont utility from the package
@@ -740,7 +726,7 @@
 if [ "$do_kbd" ]; then
     case "$kernel" in
         linux)
-            if which loadkeys >/dev/null; then
+            if command -v loadkeys >/dev/null; then
                 do_kbd=linux
             else
                 echo setupcon: loadkeys is not accessible. Keyboard will not be configured.>&2
@@ -748,7 +734,7 @@
             fi
             ;;
         freebsd)
-            if which kbdcontrol >/dev/null; then
+            if command -v kbdcontrol >/dev/null; then
                 do_kbd=freebsd
             else
                 echo setupcon: kbdcontrol is not accessible. Keyboard will not be configured.>&2
@@ -830,7 +816,7 @@
     savekbdfile="$cached"
 fi
 [ "$XKBMODEL" ] || savekbdfile=''
-if [ "$kernel" = linux ] && ! which gzip >/dev/null; then
+if [ "$kernel" = linux ] && ! command -v gzip >/dev/null; then
     savekbdfile=''
     echo setupcon: gzip is not accessible.  Will not save cached keyboard map. >&2
 fi
@@ -966,7 +952,7 @@
             ;;
         linux*)
             # this is a bit pointless as vesafb doesn't support changing mode
-            if which fbset >/dev/null; then
+            if command -v fbset >/dev/null; then
                 run plain '' fbset -a "$VIDEOMODE"
             else
                 report fbset is not installed
@@ -1114,7 +1100,7 @@
 # Unfortunately, that way the X keyboard will be damaged when
 # console-setup modifies the keyboard mode of X.
 if [ "$do_kbd" = linux ]; then
-    if which kbd_mode >/dev/null; then
+    if command -v kbd_mode >/dev/null; then
         if [ "$unicode" ]; then
             run in '' kbd_mode -u
         else
@@ -1253,7 +1239,7 @@
     tempfile || { echo setupcon: Can not create temporary file >&2; exit 1; }
     printf "%s" "$SETUP" |
     while read -r cmd args; do
-        which "$cmd" >>$TMPFILE || true
+        command -v "$cmd" >>$TMPFILE || true
         printf "%s " "$cmd"
         fileargs "$args"
         echo

Reply to: