[master 19/21] Make util.get_sysfs_attr() strip trailing NUL characters.
vathpela
installerbot-noreply at redhat.com
Wed Oct 7 20:50:54 UTC 2015
From: Peter Jones <pjones at redhat.com>
Because sysfs doesn't report real file sizes, but instead everything is
one page, if you rsync files from it, they wind up with most of a page
of NUL characters at the end.
So make it strip those.
Signed-off-by: Peter Jones <pjones at redhat.com>
---
blivet/util.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/blivet/util.py b/blivet/util.py
index 302861e..c297be3 100644
--- a/blivet/util.py
+++ b/blivet/util.py
@@ -211,7 +211,7 @@ def get_sysfs_attr(path, attr):
log.warning("%s is not a valid attribute", attr)
return None
- return open(attribute, "r").read().strip()
+ return open(attribute, "r").read().strip('\0').strip()
def get_sysfs_path_by_name(dev_node, class_name="block"):
""" Return sysfs path for a given device.
--
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/e4787c7753d4db83488c61543d16afde42bf899d
More information about the anaconda-patches
mailing list