Update file system specific validation of RFC 4122 UUIDs
Use the new RFC 4122 none Nil UUID regular expression to validate the UUID read in all the Linux native file system specific read_uuid() methods. No longer need to explicitly exclude "<none>" or all zeros Nil UUID as the regular expression does this.
This commit is contained in:
parent
aa16bf5451
commit
4f235ecb06
|
@ -285,7 +285,7 @@ void btrfs::read_uuid( Partition & partition )
|
||||||
exit_status = Utils::execute_command( "btrfs filesystem show " + partition .get_path(), output, error, true ) ;
|
exit_status = Utils::execute_command( "btrfs filesystem show " + partition .get_path(), output, error, true ) ;
|
||||||
if ( ! exit_status )
|
if ( ! exit_status )
|
||||||
{
|
{
|
||||||
partition .uuid = Utils::regexp_label( output, "uuid:[[:blank:]]*([^[:space:]]*)" );
|
partition .uuid = Utils::regexp_label( output, "uuid:[[:blank:]]*(" RFC4122_NONE_NIL_UUID_REGEXP ")" ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -293,7 +293,7 @@ void btrfs::read_uuid( Partition & partition )
|
||||||
exit_status = Utils::execute_command( "btrfs-show " + partition .get_path(), output, error, true ) ;
|
exit_status = Utils::execute_command( "btrfs-show " + partition .get_path(), output, error, true ) ;
|
||||||
if ( ! exit_status )
|
if ( ! exit_status )
|
||||||
{
|
{
|
||||||
partition .uuid = Utils::regexp_label( output, "uuid:[[:blank:]]*([^[:space:]]*)" );
|
partition .uuid = Utils::regexp_label( output, "uuid:[[:blank:]]*(" RFC4122_NONE_NIL_UUID_REGEXP ")" ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( exit_status )
|
if ( exit_status )
|
||||||
|
|
|
@ -123,10 +123,7 @@ void ext2::read_uuid( Partition & partition )
|
||||||
{
|
{
|
||||||
if ( ! Utils::execute_command( "tune2fs -l " + partition .get_path(), output, error, true ) )
|
if ( ! Utils::execute_command( "tune2fs -l " + partition .get_path(), output, error, true ) )
|
||||||
{
|
{
|
||||||
partition .uuid = Utils::regexp_label( output, "^Filesystem UUID:[[:blank:]]*([^[:space:]]*)" ) ;
|
partition .uuid = Utils::regexp_label( output, "^Filesystem UUID:[[:blank:]]*(" RFC4122_NONE_NIL_UUID_REGEXP ")" ) ;
|
||||||
if (partition .uuid == "<none>")
|
|
||||||
partition .uuid .clear() ;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -124,9 +124,7 @@ void ext3::read_uuid( Partition & partition )
|
||||||
{
|
{
|
||||||
if ( ! Utils::execute_command( "tune2fs -l " + partition .get_path(), output, error, true ) )
|
if ( ! Utils::execute_command( "tune2fs -l " + partition .get_path(), output, error, true ) )
|
||||||
{
|
{
|
||||||
partition .uuid = Utils::regexp_label( output, "^Filesystem UUID:[[:blank:]]*([^[:space:]]*)" ) ;
|
partition .uuid = Utils::regexp_label( output, "^Filesystem UUID:[[:blank:]]*(" RFC4122_NONE_NIL_UUID_REGEXP ")" ) ;
|
||||||
if (partition .uuid == "<none>")
|
|
||||||
partition .uuid .clear() ;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -127,9 +127,7 @@ void ext4::read_uuid( Partition & partition )
|
||||||
{
|
{
|
||||||
if ( ! Utils::execute_command( "tune2fs -l " + partition .get_path(), output, error, true ) )
|
if ( ! Utils::execute_command( "tune2fs -l " + partition .get_path(), output, error, true ) )
|
||||||
{
|
{
|
||||||
partition .uuid = Utils::regexp_label( output, "^Filesystem UUID:[[:blank:]]*([^[:space:]]*)" ) ;
|
partition .uuid = Utils::regexp_label( output, "^Filesystem UUID:[[:blank:]]*(" RFC4122_NONE_NIL_UUID_REGEXP ")" ) ;
|
||||||
if (partition .uuid == "<none>")
|
|
||||||
partition .uuid .clear() ;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -130,9 +130,7 @@ void jfs::read_uuid( Partition & partition )
|
||||||
{
|
{
|
||||||
if ( ! Utils::execute_command( "jfs_tune -l " + partition .get_path(), output, error, true ) )
|
if ( ! Utils::execute_command( "jfs_tune -l " + partition .get_path(), output, error, true ) )
|
||||||
{
|
{
|
||||||
partition .uuid = Utils::regexp_label( output, "^File system UUID:[[:blank:]]*([^[:space:]]+)" ) ;
|
partition .uuid = Utils::regexp_label( output, "^File system UUID:[[:blank:]]*(" RFC4122_NONE_NIL_UUID_REGEXP ")" ) ;
|
||||||
if ( partition .uuid == "00000000-0000-0000-0000-000000000000" )
|
|
||||||
partition .uuid .clear() ;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -95,7 +95,7 @@ void linux_swap::read_uuid( Partition & partition )
|
||||||
{
|
{
|
||||||
if ( ! Utils::execute_command( "swaplabel " + partition .get_path(), output, error, true ) )
|
if ( ! Utils::execute_command( "swaplabel " + partition .get_path(), output, error, true ) )
|
||||||
{
|
{
|
||||||
partition .uuid = Utils::regexp_label( output, "^UUID:[[:blank:]]*([^[:space:]]*)" ) ;
|
partition .uuid = Utils::regexp_label( output, "^UUID:[[:blank:]]*(" RFC4122_NONE_NIL_UUID_REGEXP ")" ) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -130,9 +130,7 @@ void nilfs2::read_uuid( Partition & partition )
|
||||||
{
|
{
|
||||||
if ( ! Utils::execute_command( "nilfs-tune -l " + partition .get_path(), output, error, true ) )
|
if ( ! Utils::execute_command( "nilfs-tune -l " + partition .get_path(), output, error, true ) )
|
||||||
{
|
{
|
||||||
partition .uuid = Utils::regexp_label( output, "^Filesystem UUID:[[:blank:]]*([^[:space:]]*)" ) ;
|
partition .uuid = Utils::regexp_label( output, "^Filesystem UUID:[[:blank:]]*(" RFC4122_NONE_NIL_UUID_REGEXP ")" ) ;
|
||||||
if (partition .uuid == "00000000-0000-0000-0000-000000000000")
|
|
||||||
partition .uuid .clear() ;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -117,7 +117,7 @@ void reiser4::read_uuid( Partition & partition )
|
||||||
{
|
{
|
||||||
if ( ! Utils::execute_command( "debugfs.reiser4 " + partition .get_path(), output, error, true ) )
|
if ( ! Utils::execute_command( "debugfs.reiser4 " + partition .get_path(), output, error, true ) )
|
||||||
{
|
{
|
||||||
partition .uuid = Utils::regexp_label( output, "uuid:[[:blank:]]*([^[:space:]]*)" ) ;
|
partition .uuid = Utils::regexp_label( output, "uuid:[[:blank:]]*(" RFC4122_NONE_NIL_UUID_REGEXP ")" ) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -145,9 +145,7 @@ void xfs::read_uuid( Partition & partition )
|
||||||
{
|
{
|
||||||
if ( ! Utils::execute_command( "xfs_admin -u " + partition .get_path(), output, error, true ) )
|
if ( ! Utils::execute_command( "xfs_admin -u " + partition .get_path(), output, error, true ) )
|
||||||
{
|
{
|
||||||
partition .uuid = Utils::regexp_label( output, "^UUID[[:blank:]]*=[[:blank:]]*([^[:space:]]*)" ) ;
|
partition .uuid = Utils::regexp_label( output, "^UUID[[:blank:]]*=[[:blank:]]*(" RFC4122_NONE_NIL_UUID_REGEXP ")" ) ;
|
||||||
if (partition .uuid == "00000000-0000-0000-0000-000000000000")
|
|
||||||
partition .uuid .clear() ;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue