diff mbox

Bug in a couple of btrfs-progs components

Message ID 20121110083111.25d3fcef@aspire.ty-penguin.org.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Alun Nov. 10, 2012, 8:31 a.m. UTC
Hi,

(I'm not a list member and may not see any responses to this)

I've been using btrfs on my Raspberry Pi. Yesterday I tried to use the
"btrfs scrub" function and, while the scrub started OK, I couldn't run
"btrfs scrub status" to see what was happening. Whenever I ran it, I
just got the command help.

The same command on my x86 box worked OK. Checking out the git sources,
I found that, in a couple of places, "char c" is used to store the
return value from getopt. On the Pi, char is unsigned, so the
subsequent test for getopt returning -1 never succeeds.

I'm attaching a patch to fix this.

Cheers,
Alun.

Comments

Alexander Block Nov. 12, 2012, 6:24 p.m. UTC | #1
On Sat, Nov 10, 2012 at 9:31 AM, Alun <alun.btrfs@ty-penguin.org.uk> wrote:
> Hi,
>
> (I'm not a list member and may not see any responses to this)
>
> I've been using btrfs on my Raspberry Pi. Yesterday I tried to use the
> "btrfs scrub" function and, while the scrub started OK, I couldn't run
> "btrfs scrub status" to see what was happening. Whenever I ran it, I
> just got the command help.
>
> The same command on my x86 box worked OK. Checking out the git sources,
> I found that, in a couple of places, "char c" is used to store the
> return value from getopt. On the Pi, char is unsigned, so the
> subsequent test for getopt returning -1 never succeeds.
>
> I'm attaching a patch to fix this.
>
> Cheers,
> Alun.

We should probably also use -fsigned-char for CFLAGS in the Makefile.
Who knows if there will ever be other places where the signess of char
matters.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --recursive '--context=5' btrfs-progs.orig/cmds-scrub.c btrfs-progs/cmds-scrub.c
*** btrfs-progs.orig/cmds-scrub.c	Sat Nov 10 08:24:33 2012
--- btrfs-progs/cmds-scrub.c	Sat Nov 10 08:24:52 2012
***************
*** 1602,1612 ****
  	};
  	int ret;
  	int i;
  	int print_raw = 0;
  	int do_stats_per_dev = 0;
! 	char c;
  	char fsid[37];
  	int fdres = -1;
  	int err = 0;
  
  	optind = 1;
--- 1602,1612 ----
  	};
  	int ret;
  	int i;
  	int print_raw = 0;
  	int do_stats_per_dev = 0;
! 	int c;
  	char fsid[37];
  	int fdres = -1;
  	int err = 0;
  
  	optind = 1;
diff --recursive '--context=5' btrfs-progs.orig/cmds-send.c btrfs-progs/cmds-send.c
*** btrfs-progs.orig/cmds-send.c	Sat Nov 10 08:24:33 2012
--- btrfs-progs/cmds-send.c	Sat Nov 10 08:24:43 2012
***************
*** 412,422 ****
  }
  
  int cmd_send_start(int argc, char **argv)
  {
  	char *subvol = NULL;
! 	char c;
  	int ret;
  	char *outname = NULL;
  	struct btrfs_send send;
  	u32 i;
  	char *mount_root = NULL;
--- 412,422 ----
  }
  
  int cmd_send_start(int argc, char **argv)
  {
  	char *subvol = NULL;
! 	int c;
  	int ret;
  	char *outname = NULL;
  	struct btrfs_send send;
  	u32 i;
  	char *mount_root = NULL;