Package: kernel-package
Followup-For: Bug #890817

Dear Maintainer,

The attached patch redirects stdin from /dev/null when invoking
kernel_version.mk to avoid hanging waiting for input on kernel version
4.16 and later (after commit d2a04648a5db) as described in my previous
email.

I think a better long-term solution would be to avoid including the
kernel Makefile.  Since that would be a major change which could have
other effects I'm not aware of, I'll leave that for later, if ever,
based on your feedback.

Best,
Kevin

-- System Information:
Debian Release: buster/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (101, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.16.1-kevinoid1 (SMP w/4 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8), 
LANGUAGE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages kernel-package depends on:
ii  bc               1.07.1-2+b1
ii  binutils         2.30-15
ii  build-essential  12.4
ii  bzip2            1.0.6-8.1
ii  dpkg-dev         1.19.0.5
ii  file             1:5.33-2
ii  gettext          0.19.8.1-6+b1
ii  kmod             25-1
ii  lzma             9.22-2.1
ii  po-debconf       1.0.20
ii  xmlto            0.0.28-2
ii  xz-utils [lzma]  5.2.2-1.3

Versions of packages kernel-package recommends:
ii  cpio           2.12+dfsg-6
pn  docbook-utils  <none>
ii  kernel-common  13.018+nmu1
pn  uboot-mkimage  <none>

Versions of packages kernel-package suggests:
ii  libncurses-dev  6.1+20180210-3
pn  linux-source    <none>

-- Configuration Files:
/etc/kernel-pkg.conf changed [not included]

-- no debconf information
>From 53852c047cdb0d89bc60dfdfc5ea5dd984e350fb Mon Sep 17 00:00:00 2001
Message-Id: 
<53852c047cdb0d89bc60dfdfc5ea5dd984e350fb.1526533203.git.ke...@kevinlocke.name>
From: Kevin Locke <ke...@kevinlocke.name>
Date: Wed, 16 May 2018 22:30:04 -0600
Subject: [PATCH] Redirect stdin from /dev/null for kernel_version.mk

kernel/ruleset/kernel_version.mk includes the kernel Makefile with
dot-config := 1.  This causes Makefile to invoke silentoldconfig.  For
kernel versions which include d2a04648a5db, scripts/kconfig/conf does
not automatically exit when stderr is not a terminal and instead hangs
while waiting for input.  Since kernel_version.mk is included with
stdout captured and stderr redirected to /dev/null, the user will never
see the prompt and the build hangs.

This commit provides the simple fix of redirecting /dev/null to stdin,
which returns to the same behavior as before.  I think a better solution
would be for kernel_version.mk to parse the output from `make
kernelversion` and `make kernelrelease`, but it would be a non-trivial
behavior change which I will defer until input from the package
maintainer.

Closes: 890817
Signed-off-by: Kevin Locke <ke...@kevinlocke.name>
---
 kernel/ruleset/misc/version_vars.mk | 12 ++++++------
 kernel/ruleset/targets/common.mk    |  4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/kernel/ruleset/misc/version_vars.mk 
b/kernel/ruleset/misc/version_vars.mk
index 6f7ded0..9dc9cb2 100644
--- a/kernel/ruleset/misc/version_vars.mk
+++ b/kernel/ruleset/misc/version_vars.mk
@@ -69,22 +69,22 @@ ifeq ($(DEB_HOST_ARCH_OS), linux)
   # .config, and the informational message messes up the variable.
   TEST         :=$(call doit,$(MAKE) $(CROSS_ARG) $(K_ARG) 
--no-print-directory \
                    -sf $(DEBDIR)/ruleset/kernel_version.mk debian_VERSION      
 \
-                    2>/dev/null )
+                    </dev/null 2>/dev/null )
   VERSION      :=$(call doit,$(MAKE) $(CROSS_ARG) $(K_ARG) 
--no-print-directory \
                    -sf $(DEBDIR)/ruleset/kernel_version.mk debian_VERSION      
 \
-                    2>/dev/null | tail -n 1)
+                    </dev/null 2>/dev/null | tail -n 1)
   PATCHLEVEL   :=$(call doit,$(MAKE) $(CROSS_ARG) $(K_ARG) 
--no-print-directory \
                    -sf $(DEBDIR)/ruleset/kernel_version.mk debian_PATCHLEVEL   
 \
-                    2>/dev/null | tail -n 1)
+                    </dev/null 2>/dev/null | tail -n 1)
   SUBLEVEL     :=$(call doit,$(MAKE) $(CROSS_ARG) $(K_ARG) 
--no-print-directory \
                    -sf $(DEBDIR)/ruleset/kernel_version.mk debian_SUBLEVEL     
 \
-                    2>/dev/null | tail -n 1)
+                    </dev/null 2>/dev/null | tail -n 1)
   EXTRA_VERSION:=$(call doit,$(MAKE) $(CROSS_ARG) $(K_ARG) 
--no-print-directory \
                    -sf $(DEBDIR)/ruleset/kernel_version.mk debian_EXTRAVERSION 
 \
-                    2>/dev/null | tail -n 1)
+                    </dev/null 2>/dev/null | tail -n 1)
   LOCALVERSION :=$(call doit,$(MAKE) $(CROSS_ARG) $(K_ARG) 
--no-print-directory \
                    -sf $(DEBDIR)/ruleset/kernel_version.mk debian_LOCALVERSION 
 \
-                    2>/dev/null | tail -n 1)
+                    </dev/null 2>/dev/null | tail -n 1)
   # If the variable TEST did get a mesage about .config beng written, pass it 
on.
   ifneq ($(strip $(TEST)),$(strip $(VERSION)))
     $(warn $(TEST))
diff --git a/kernel/ruleset/targets/common.mk b/kernel/ruleset/targets/common.mk
index cbf87ee..9e91219 100644
--- a/kernel/ruleset/targets/common.mk
+++ b/kernel/ruleset/targets/common.mk
@@ -185,8 +185,8 @@ endif
 # Use the kernel's Makefile to calculate the TOPDIR.
 # TOPDIR is obsolete in 2.6 kernels, so the kernel_version.mk
 # will get us the right answer
-       @echo $(shell $(MAKE) --no-print-directory -sf 
$(DEBDIR)/ruleset/kernel_version.mk debian_TOPDIR 2>/dev/null | tail -n 1) 
>/dev/null
-       @sed -e 's%$(shell $(MAKE) --no-print-directory -sf 
$(DEBDIR)/ruleset/kernel_version.mk debian_TOPDIR 2>/dev/null | tail -n 
1)%$$(TOPDIR)%g' debian/stamp/conf/mak     > debian/stamp/conf/vars
+       @echo $(shell $(MAKE) --no-print-directory -sf 
$(DEBDIR)/ruleset/kernel_version.mk debian_TOPDIR </dev/null 2>/dev/null | tail 
-n 1) >/dev/null
+       @sed -e 's%$(shell $(MAKE) --no-print-directory -sf 
$(DEBDIR)/ruleset/kernel_version.mk debian_TOPDIR </dev/null 2>/dev/null | tail 
-n 1)%$$(TOPDIR)%g' debian/stamp/conf/mak     > debian/stamp/conf/vars
        @rm -f debian/stamp/conf/mak
        @touch debian/stamp/conf/vars
 
-- 
2.17.0

Reply via email to