Re: [PATCH xtables-addons] build: fix configure compatiblity with POSIX shells

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

 



On Friday 2016-04-01 22:35, Matthias Schiffer wrote:

>The kernel version detection code uses some bashisms, which makes the build
>fail on Debian systems where /bin/sh links to dash. Replace with POSIX-
>conforming commands at the cost of requiring awk.
>+	krel="$(make -sC "$kbuilddir" M=$PWD kernelrelease | $AWK -v 'FS=[[^0-9.]]' '{print $1; exit}')";
>+	save_IFS=$IFS;
>+	IFS='.';
>+	set x $krel;
>+	kmajor="$(($2+0))";
>+	kminor="$(($3+0))";
>+	kmicro="$(($4+0))";
>+	kstable="$(($5+0))";
>+	IFS=$save_IFS;
> 	if test -z "$kmajor" -o -z "$kminor" -o -z "$kmicro"; then

To test its resilience against silly krel strings (not exactly unheard of),
let's pretend that

	krel="4x.6.0"

The previous code would conclude (albeit with a silly broken-up version like
4.0.6.0 or 0.0.0.0). However, your change makes the script totally falls over:

checking kernel version that we will build against... ./configure: line
11957: 4x: value too great for base (error toke
n is "4x")
./configure: line 8: printf %s\n: command not found
./configure: line 14: AMDEPBACKSLASH: command not found
./configure: line 15: AMDEP_FALSE: command not found
./configure: line 16: AMDEP_TRUE: command not found
./configure: line 17: AMTAR: command not found
[...]

(and who knows what other commands - rm? - it tries to execute by sheer
chance).
Is it possible to harden the dash-compatible variant?
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux