Your message dated Sun, 15 Mar 2015 09:49:18 +0000
with message-id <e1yx5ac-0007hz...@franck.debian.org>
and subject line Bug#779797: fixed in gdisk 0.8.10-2
has caused the Debian Bug report #779797,
regarding gdisk: Returns exit code 1 after successful operations
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
779797: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=779797
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: gdisk
Version: 0.8.10-1
Severity: important
X-Debbugs-Cc: u...@451f.org

Hi,

tl;dr:

  * In Wheezy, gdisk correctly returns exit code 0 upon success.

  * In Jessie, gdisk mistakenly returns exit code 1 after various
    successful operations. This breaks any tool that uses gdisk for
    such operations... and bothers checking its exit code. No idea if
    the reverse-dependencies in Debian are affected, but it does break
    Tails Installer (not in Debian yet, will be uploaded by the end of
    August) on Jessie.

  * This regression has been identified upstream in March, 2014.
    It was fixed in upstream Git back then. It's the HEAD of their
    master branch, and no release was put out since.

The attached patchset imports the fix from upstream (not the entire
commit, that sadly is non-atomic and contains unrelated changes --
just the relevant changes), and updates d/changelog accordingly.
I've generated with git format-patch from the Vcs-Git.

The attached reproducer script allows anyone to confirm the summary
I made above. The results I see on Wheezy, Jessie, and Jessie + the
upstream fix follow.

With my Tails hat, I'd love to see this bug fixed in Jessie (otherwise
we'll have to ship a modified gdisk in Tails).

