[rhinstaller/anaconda/pulls/33 f22-branch] master/f22-branch - Set the default fs label when reformatting (#1141981)

mulkieran installerbot-noreply at redhat.com
Wed Mar 11 12:39:38 UTC 2015


We should avoid making use of default labels if we possibly can. Up until now, they have only been used for testing. 

My feeling is that custom_storage_helpers.validate_label should probably have been made a little more informative by indicating what the problematic label is. It seems very unlikely that it is "Unknown",
much more likely that it is "", since HFS+ is pretty permissive _except_ as regards the empty string.

The problem is there is an ambiguity when the empty string is displayed in the label field. It could mean None, i.e., accept the default, or it could mean label with the empty string. Back in the day,
it seemed like the second interpretation was the better, so that's the one I picked. But because there are some filesystems that are not happy w/ the empty string, that looks like it was a mistake and it would be better to interpret
the empty string as None (which is accept the default). That way, it would certainly be valid and HFS+ would do the correct thing.
The only loss would be that users would be prevented from setting the filesystem label to the empty string and might be slightly surprised to find a filesystem label on a filesystem where they hadn't set one. Below is a sample patch that might do the trick (completely untested and so forth):

```
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index 74f48e0..2ac2c31 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -977,8 +977,8 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
         new_device_info["encrypted"] = encrypted
 
         # FS LABEL
-        label = self._labelEntry.get_text()
-        old_label = getattr(device.format, "label", "")
+        label = self._labelEntry.get_text() or None
+        old_label = getattr(device.format, "label", None)
         changed_label = (label != old_label)
         old_device_info["label"] = old_label
         new_device_info["label"] = label
@@ -1475,12 +1475,8 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
         self._mountPointEntry.set_text(getattr(device.format, "mountpoint", "") or "")
         fancy_set_sensitive(self._mountPointEntry, device.format.mountable)
 
-        if hasattr(device.format, "label"):
-            if device.format.label is None:
-                device.format.label = ""
-            self._labelEntry.set_text(device.format.label)
-        else:
-            self._labelEntry.set_text("")
+        # The empty string signifies None, i.e., accept the default label
+        self._labelEntry.set_text(getattr(device.format, "label", ""))
         fancy_set_sensitive(self._labelEntry, True)
 
         self._sizeEntry.set_text(device.size.humanReadable(max_places=self.MAX_SIZE_PLACES))
-- 
2.1.0
```






-- 
To view this pull request on github, visit https://github.com/rhinstaller/anaconda/pull/33


More information about the anaconda-patches mailing list