[PATCH] gdisk patches

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



Hi List,

Below a patch wich fixes two bugs in the gdisk package. They have been submitted uptream but not yet been accepted. The first bug fixed is that partition attributes are read/stored backwards. The second bug fixed is that when changing an undefined attribute no longer junk is displayed.

I'm not sure if this is the right place, but i sent to this list mainly because there is no official gpt fdisk list afai could find. Now this patch has a place on the net.

Cheers!

Greetings/Groetjes

Mark Pustjens

--
diff --git a/extra/gdisk/PKGBUILD b/extra/gdisk/PKGBUILD
index 0664a57..af9b44e 100644
--- a/extra/gdisk/PKGBUILD
+++ b/extra/gdisk/PKGBUILD
@@ -9,10 +9,12 @@ arch=('i686' 'x86_64')
  url="http://www.rodsbooks.com/gdisk";
  depends=('gcc-libs' 'util-linux-ng' 'popt')
  license=('GPL2')
-source=(http://www.rodsbooks.com/gdisk/gdisk-$pkgver.tgz)
+source=(http://www.rodsbooks.com/gdisk/gdisk-$pkgver.tgz
+	gdisk_attributes.patch)

  build() {
   cd $srcdir/$pkgname-$pkgver
+  patch -p1 -i "$srcdir/gdisk_attributes.patch"
    make
    install -D -m755 gdisk $pkgdir/sbin/gdisk
    install -D -m755 sgdisk $pkgdir/sbin/sgdisk
@@ -23,4 +25,6 @@ build() {
    install -D -m644 README $pkgdir/usr/share/gdisk/README
    install -D -m644 NEWS pkgdir/usr/share/gdisk/NEWS
 }
-md5sums=('48740d8de518f79ae9dae7ec58068d05')
+
+md5sums=('48740d8de518f79ae9dae7ec58068d05'
+         '106a4186587ab572f6397ba1702e8d47')
diff --git a/extra/gdisk/gdisk_attributes.patch b/extra/gdisk/gdisk_attributes.patch
new file mode 100644
index 0000000..e03c957
--- /dev/null
+++ b/extra/gdisk/gdisk_attributes.patch
@@ -0,0 +1,29 @@
+diff --git a/attributes.cc b/attributes.cc
+index 527dc87..a7b2afd 100644
+--- a/attributes.cc
++++ b/attributes.cc
+@@ -26,6 +26,7 @@ Attributes::Attributes(void) {
+    // Most bits are undefined, so start by giving them an
+    // appropriate name
+    for (i = 1; i < NUM_ATR; i++) {
++      temp.str(""); // empty stream
+       temp << "Undefined bit #" << i;
+ 	  atNames[i] = temp.str();
+    } // for
+@@ -75,12 +76,12 @@ void Attributes::ChangeAttributes(void) {
+    do {
+ response = GetNumber(0, 64, -1, (string) "Toggle which attribute field (0-63, 64 to exit): ");
+       if (response != 64) {
+- bitValue = PowerOf2(uint32_t (NUM_ATR - response - 1)); // Find the integer value of the bit
+-         if ((bitValue & attributes) == bitValue) { // bit is set
+-            attributes -= bitValue; // so unset it
++         bitValue = 1 << response;
++         if (bitValue & attributes) { // bit is set
++            attributes &= ~bitValue; // so unset it
+ cout << "Have disabled the '" << atNames[response] << "' attribute.\n";
+          } else { // bit is not set
+-            attributes += bitValue; // so set it
++            attributes |= bitValue; // so set it
+ cout << "Have enabled the '" << atNames[response] << "' attribute.\n";
+          } // if/else
+       } // if


[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux