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

Bug#679276: debian-installer: Debian installer fails to prevent the user from defining more than 10 md devices



As a matter of fact it *does* prevent the creation of more than 11 md devices but as far as I can see this is a bug, not a feature.

In the file lib/md-base.sh:
# Find the next available MD device number
md_next_device_number () {
	local md_num="$(grep ^md /proc/mdstat | \
			sed -e 's/^md\(.*\) : active .*/\1/' | sort | tail -n1)"
	if [ -z "$md_num" ]; then
		md_num=0
	else
		md_num="$(($md_num + 1))"
	fi
	echo "$md_num"
}

What does 'sort' do with 0 1 2 3 4 5 6 7 8 9 10? Well not what one might expect: 0 1 10 2 3 4 5 6 7 8 9.
That means we get 9 even if md10 exists and return 10 as the next available device number. So the installer will try to create md10 again. It should be 'sort -n' instead to handle this properly.

@Carsten: why should the limit for md devices be 10?

Regards,
Stefan


Reply to: