Thread (25 messages) 25 messages, 7 authors, 2011-08-11

Re: [PATCH] Re: [btrfs-progs integration] incorrect argument checking for "btrfs sub snap -r"

From: Tsutomu Itoh <hidden>
Date: 2011-08-11 04:30:48

Hi, Hugo,

I built your for-chris branch, and ran 'btrfs sub snap' command.
Then, I encountered following error message.

  # btrfs sub snap Dir-1 Dir-2
  Invalid arguments for subvolume snapshot

commit:8b4c2a22bff85f86af44587973c8da8c29a67ffc is wrong, I think.

(2011/07/01 21:55), Stephane Chazelas wrote:
quoted hunk ↗ jump to hunk
2011-07-01 11:42:23 +0100, Hugo Mills:
[...]
quoted
quoted
quoted
diff --git a/btrfs.c b/btrfs.c
index e117172..b50c58a 100644
--- a/btrfs.c
+++ b/btrfs.c
@@ -49,7 +49,7 @@ static struct Command commands[] = {
 	/*
 		avoid short commands different for the case only
 	*/
-	{ do_clone, 2,
+	{ do_clone, -2,
 	  "subvolume snapshot", "[-r] <source> [<dest>/]<name>\n"
 		"Create a writable/readonly snapshot of the subvolume <source> with\n"
 		"the name <name> in the <dest> directory.",
diff --git a/btrfs_cmds.c b/btrfs_cmds.c
index 1d18c59..3415afc 100644
--- a/btrfs_cmds.c
+++ b/btrfs_cmds.c
@@ -355,7 +355,7 @@ int do_clone(int argc, char **argv)
 			return 1;
 		}
 	}
-	if (argc - optind < 2) {
+	if (argc - optind != 2) {
 		fprintf(stderr, "Invalid arguments for subvolume snapshot\n");
 		free(argv);
 		return 1;
Thanks for having another look at this. You are perfectly right. Should
we patch my patch or should I rework a corrected version? What do you
think Hugo?
   Could you send a follow-up patch with just the second hunk, please?
I screwed up the process with this (processing patches too quickly to
catch the review), and I've already published the patch with the first
hunk, above, into the for-chris branch.
Hugo, not sure what you mean nor whom you're talking to, but I
can certainly copy-paste the second hunk from above here:
diff --git a/btrfs_cmds.c b/btrfs_cmds.c
index 1d18c59..3415afc 100644
--- a/btrfs_cmds.c
+++ b/btrfs_cmds.c
@@ -355,7 +355,7 @@ int do_clone(int argc, char **argv)
 			return 1;
 		}
 	}
-	if (argc - optind < 2) {
+	if (argc - optind != 2) {
I think that '3' is correct.

Thanks,
Tsutomu
 		fprintf(stderr, "Invalid arguments for subvolume snapshot\n");
 		free(argv);
 		return 1;

Cheers,
Stephane
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help