[gparted] Stop trying to access device '/dev/mapper/No RAID disks' (#786031)
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Stop trying to access device '/dev/mapper/No RAID disks' (#786031)
- Date: Mon, 1 Apr 2019 15:13:29 +0000 (UTC)
commit fc5cc1d3b460110d0709eb9bba00369ab779ec45
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date: Fri Mar 29 11:07:29 2019 +0000
Stop trying to access device '/dev/mapper/No RAID disks' (#786031)
Running GParted on AltLinux with dmraid installed but with no configured
RAID arrays produces this error:
# gparted
...
Could not stat device /dev/mapper/No RAID disks - No such file or directory.
Most distributions use dmraid 1.0.0.rc16 which reports no raid disks
like this:
# dmraid -sa -c
no raid disks
# echo $?
1
However AltLinux had the slightly older version, dmraid 1.0.0.rc14,
which reported no raid disks like this:
# dmraid -sa -c
No RAID disks
# echo $?
0
So because dmraid 1.0.0.rc14 reported success, exit status 0, and the
"No RAID disks" message was not in lower case, that text was considered
a disk device in a DMRaid array. Fix by checking for "no raid disks" in
any case.
Bug 786031 - Could not stat device /dev/mapper/No RAID disks - No such
file or directory
src/DMRaid.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/DMRaid.cc b/src/DMRaid.cc
index c003ab17..47e75a92 100644
--- a/src/DMRaid.cc
+++ b/src/DMRaid.cc
@@ -22,6 +22,7 @@
#include <glibmm/miscutils.h>
#include <glibmm/fileutils.h>
#include <glibmm/shell.h>
+#include <glibmm/ustring.h>
namespace GParted
@@ -75,8 +76,7 @@ void DMRaid::load_dmraid_cache()
{
if ( ! Utils::execute_command( "dmraid -sa -c", output, error, true ) )
{
- Glib::ustring temp = Utils::regexp_label( output, "^(no raid disks).*" ) ;
- if ( temp != "no raid disks" )
+ if (output.substr(0, 13).lowercase() != "no raid disks")
Utils::tokenize( output, dmraid_devices, "\n" ) ;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]