tune2fs: fix setting fsuuid::fsu_len
PATCH 1/1 tune2fs: fix setting fsuuid::fsu_len
From: Eric Biggers <[email protected]>
Minus does not mean equals.
Besides fixing an obvious bug, this avoids the following compiler warning with clang -Wall:
tune2fs.c:3625:20: warning: expression result unused [-Wunused-value]
fsuuid->fsu_len - UUID_SIZE;
~~~~~~~~~~~~~~~ ^ ~~~~~~~~~--- misc/tune2fs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
misc/tune2fs.c +1 -1
@@ -3622,7 +3622,7 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n" ret =-1 ;#ifdef __linux__if (fsuuid) { - fsuuid->fsu_len -UUID_SIZE ; + fsuuid->fsu_len =UUID_SIZE ; fsuuid->fsu_flags =0 ;memcpy (&fsuuid->fsu_uuid, new_uuid,UUID_SIZE ); ret =ioctl (fd,EXT4_IOC_SETFSUUID , fsuuid);
Signature · 1 line
2.39.0
Quoted 10 lines · Eric Biggers
From: Eric Biggers <[email protected]>
Minus does not mean equals.
Besides fixing an obvious bug, this avoids the following compiler warning with clang -Wall:
tune2fs.c:3625:20: warning: expression result unused [-Wunused-value]
fsuuid->fsu_len - UUID_SIZE; ~~~~~~~~~~~~~~~ ^ ~~~~~~~~~
Looks good, thanks!
Quoted 24 lines
Fixes a83e199da0ca ("tune2fs: Add support for get/set UUID ioctls.")Cc Jeremy Bongio <[email protected]>Signed-off-by Eric Biggers <[email protected]>--- misc/tune2fs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)misc/tune2fs.c +1
-1@@ -3622,7 +3622,7 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n" ret =-1 ;#ifdef __linux__if (fsuuid) { - fsuuid->fsu_len -UUID_SIZE ; + fsuuid->fsu_len =UUID_SIZE ; fsuuid->fsu_flags =0 ;memcpy (&fsuuid->fsu_uuid, new_uuid,UUID_SIZE ); ret =ioctl (fd,EXT4_IOC_SETFSUUID , fsuuid);Signature · 1 line
2.39.0
A message that is not in the archive (sent off-list or not yet received): CAOvQCn6r83snFOsX78F3BSV9GaNJ-mWPUgQmdrQ0_nA+nvHWVQ@mail.gmail.com
Quoted 17 lines · Jeremy Bongio
Thanks for catching that!
Reviewed-by Jeremy Bongio <[email protected]>Quoted 11 lines · Lukas Czerner
Quoted 10 lines · Eric Biggers
From: Eric Biggers <[email protected]>
Minus does not mean equals.
Besides fixing an obvious bug, this avoids the following compiler warning with clang -Wall:
tune2fs.c:3625:20: warning: expression result unused [-Wunused-value]
fsuuid->fsu_len - UUID_SIZE; ~~~~~~~~~~~~~~~ ^ ~~~~~~~~~
The real thanks goes to the compiler for warning about this.
Ted, considering the build warnings (some of which are caused by actual bugs) and build errors that regularly show up in new e2fsprogs releases, have you considered adding some sort of CI to upstream e2fsprogs?
These days, a very common practice for projects on GitHub is to have a ci.yml file in .github/workflows/ci.yml that enables testing with GitHub Actions, and require that it passes before accepting pull requests. That can include enforcing a clean build with -Wall -Werror with both gcc and clang; building for Linux, macOS, and Windows; build and testing on non-x86 architectures; enforcing that the tests pass with sanitization options like ASAN and UBSAN enabled, etc. Here's the one I use for fscryptctl which is pretty basic but shows a few things:
https://github.com/google/fscryptctl/blob/master/.github/workflows/ci.yml
Now, presumably e2fsprogs development isn't about to move to GitHub. However, it's still possible to just push to a fork of the repo on GitHub after applying patches, and get all the results from GitHub Actions.
And it looks like e2fsprogs is already being mirrored at
https://github.com/tytso/e2fsprogs.
Ted, would you be interested in a .github/workflows/ci.yml file for e2fsprogs so that CI results will be available at https://github.com/tytso/e2fsprogs/actions?
- Eric
Thanks for catching that!
Quoted 35 lines · Eric Biggers
From: Eric Biggers <[email protected]>
Minus does not mean equals.
Besides fixing an obvious bug, this avoids the following compiler warning with clang -Wall:
tune2fs.c:3625:20: warning: expression result unused [-Wunused-value]
fsuuid->fsu_len - UUID_SIZE; ~~~~~~~~~~~~~~~ ^ ~~~~~~~~~Fixes a83e199da0ca ("tune2fs: Add support for get/set UUID ioctls.")Cc Jeremy Bongio <[email protected]>Signed-off-by Eric Biggers <[email protected]>--- misc/tune2fs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)misc/tune2fs.c +1
-2@@ -3622,7 +3622,7 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n" ret =-1 ;#ifdef __linux__if (fsuuid) { - fsuuid->fsu_len -UUID_SIZE ; + fsuuid->fsu_len =UUID_SIZE ; fsuuid->fsu_flags =0 ;memcpy (&fsuuid->fsu_uuid, new_uuid,UUID_SIZE ); ret =ioctl (fd,EXT4_IOC_SETFSUUID , fsuuid); --2.39.0