When compiling with zero packages configured, the compilation hangs forever with a call to "cat"
Username: Michael Jones
Origin: https://bugs.openwrt.org/index.php?do=details&task_id=2164
Supply the following if possible:
-
Device problem occurs on
-
Software versions of OpenWrt/LEDE release, packages, etc.
-
Steps to reproduce
git clone –depth 1
https://github.com/openwrt/openwrt.git
openwrt-reproduce-package-cat-bug
cd openwrt-reproduce-package-cat-bug
cp $attached_file_.config .config
make V=sc
The build process hangs after these log lines:
find .tmp_versions -name '*.mod' | xargs -r grep -h '.ko' | sort -u | sed 's/.ko
/.o/' | scripts/mod/modpost -o ./Module.symvers -S -s -T -
make[5]: Leaving directory ‘/home/jonesmz/openwrt-reproduce-package-cat-bug/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/linux-ipq806x/linux-4.14.104’ touch /home/jonesmz/openwrt-reproduce-package-cat-bug/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/linux-ipq806x/linux-4.14.104/.modules
make -C image compile TARGET_BUILD=
make[5]: Entering directory ‘/home/jonesmz/openwrt-reproduce-package-cat-bug/target/linux/ipq806x’ make[5]: warning: jobserver unavailable: using -j1. Add ‘+’ to parent make rule.
make[5]: Nothing to be done for ‘compile’.
make[5]: Leaving directory ‘/home/jonesmz/openwrt-reproduce-package-cat-bug/target/linux/ipq806x/image’ make[4]: Leaving directory ‘/home/jonesmz/openwrt-reproduce-package-cat-bug/target/linux/ipq806x’ make[3]: Leaving directory ‘/home/jonesmz/openwrt-reproduce-package-cat-bug/target/linux’ time: target/linux/compile#2.58#0.96#1.99
make[2]: Leaving directory ‘/home/jonesmz/openwrt-reproduce-package-cat-bug’ export MAKEFLAGS= ;make -w -r diffconfig
make[2]: Entering directory ‘/home/jonesmz/openwrt-reproduce-package-cat-bug’ make[2]: Entering directory ‘/home/jonesmz/openwrt-reproduce-package-cat-bug’ make[3]: Entering directory ‘/home/jonesmz/openwrt-reproduce-package-cat-bug/package/libs/libjson-c’ make[3]: Leaving directory ‘/home/jonesmz/openwrt-reproduce-package-cat-bug/package/libs/libjson-c’ time: package/libs/libjson-c/host-compile#0.16#0.08#0.22
make[3]: Entering directory ‘/home/jonesmz/openwrt-reproduce-package-cat-bug/package/libs/libubox’ make[3]: Leaving directory ‘/home/jonesmz/openwrt-reproduce-package-cat-bug/package/libs/libubox’ time: package/libs/libubox/host-compile#0.68#0.36#0.98
make[3]: Entering directory ‘/home/jonesmz/openwrt-reproduce-package-cat-bug/package/system/opkg’ make[2]: Leaving directory ‘/home/jonesmz/openwrt-reproduce-package-cat-bug’ make[3]: Leaving directory ‘/home/jonesmz/openwrt-reproduce-package-cat-bug/package/system/opkg’ time: package/system/opkg/host-compile#0.55#0.25#0.75
make[2]: Leaving directory ‘/home/jonesmz/openwrt-reproduce-package-cat-bug’ make[2]: Entering directory ‘/home/jonesmz/openwrt-reproduce-package-cat-bug’ make[2]: warning: -jN forced in submake: disabling jobserver mode.
rm -rf /home/jonesmz/openwrt-reproduce-package-cat-bug/staging_dir/packages/ipq806x
mkdir -p /home/jonesmz/openwrt-reproduce-package-cat-bug/staging_dir/packages/ipq806x
And the following process tree
/bin/bash
- make -j25 V=sc
/bin/sh -c _limit=ulimit -n
; .............
make -w -r world
make -j1 package/install
bash -c cat 2>/dev/null
cat
The attached .config file has a minimal configuration where as few packages as possible selected. In this case, I think I’ve managed to get it down to zero packages. I believe that what’s failing is this line:
./package/Makefile: (call opkg_package_files,
(foreach pkg,$(shell cat $(PACKAGE_INSTALL_FILES) 2>/dev/null),$(pkg)(call GetABISuffix,
(pkg))))
Where if this line is executed when $PACKAGE_INSTALL_FILES expands to nothing, then the “cat” program expects to read data from standard in, which will wait forever.
An easy workaround is to add /dev/null to the list of files to cat, such as
./package/Makefile: (call opkg_package_files,
(foreach pkg,$(shell cat /dev/null $(PACKAGE_INSTALL_FILES) 2>/dev/null),$(pkg)(call GetABISuffix,
(pkg))))
But you still end up with failures later, such as opkg being given an empty list of packages to install.