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.
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.
";
+ } else { // bit is not set
+- attributes += bitValue; // so set it
++ attributes |= bitValue; // so set it
+ cout << "Have enabled the '" << atNames[response] << "'
attribute.
";