Skip to contentSkip to conversation

fstests: Fix duplicate CLI arguments in fssum

PATCH Superseded Arvind Raghavan 1 participant 2 messages Apr 28, 2020 – Apr 30, 2020

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fstests: Fix duplicate CLI arguments in fssum

fssum currently has a duplicate '-x' flag. This patch renames one of the duplicate flags and makes the appropriate doc changes.

---
 src/fssum.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
src/fssum.c +6 -4
index a243839a..b49ba59b 100644
@@ -150,9 +150,9 @@ usage(void)
 	fprintf(stderr, "    -[UGOAMCDXES]: exclude respective field from calculation\n");
 	fprintf(stderr, "    -n          : reset all flags\n");
 	fprintf(stderr, "    -N          : set all flags\n");
-	fprintf(stderr, "    -x path     : exclude path when building checksum (multiple ok)\n");
+	fprintf(stderr, "    -i path     : ignore path when building checksum (multiple ok)\n");
 	fprintf(stderr, "    -h          : this help\n\n");
-	fprintf(stderr, "The default field mask is ugoamCdES. If the checksum/manifest is read from a\n");
+	fprintf(stderr, "The default field mask is ugoamCdxES. If the checksum/manifest is read from a\n");
 	fprintf(stderr, "file, the mask is taken from there and the values given on the command line\n");
 	fprintf(stderr, "are ignored.\n");
 	exit(-1);
@@ -713,7 +713,7 @@ main(int argc, char *argv[])
 	int plen;
 	int elen;
 	int n_flags = 0;
-	const char *allopts = "heEfuUgGoOaAmMcCdDsSnNw:r:vx:";
+	const char *allopts = "heEfuUgGoOaAmMcCdDxXsSnNw:r:vi:";
 
 	out_fp = stdout;
 	while ((c = getopt(argc, argv, allopts)) != EOF) {
@@ -735,6 +735,8 @@ main(int argc, char *argv[])
 		case 'C':
 		case 'd':
 		case 'D':
+		case 'x':
+		case 'X':
 		case 'e':
 		case 'E':
 		case 's':
@@ -768,7 +770,7 @@ main(int argc, char *argv[])
 				exit(-1);
 			}
 			break;
-		case 'x':
+		case 'i':
 			++n_excludes;
 			excludes = realloc(excludes,
 					   sizeof(*excludes) * n_excludes);
Signature · 1 line
2.20.1
#1 lore raw

Looking around the xfstest repo, I realized that there are in fact test cases that use the '-x' flag in fssum to exclude paths, so this patch breaks them. I'll send out a V2 that preserves the behavior of '-x' and renames the other flag.

Quoted 57 lines · Arvind Raghavan

fssum currently has a duplicate '-x' flag. This patch renames one of the duplicate flags and makes the appropriate doc changes.

---
 src/fssum.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
src/fssum.c +6 -5
index a243839a..b49ba59b 100644
@@ -150,9 +150,9 @@ usage(void)
        fprintf(stderr, "    -[UGOAMCDXES]: exclude respective field from calculation\n");
        fprintf(stderr, "    -n          : reset all flags\n");
        fprintf(stderr, "    -N          : set all flags\n");
-       fprintf(stderr, "    -x path     : exclude path when building checksum (multiple ok)\n");
+       fprintf(stderr, "    -i path     : ignore path when building checksum (multiple ok)\n");
        fprintf(stderr, "    -h          : this help\n\n");
-       fprintf(stderr, "The default field mask is ugoamCdES. If the checksum/manifest is read from a\n");
+       fprintf(stderr, "The default field mask is ugoamCdxES. If the checksum/manifest is read from a\n");
        fprintf(stderr, "file, the mask is taken from there and the values given on the command line\n");
        fprintf(stderr, "are ignored.\n");
        exit(-1);
@@ -713,7 +713,7 @@ main(int argc, char *argv[])
        int plen;
        int elen;
        int n_flags = 0;
-       const char *allopts = "heEfuUgGoOaAmMcCdDsSnNw:r:vx:";
+       const char *allopts = "heEfuUgGoOaAmMcCdDxXsSnNw:r:vi:";
 
        out_fp = stdout;
        while ((c = getopt(argc, argv, allopts)) != EOF) {
@@ -735,6 +735,8 @@ main(int argc, char *argv[])
                case 'C':
                case 'd':
                case 'D':
+               case 'x':
+               case 'X':
                case 'e':
                case 'E':
                case 's':
@@ -768,7 +770,7 @@ main(int argc, char *argv[])
                                exit(-1);
                        }
                        break;
-               case 'x':
+               case 'i':
                        ++n_excludes;
                        excludes = realloc(excludes,
                                           sizeof(*excludes) * n_excludes);
--

2.20.1