Linux-ext4 Archive mirror
 help / color / mirror / Atom feed
* [e2fsprogs PATCH] tune2fs: fix setting fsuuid::fsu_len
@ 2023-01-04  9:04 Eric Biggers
  2023-01-04 10:36 ` Lukas Czerner
  2023-01-05 19:03 ` Jeremy Bongio
  0 siblings, 2 replies; 4+ messages in thread
From: Eric Biggers @ 2023-01-04  9:04 UTC (permalink / raw
  To: linux-ext4; +Cc: Jeremy Bongio

From: Eric Biggers <ebiggers@google.com>

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 <bongiojp@gmail.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 misc/tune2fs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index 088f87e5..7937b8b5 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [e2fsprogs PATCH] tune2fs: fix setting fsuuid::fsu_len
  2023-01-04  9:04 [e2fsprogs PATCH] tune2fs: fix setting fsuuid::fsu_len Eric Biggers
@ 2023-01-04 10:36 ` Lukas Czerner
       [not found]   ` <CAOvQCn6r83snFOsX78F3BSV9GaNJ-mWPUgQmdrQ0_nA+nvHWVQ@mail.gmail.com>
  2023-01-05 19:03 ` Jeremy Bongio
  1 sibling, 1 reply; 4+ messages in thread
From: Lukas Czerner @ 2023-01-04 10:36 UTC (permalink / raw
  To: Eric Biggers; +Cc: linux-ext4, Jeremy Bongio

On Wed, Jan 04, 2023 at 01:04:01AM -0800, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> 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!

Reviewed-by: Lukas Czerner <lczerner@redhat.com>

> 
> Fixes: a83e199da0ca ("tune2fs: Add support for get/set UUID ioctls.")
> Cc: Jeremy Bongio <bongiojp@gmail.com>
> Signed-off-by: Eric Biggers <ebiggers@google.com>
> ---
>  misc/tune2fs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/misc/tune2fs.c b/misc/tune2fs.c
> index 088f87e5..7937b8b5 100644
> --- a/misc/tune2fs.c
> +++ b/misc/tune2fs.c
> @@ -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
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [e2fsprogs PATCH] tune2fs: fix setting fsuuid::fsu_len
  2023-01-04  9:04 [e2fsprogs PATCH] tune2fs: fix setting fsuuid::fsu_len Eric Biggers
  2023-01-04 10:36 ` Lukas Czerner
@ 2023-01-05 19:03 ` Jeremy Bongio
  1 sibling, 0 replies; 4+ messages in thread
From: Jeremy Bongio @ 2023-01-05 19:03 UTC (permalink / raw
  To: Eric Biggers; +Cc: linux-ext4

Thanks for catching that!

Reviewed-by: Jeremy Bongio <bongiojp@gmail.com>

On Wed, Jan 4, 2023 at 1:04 AM Eric Biggers <ebiggers@kernel.org> wrote:
>
> From: Eric Biggers <ebiggers@google.com>
>
> 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 <bongiojp@gmail.com>
> Signed-off-by: Eric Biggers <ebiggers@google.com>
> ---
>  misc/tune2fs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/misc/tune2fs.c b/misc/tune2fs.c
> index 088f87e5..7937b8b5 100644
> --- a/misc/tune2fs.c
> +++ b/misc/tune2fs.c
> @@ -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
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [e2fsprogs PATCH] tune2fs: fix setting fsuuid::fsu_len
       [not found]   ` <CAOvQCn6r83snFOsX78F3BSV9GaNJ-mWPUgQmdrQ0_nA+nvHWVQ@mail.gmail.com>
@ 2023-01-05 19:28     ` Eric Biggers
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Biggers @ 2023-01-05 19:28 UTC (permalink / raw
  To: Theodore Ts'o; +Cc: Lukas Czerner, linux-ext4, Jeremy Bongio, Jeremy Bongio

On Thu, Jan 05, 2023 at 10:53:07AM -0800, Jeremy Bongio wrote:
> Thanks for catching that!
> 
> Reviewed-by: Jeremy Bongio <bongiojp@gmail.com>
> 
> On Wed, Jan 4, 2023 at 2:39 AM Lukas Czerner <lczerner@redhat.com> wrote:
> 
> > On Wed, Jan 04, 2023 at 01:04:01AM -0800, Eric Biggers wrote:
> > > From: Eric Biggers <ebiggers@google.com>
> > >
> > > 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-05 19:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-04  9:04 [e2fsprogs PATCH] tune2fs: fix setting fsuuid::fsu_len Eric Biggers
2023-01-04 10:36 ` Lukas Czerner
     [not found]   ` <CAOvQCn6r83snFOsX78F3BSV9GaNJ-mWPUgQmdrQ0_nA+nvHWVQ@mail.gmail.com>
2023-01-05 19:28     ` Eric Biggers
2023-01-05 19:03 ` Jeremy Bongio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).