With my Debian hat, I'm unsure. On the one hand, arguably it's not RC,
and if nobody reported this bug at this stage of the release cycle,
then it's probably big deal to release with it, and not worth taking
the risk to modify the package. On the other hand that's a nasty
regression, and we don't know how many home-made scripts running under
`set -e' will be broken once their authors upgrade their systems
to Jessie.

Guillaume, what do you think? If you feel it's RC, please bump
severity. I can take care of NMU'ing and talking to the release team
if it helps — just let me know.


Jessie
========================================================================

$ ~/tmp/test.sh /dev/sdb
Resetting disk /dev/sdb...
32+0 records in
32+0 records out
33554432 bytes (34 MB) copied, 4.91898 s, 6.8 MB/s

-----------------------------------------------------------------
Creating blank GPT from corrupted disk...
GPT fdisk (gdisk) version 0.8.10

Caution: invalid main GPT header, but valid backup; regenerating main header
from backup!

Partition table scan:
  MBR: not present
  BSD: not present
  APM: not present
  GPT: damaged

Found invalid MBR and corrupt GPT. What do you want to do? (Using the
GPT MAY permit recovery of GPT data.)
 1 - Use current GPT
 2 - Create blank GPT

Your answer: 
Command (? for help): 
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): OK; writing new GUID partition table (GPT) to 
/dev/sdb.
The operation has completed successfully.
Exit code: 1
-----------------------------------------------------------------
Wiping GPT and MBR...
GPT fdisk (gdisk) version 0.8.10

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): 
Expert command (? for help): About to wipe out GPT on /dev/sdb. Proceed? (Y/N): 
GPT data structures destroyed! You may now partition the disk using fdisk or
other utilities.
Blank out MBR? (Y/N): Exit code: 1
-----------------------------------------------------------------
Creating new protective MBR...
GPT fdisk (gdisk) version 0.8.10

Partition table scan:
  MBR: not present
  BSD: not present
  APM: not present
  GPT: not present

Creating new GPT entries.

Command (? for help): 
Expert command (? for help): 
Expert command (? for help): 
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): OK; writing new GUID partition table (GPT) to 
/dev/sdb.
The operation has completed successfully.
Exit code: 1


Wheezy
========================================================================

Resetting disk /dev/sda...
32+0 records in
32+0 records out
33554432 bytes (34 MB) copied, 3.23598 s, 10.4 MB/s

-----------------------------------------------------------------
Creating blank GPT from corrupted disk...
GPT fdisk (gdisk) version 0.8.5

Partition table scan:
  MBR: not present
  BSD: not present
  APM: not present
  GPT: not present

Creating new GPT entries.

Command (? for help): b back up GPT data to a file
c       change a partition's name
d       delete a partition
i       show detailed information on a partition
l       list known partition types
n       add a new partition
o       create a new empty GUID partition table (GPT)
p       print the partition table
q       quit without saving changes
r       recovery and transformation options (experts only)
s       sort partitions
t       change a partition's type code
v       verify disk
w       write table to disk and exit
x       extra functionality (experts only)
?       print this menu

Command (? for help): 
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): OK; writing new GUID partition table (GPT) to 
/dev/sda.
The operation has completed successfully.
Exit code: 0
-----------------------------------------------------------------
Wiping GPT and MBR...
GPT fdisk (gdisk) version 0.8.5

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): 
Expert command (? for help): About to wipe out GPT on /dev/sda. Proceed? (Y/N): 
GPT data structures destroyed! You may now partition the disk using fdisk or
other utilities.
Blank out MBR? (Y/N): Exit code: 0
-----------------------------------------------------------------
Creating new protective MBR...
GPT fdisk (gdisk) version 0.8.5

Partition table scan:
  MBR: not present
  BSD: not present
  APM: not present
  GPT: not present

Creating new GPT entries.

Command (? for help): 
Expert command (? for help): 
Expert command (? for help): 
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): OK; writing new GUID partition table (GPT) to 
/dev/sda.
The operation has completed successfully.
Exit code: 0


Jessie + upstream fix (attached patch)
========================================================================

Resetting disk /dev/sdb...
32+0 records in
32+0 records out
33554432 bytes (34 MB) copied, 3.08629 s, 10.9 MB/s

-----------------------------------------------------------------
Creating blank GPT from corrupted disk...
GPT fdisk (gdisk) version 0.8.10

Caution: invalid main GPT header, but valid backup; regenerating main header
from backup!

Partition table scan:
  MBR: not present
  BSD: not present
  APM: not present
  GPT: damaged

Found invalid MBR and corrupt GPT. What do you want to do? (Using the
GPT MAY permit recovery of GPT data.)
 1 - Use current GPT
 2 - Create blank GPT

Your answer: 
Command (? for help): 
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): OK; writing new GUID partition table (GPT) to 
/dev/sdb.
The operation has completed successfully.
Exit code: 0
-----------------------------------------------------------------
Wiping GPT and MBR...
GPT fdisk (gdisk) version 0.8.10

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): 
Expert command (? for help): About to wipe out GPT on /dev/sdb. Proceed? (Y/N): 
GPT data structures destroyed! You may now partition the disk using fdisk or
other utilities.
Blank out MBR? (Y/N): Exit code: 0
-----------------------------------------------------------------
Creating new protective MBR...
GPT fdisk (gdisk) version 0.8.10

Partition table scan:
  MBR: not present
  BSD: not present
  APM: not present
  GPT: not present

Creating new GPT entries.

Command (? for help): 
Expert command (? for help): 
Expert command (? for help): 
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): OK; writing new GUID partition table (GPT) to 
/dev/sdb.
The operation has completed successfully.
Exit code: 0


Cheers,
--
intrigeri

#!/bin/sh

set -u

[ $# -eq 1 ] || exit 13
[ -n "$1" ]  || exit 17

DISK="$1"

echo "Resetting disk ${DISK}..."
sudo dd if=/dev/zero of="$DISK" bs=1M count=32
echo

echo "-----------------------------------------------------------------"

echo "Creating blank GPT from corrupted disk..."
echo "2\nw\ny\n" | sudo gdisk "$DISK"
echo "Exit code: $?"

echo "-----------------------------------------------------------------"

echo "Wiping GPT and MBR..."
echo "x\nz\ny\ny\n" | sudo gdisk "$DISK"
echo "Exit code: $?"

echo "-----------------------------------------------------------------"

echo "Creating new protective MBR..."
echo "x\nn\nw\ny\n" | sudo gdisk "$DISK"
echo "Exit code: $?"
>From 66dccd7e0495c8c0dc8110c4991c6883812d7b1a Mon Sep 17 00:00:00 2001
From: intrigeri <intrig...@debian.org>
Date: Wed, 4 Mar 2015 20:27:19 +0000
Subject: [PATCH 1/2] 
 Fixed-bug-that-caused-spurious-1-exit-condition-in-g.patch: new patch,
 cherry-picked from upstream, that fixes spurious non-zero exit code in many
 cases.

---
 ...hat-caused-spurious-1-exit-condition-in-g.patch | 44 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 2 files changed, 45 insertions(+)
 create mode 100644 debian/patches/Fixed-bug-that-caused-spurious-1-exit-condition-in-g.patch

diff --git a/debian/patches/Fixed-bug-that-caused-spurious-1-exit-condition-in-g.patch b/debian/patches/Fixed-bug-that-caused-spurious-1-exit-condition-in-g.patch
new file mode 100644
index 0000000..fa71cd4
--- /dev/null
+++ b/debian/patches/Fixed-bug-that-caused-spurious-1-exit-condition-in-g.patch
@@ -0,0 +1,44 @@
+From: "Roderick W. Smith" <rodsm...@rodsbooks.com>
+Date: Sat, 29 Mar 2014 00:45:59 -0400
+Origin: http://sourceforge.net/p/gptfdisk/code/ci/a920398fa393f9d6301b32b191bc01e086ab8bc8
+Bug: http://sourceforge.net/p/gptfdisk/mailman/message/32068566/
+Subject: Fixed bug that caused spurious "1" exit condition in gdisk.
+
+---
+ gdisk.cc | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/gdisk.cc b/gdisk.cc
+index b3c6240..5768869 100644
+--- a/gdisk.cc
++++ b/gdisk.cc
+@@ -15,6 +15,7 @@ int main(int argc, char* argv[]) {
+    GPTDataTextUI theGPT;
+    string device = "";
+    UnicodeString uString;
++   int isError = 0;
+ 
+    cout << "GPT fdisk (gdisk) version " << GPTFDISK_VERSION << "\n\n";
+ 
+@@ -47,16 +48,20 @@ int main(int argc, char* argv[]) {
+             device = (string) argv[1];
+          } else { // 3 arguments, but none is "-l"
+             cerr << "Usage: " << argv[0] << " [-l] device_file\n";
++            isError = 1;
+          } // if/elseif/else
+          if (device != "") {
+             theGPT.JustLooking();
+             if (theGPT.LoadPartitions(device))
+                theGPT.DisplayGPTData();
++            else
++               isError = 1;
+          } // if
+          break;
+       default:
+          cerr << "Usage: " << argv[0] << " [-l] device_file\n";
++         isError = 1;
+          break;
+    } // switch
+-   return 1 ;
++   return (isError);
+ } // main
diff --git a/debian/patches/series b/debian/patches/series
index 0fdf244..ec30c99 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -4,3 +4,4 @@ manpages.diff
 kfreebsd_character_devices.diff
 fix-change_disk_uid-test.diff
 enable_make_test.diff
+Fixed-bug-that-caused-spurious-1-exit-condition-in-g.patch
-- 
2.1.4

>From 8ff57fcf6e39d16e4e5d789309dc3e070992918c Mon Sep 17 00:00:00 2001
From: intrigeri <intrig...@debian.org>
Date: Wed, 4 Mar 2015 20:29:45 +0000
Subject: [PATCH 2/2] gdisk (0.8.10-1.1)

---
 debian/changelog | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index bf5abfd..0077b17 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+gdisk (0.8.10-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fixed-bug-that-caused-spurious-1-exit-condition-in-g.patch: new patch,
+    cherry-picked from upstream, that fixes spurious non-zero exit code
+    in many cases.
+
+ -- intrigeri <intrig...@debian.org>  Wed, 04 Mar 2015 21:28:11 +0100
+
 gdisk (0.8.10-1) unstable; urgency=medium
 
   * New upstream release:
-- 
2.1.4


--- End Message ---
--- Begin Message ---
Source: gdisk
Source-Version: 0.8.10-2

We believe that the bug you reported is fixed in the latest version of
gdisk, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 779...@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Guillaume Delacour <g...@iroqwa.org> (supplier of updated gdisk package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmas...@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Sun, 15 Mar 2015 10:36:14 CET
Source: gdisk
Binary: gdisk gdisk-noicu
Architecture: source amd64 all
Version: 0.8.10-2
Distribution: unstable
Urgency: medium
Maintainer: Guillaume Delacour <g...@iroqwa.org>
Changed-By: Guillaume Delacour <g...@iroqwa.org>
Description:
 gdisk      - GPT fdisk text-mode partitioning tool
 gdisk-noicu - transitional dummy package
Closes: 779797
Changes:
 gdisk (0.8.10-2) unstable; urgency=medium
 .
   [ intrigeri ]
   * Fixed-bug-that-caused-spurious-1-exit-condition-in-g.patch: new patch,
     cherry-picked from upstream, that fixes spurious non-zero exit code
     in many cases. (Closes: #779797)
 .
   [ Guillaume Delacour ]
   * Test partition table creation return code in upstream testsuite just to
     be sure the bug is fixed
Checksums-Sha256: 
 c6048327ba8df82cfb4bc949a3e7452ec35311cba29114b1a741b3aa35b18df1 1888 
gdisk_0.8.10-2.dsc
 31198cc28a248836a9f25f6d5812aad3a9641d45f5eb824fc70f4b344de5257c 6652 
gdisk_0.8.10-2.debian.tar.xz
Checksums-Sha1: 
 806c07f4546b0427df27789b0f468156d3ea6fe5 1888 gdisk_0.8.10-2.dsc
 96264d49401c7eb18c225e9102358cd9add29ce2 6652 gdisk_0.8.10-2.debian.tar.xz
Files: 
 d4063dd42808d72df9d0199a5918d660 1888 admin extra gdisk_0.8.10-2.dsc
 7152933d1a4bd90f58cb9ae2767cd0cf 6652 admin extra gdisk_0.8.10-2.debian.tar.xz

-----BEGIN PGP SIGNATURE-----

iQIcBAEBCgAGBQJVBVL/AAoJEA3CYk+oqzceNBUP/j+kS7qOetJFh8B9OVqyQNPS
ZiB1EDY1tUKW9Yw1+c1vmtvHx61RbAW6m5qi1N0jVbFtPiVHY3f1+Y4l4YoQkyrT
8dNoPGu2zi1V8hShLnP1ISVwAIIMeJLkW9BOOtmmadGQuOdSz5reg3mL+0Oeh/aX
YE2oQo4KGZfmQans2KP6SxhaPvKFT2UwnPCwmpEp53qs3gRKPm5XTfKy/9yJlkr0
F0+3jrzlchuLhVfkaEahxod0aingSfmICOQNqEvjHyrwWpGaZGSMtjVq6FkJPLXl
ZgHoDj1SyG+0ckUS3NDGQYlVubXQ11K8ocvaicjdFTB/Mr0KUyElDNrNOH/dNtq2
3zg/r2oW5lAaIVuK5nkX3Llvpw+6d6LcPEb+aOjkn2f+C2aw4zasBY2voIhQBCcU
86/NWMFOv45s2iFgFoafQ7QahPJUqGG1j+4nhnOiODARWQoHACE+kQu36PmsWln0
H9ln19aU3L1D8jU09plgO+wId9HqqYLV6xlhfbkyqFbbdG9w3tL3IeqFSMwU0PM2
p5tagm/zS65NnYljaFxnyIKE3h1ETFjoDX+naGbau6VNw02JYVR+/63nFtVxlp+l
QPEP6G2GvLHjRIVboSTAeWkPREuk/AzZdyIHR5kOGwwhwC5RPgc1i9PY/kdh8/kD
FM8jqXYZzTTMvyXh0lU3
=5+gP
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to