TO ALL.
On Mon, Jan 04, 2021 at 06:45:59PM +0800, Yu Chuan wrote:
- $LKP_DEBUG_PREFIX $LKP_SRC/bin/run-ipconfig
- network_ok && return
- local net_devices=$(get_net_devices) if [ -z "$net_devices" ]; then
The patch moved around the $net_devices test. What line of code will set $net_devices (or somehow affect its setting)? That fact will answer the question "why the move (hence this patch) helps"?
OMG! The real root reason is because of dash and the follow line: local net_devices=$(get_net_devices)
Explain:
- get_net_devices is a function, and it return " enp0s1",
- in dash, local net_devices=$(get_net_devices) => local net_devices= enp0s1 => net_devices will be none!
- test code:
ycb: :
- local ycb= asf
- echo ycb: :
Conclusion: We only need add double quote for the follow code to solve this problem: before: local net_devices=$(get_net_devices) after: local net_devices="$(get_net_devices)"
Good catch! 我们将来需要这样刨根问底的fix,避免稀里糊涂的“好像这样就行了”的fix. 预防的方法,就是要求在changelog里给出一个明确的root cause.
Thanks, Fengguang
@@ -181,9 +184,6 @@ setup_network() fi fi
- $LKP_DEBUG_PREFIX $LKP_SRC/bin/run-ipconfig
- network_ok && return
- local err_msg='IP-Config: Auto-configuration of network failed' dmesg | grep -q -F "$err_msg" || { # Include $err_msg in the error message so that it matches
-- 2.23.0