Bug#842609: xen-create-image: Inconsistent handling of --nopygrub parameter

2017-01-10 Thread Axel Beckert
Control: tag -1 + pending

Hi Daniel,

Daniel Reichelt wrote:
> when --nopygrub is passed to xen-create-image, the hooks called during
> installation act as if --pygrub were passed.
> 
> This setting gets exported to the hooks' environments as pygrub=0|1. The hooks
> however do a check like
> 
> `if [ ${pygrub} ]; then`
> 
> which in sh/bash always yields true (non-empty string). This only works if
> $pygrub were set to literal "true"|"false".

Thanks for the detailed bug report…

> The attached patch changes these
> checks to
> 
> `if [ "${pygrub}" = "1" ]; then`
> 
> The patch applies cleanly to both jessie an stretch verions of the xen-tools
> package.

… and the patch!

Applied upstream
(https://github.com/xen-tools/xen-tools/commit/ef096628225bd8b2ef6a8c18fd4743f5fdbfe8f6)
and will be part of the (soon to be uploaded) next upstream release.

Regards, Axel
-- 
 ,''`.  |  Axel Beckert , http://people.debian.org/~abe/
: :' :  |  Debian Developer, ftp.ch.debian.org Admin
`. `'   |  4096R: 2517 B724 C5F6 CA99 5329  6E61 2FF9 CD59 6126 16B5
  `-|  1024D: F067 EA27 26B9 C3FC 1486  202E C09E 1D89 9593 0EDE



Bug#842609: xen-create-image: Inconsistent handling of --nopygrub parameter

2016-10-30 Thread Daniel Reichelt
Package: xen-tools
Version: 4.5-1
Severity: normal
Tags: patch

Hi Axel,

when --nopygrub is passed to xen-create-image, the hooks called during
installation act as if --pygrub were passed.

This setting gets exported to the hooks' environments as pygrub=0|1. The hooks
however do a check like

`if [ ${pygrub} ]; then`

which in sh/bash always yields true (non-empty string). This only works if
$pygrub were set to literal "true"|"false". The attached patch changes these
checks to

`if [ "${pygrub}" = "1" ]; then`


The patch applies cleanly to both jessie an stretch verions of the xen-tools
package.



Cheers

Daniel




-- System Information:
Debian Release: 8.6
  APT prefers stable
  APT policy: (990, 'stable'), (500, 'stable-updates'), (500, 
'proposed-updates')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.16.0-4-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: sysvinit (via /sbin/init)

Versions of packages xen-tools depends on:
ii  debootstrap   1.0.67
ii  libconfig-inifiles-perl   2.83-3
ii  libdata-validate-domain-perl  0.10-1
ii  libdata-validate-ip-perl  0.24-1
ii  libdata-validate-uri-perl 0.06-1
ii  libfile-slurp-perl.19-4
ii  libfile-which-perl1.09-1
ii  libterm-ui-perl   0.42-1
ii  libtext-template-perl 1.46-1
ii  openssh-client1:6.7p1-5+deb8u3
ii  perl  5.20.2-3+deb8u6

Versions of packages xen-tools recommends:
ii  libexpect-perl   1.21-1
ii  rinse3.0.9
ii  xen-hypervisor-4.4-amd64 [xen-hypervisor-amd64]  4.4.1-9+deb8u7
ii  xen-utils-4.4 [xen-utils]4.4.1-9+deb8u7

Versions of packages xen-tools suggests:
ii  btrfs-tools3.17-1.1
pn  cfengine2  
ii  reiserfsprogs  1:3.6.24-1
ii  xfsprogs   3.2.1

-- no debconf information
--- a/hooks/common/80-install-modules-deb	2016-10-30 19:52:53.662077321 +0100
+++ b/hooks/common/80-install-modules-deb	2016-10-30 19:54:14.378190647 +0100
@@ -31,7 +31,7 @@
 #
 logMessage Script $0 starting
 
-if [ ${pygrub} ]; then
+if [ "${pygrub}" = "1" ]; then
 logMessage "pygrub set, skipping module install"
 else
 #
--- a/hooks/common/82-install-grub-legacy	2016-10-30 19:53:00.534086963 +0100
+++ b/hooks/common/82-install-grub-legacy	2016-10-30 19:54:14.386190659 +0100
@@ -26,7 +26,7 @@
 #
 logMessage Script $0 starting
 
-if [ ${pygrub} ]; then
+if [ "${pygrub}" = "1" ]; then
 
 #
 #  Install the grub 0.9x package ("grub-legacy" on Debian, "grub" on Ubuntu)
--- a/hooks/debian/80-install-kernel	2016-10-30 19:53:13.878105687 +0100
+++ b/hooks/debian/80-install-kernel	2016-10-30 19:54:14.390190665 +0100
@@ -21,7 +21,7 @@
 . ./hooks/common.sh
 fi
 
-if [ "${pygrub}" ]; then
+if [ "${pygrub}" = "1" ]; then
 #
 # Log our start
 #
--- a/hooks/edgy/80-install-kernel	2016-10-30 19:53:28.134125699 +0100
+++ b/hooks/edgy/80-install-kernel	2016-10-30 19:54:14.394190670 +0100
@@ -27,7 +27,7 @@
 
 logMessage Script $0 starting
 
-if [ "${pygrub}" ]; then
+if [ "${pygrub}" = "1" ]; then
 
 #
 # Attempt to install a xen kernel, if that fails, then install a normal one
--- a/hooks/intrepid/80-install-kernel	2016-10-30 19:53:37.250138498 +0100
+++ b/hooks/intrepid/80-install-kernel	2016-10-30 19:54:14.398190675 +0100
@@ -27,7 +27,7 @@
 
 logMessage Script $0 starting
 
-if [ "${pygrub}" ]; then
+if [ "${pygrub}" = "1" ]; then
 
 #
 # Attempt to install a xen kernel, if that fails, then install a normal one
--- a/hooks/karmic/80-install-kernel	2016-10-30 19:53:49.302155421 +0100
+++ b/hooks/karmic/80-install-kernel	2016-10-30 19:54:14.402190681 +0100
@@ -26,7 +26,7 @@
 
 logMessage Script $0 starting
 
-if [ "${pygrub}" ]; then
+if [ "${pygrub}" = "1" ]; then
 
 #
 # The type of kernel that we will be installing