Bug#724644: initramfs-tools: Parsing of ip= option is brittle

2013-09-26 Thread Matto Marjanovic

Package: initramfs-tools
Version: 0.113
Severity: normal

Dearest Maintainer,

The configure_networking() function in scripts/functions fails
to parse an ip= kernel option if it has more than one parameter
following the device name.  For example:

  ip=client-ip:server-ip:gw-ip:netmask:hostname:device:autoconf

works just fine, however,

  ip=client-ip:server-ip:gw-ip:netmask:hostname:device:autoconf:dns0:dns1

does not, and that happens to be the format described in
  https://www.kernel.org/doc/Documentation/filesystems/nfs/nfsroot.txt

A one character change to configure_networking() will make it immune to
any number of parameters following the device name:

--- functions   2013-09-25 00:39:49.0 -0700
+++ functions-better2013-09-25 00:40:20.0 -0700
@@ -396,7 +396,7 @@
# grab device entry from ip option
NEW_DEVICE=${IP#*:*:*:*:*:*}
if [ ${NEW_DEVICE} != ${IP} ]; then
-   NEW_DEVICE=${NEW_DEVICE%:*}
+   NEW_DEVICE=${NEW_DEVICE%%:*}
else
# wrong parse, possibly only a partial string
NEW_DEVICE=

In other words:  remove the *longest* suffix beginning with :, rather
than the shortest.

-mm

-- Package-specific info:
-- System Information:
Debian Release: jessie/sid
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable'), (50, 'unstable'), (1, 
'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.10-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash

Versions of packages initramfs-tools depends on:
ii  cpio   2.11+dfsg-1
ii  klibc-utils2.0.1-3.1
ii  kmod   9-3
ii  module-init-tools  9-3
ii  udev   204-4

Versions of packages initramfs-tools recommends:
ii  busybox  1:1.20.0-9

-- no debconf information


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#724644: initramfs-tools: Parsing of ip= option is brittle

2013-09-26 Thread maximilian attems
tags 724644 pending
stop

Dear Matto,

On Wed, 25 Sep 2013, Matto Marjanovic wrote:

 
 The configure_networking() function in scripts/functions fails
 to parse an ip= kernel option if it has more than one parameter
 following the device name.  For example:
 
   ip=client-ip:server-ip:gw-ip:netmask:hostname:device:autoconf
 
 works just fine, however,
 
   ip=client-ip:server-ip:gw-ip:netmask:hostname:device:autoconf:dns0:dns1
 
 does not, and that happens to be the format described in
   https://www.kernel.org/doc/Documentation/filesystems/nfs/nfsroot.txt

Thanks for the good description.
 
 A one character change to configure_networking() will make it immune to
 any number of parameters following the device name:

patch merged and pushed, will be uploaded shortly.

Best,

-- 
maks


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org