diff mbox

[2/15] e2fsprogs-config-before-cmdline.patch

Message ID 1223289068.4007.84.camel@localhost
State Superseded, archived
Delegated to: Theodore Ts'o
Headers show

Commit Message

Kalpak Shah Oct. 6, 2008, 10:31 a.m. UTC
The patch changes the order that the config file and command line are
parsed so that command line has precedence.  It also adds a check to
make sure only one -E option is passed on the command line as -E option
parsing is not cumulative.

Signed-off-by: Jim Garlick <garlick@llnl.gov>
Signed-off-by: Andreas Dilger <adilger@sun.com>

Comments

Theodore Ts'o Oct. 6, 2008, 8:49 p.m. UTC | #1
On Mon, Oct 06, 2008 at 04:01:08PM +0530, Kalpak Shah wrote:
> The patch changes the order that the config file and command line are
> parsed so that command line has precedence.  It also adds a check to
> make sure only one -E option is passed on the command line as -E option
> parsing is not cumulative.

Hmm.  I wonder if we would be better off making -E option parsing
cumulative, especially if we are going to add a way of specifying some
extended options via the config file.  Comments?

							- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andreas Dilger Oct. 7, 2008, 8:56 a.m. UTC | #2
On Oct 06, 2008  16:49 -0400, Theodore Ts'o wrote:
> On Mon, Oct 06, 2008 at 04:01:08PM +0530, Kalpak Shah wrote:
> > The patch changes the order that the config file and command line are
> > parsed so that command line has precedence.  It also adds a check to
> > make sure only one -E option is passed on the command line as -E option
> > parsing is not cumulative.
> 
> Hmm.  I wonder if we would be better off making -E option parsing
> cumulative, especially if we are going to add a way of specifying some
> extended options via the config file.  Comments?

I've always thought that both -E and -O should be cumulative.

Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" 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

The patch changes the order that the config file and command line are
parsed so that command line has precedence.  It also adds a check to
make sure only one -E option is passed on the command line as -E option
parsing is not cumulative.

Signed-off-by: Jim Garlick <garlick@llnl.gov>
Signed-off-by: Andreas Dilger <adilger@clusterfs.com>

Index: e2fsprogs-1.40.11/e2fsck/unix.c
===================================================================
--- e2fsprogs-1.40.11.orig/e2fsck/unix.c
+++ e2fsprogs-1.40.11/e2fsck/unix.c
@@ -589,7 +589,6 @@  static errcode_t PRS(int argc, char *arg
 #ifdef HAVE_SIGNAL_H
 	struct sigaction	sa;
 #endif
-	char		*extended_opts = 0;
 	char		*cp;
 	int 		res;		/* result of sscanf */
 #ifdef CONFIG_JBD_DEBUG
@@ -620,6 +619,12 @@  static errcode_t PRS(int argc, char *arg
 		ctx->program_name = *argv;
 	else
 		ctx->program_name = "e2fsck";
+
+	if ((cp = getenv("E2FSCK_CONFIG")) != NULL)
+		config_fn[0] = cp;
+	profile_set_syntax_err_cb(syntax_err_report);
+	profile_init(config_fn, &ctx->profile);
+
 	while ((c = getopt (argc, argv, "panyrcC:B:dE:fvtFVM:b:I:j:P:l:L:N:SsDk")) != EOF)
 		switch (c) {
 		case 'C':
@@ -650,7 +655,7 @@  static errcode_t PRS(int argc, char *arg
 			ctx->options |= E2F_OPT_COMPRESS_DIRS;
 			break;
 		case 'E':
-			extended_opts = optarg;
+			parse_extended_opts(ctx, optarg);
 			break;
 		case 'p':
 		case 'a':
@@ -777,13 +782,6 @@  static errcode_t PRS(int argc, char *arg
 		fatal_error(ctx, 0);
 	}
 	ctx->filesystem_name = string_copy(ctx, ctx->filesystem_name, 0);
-	if (extended_opts)
-		parse_extended_opts(ctx, extended_opts);
-
-	if ((cp = getenv("E2FSCK_CONFIG")) != NULL)
-		config_fn[0] = cp;
-	profile_set_syntax_err_cb(syntax_err_report);
-	profile_init(config_fn, &ctx->profile);
 
 	if (flush) {
 		fd = open(ctx->filesystem_name, O_RDONLY, 0);