← Back to team overview

group.of.nepali.translators team mailing list archive

[Bug 1745531] Re: [SRU] Reinforce hostname preseed regex

 

** Changed in: debian-installer (Ubuntu Bionic)
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of नेपाली
भाषा समायोजकहरुको समूह, which is subscribed to Xenial.
Matching subscriptions: Ubuntu 16.04 Bugs
https://bugs.launchpad.net/bugs/1745531

Title:
  [SRU] Reinforce hostname preseed regex

Status in debian-installer package in Ubuntu:
  In Progress
Status in preseed package in Ubuntu:
  Fix Released
Status in debian-installer source package in Trusty:
  Fix Released
Status in preseed source package in Trusty:
  Fix Released
Status in debian-installer source package in Xenial:
  Fix Released
Status in preseed source package in Xenial:
  Fix Released
Status in debian-installer source package in Artful:
  Fix Released
Status in preseed source package in Artful:
  Fix Released
Status in debian-installer source package in Bionic:
  Fix Released
Status in preseed source package in Bionic:
  Fix Released

Bug description:
  [Special notes]

  Rebuilding debian-installer will be necessary in order to get a new
  mini.iso (Minimal ISO image of Ubuntu) containing this particular fix.

  Despite the fact that a full ISO are no longer built for some of the
  affected stable releases, one can use what is called a minimal ISO
  image (mini.iso) of Ubuntu. This mini.iso uses a text-based installer,
  resulting in a smaller image. The minimal ISO image will download
  packages from online archives at installation time instead of
  providing them on the install media itself.

  [Impact]

  This is the same issue reported in https://bugs.launchpad.net/ubuntu/+source/preseed/+bug/1452202
  However that is marked as 'Fix Released' and the issue is still occurring so it seems best to just open a new bug according to Eric's comment.

  The present hostname preseed regex looks like:

  if ! echo "$RET" | grep -q 'ubuntu'; then
     ...
     /bin/sed -i "s/$CURRENT_HOSTNAME/$NETCFG_HOSTNAME/" /etc/hosts
     ...
  fi

  There are still multiple problems with them according to Peter's
  comment
  (https://bugs.launchpad.net/ubuntu/+source/preseed/+bug/1452202/comments/64)
  and Mathieu's comment
  (https://bugs.launchpad.net/ubuntu/+source/preseed/+bug/1452202/comments/93).

  - The default hostname is 'ubuntu', and is the value you will get if
  nothing is preseeded -- we *do* need to skip it in this case, although
  the grep may need to be more precise. A name like 'ubuntuxenial'
  should match this grep.

  - The sed needs to be fixed to more appropriately catch for the exact
  string, rather than any substring -- ie. it should not match
  'ipv6-allnodes' if the name received from DHCP was 'node'. It should
  only match and replace for 'node'.

  So the fix will try to:

  1) Keep the if statement and add the -w option to grep to be more robust
  2) Modify the sed cmd with word boundaries (\b) to be more robust as well.

  [Test Case]

  Install Ubuntu using a preseed[1] file[2] and add the following line in the preseed recipe :
  d-i netcfg/hostname string <HOSTNAME>

  Change the HOSTNAME to see if the hostname in /etc/hosts can be
  updated correctly.

  [1] - url=http://<WEB_SERVER>/<PRESEED_FILE>
  [2] - https://help.ubuntu.com/lts/installation-guide/example-preseed.txt

  [Regression Potential]

   * none expected, the actual changes are as follows:

  -        if ! echo "$RET" | grep -q 'ubuntu'; then
  +        if ! echo "$RET" | grep -qw 'ubuntu'; then
  ...
  -		/bin/sed -i "s/$CURRENT_HOSTNAME/$NETCFG_HOSTNAME/" /etc/hosts
  +		/bin/sed -i "s/\b${CURRENT_HOSTNAME}\b/${NETCFG_HOSTNAME}/g" /etc/hosts

  In other words, we simply make it more robust to select only pattern
  containing matches that form whole word... catching 'ubuntu' hostname
  as-is but not catching pattern where ubuntu is part of the user chosen
  hostname as follow :

  "sometextubuntu"
  "sometextubuntusometext"
  "ubuntusometext"
  ...

  [Original Description]

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/debian-installer/+bug/1745531/+subscriptions