lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 26 Apr 2019 16:09:13 +0300
From:   Artem Blagodarenko <artem.blagodarenko@...il.com>
To:     linux-ext4@...r.kernel.org
Cc:     alexey.lyashkov@...il.com, Alexey Lyashkov <c17817@...y.com>
Subject: [PATCH] e2fsck: Do not to be quiet if verbose option used.

From: Alexey Lyashkov <c17817@...y.com>

e2fsck don't print a message if 'p' option used and error can be fixed without
user assistance,  but 'v' option asks to be more verbose, so user expect to
see any output. But not.
Fix this, by avoid message suppress with verbose option used.

Change-Id: I358e9b04e44dd33fdb124c5663b2df0bf54ce370
Signed-off-by: Alexey Lyashkov <c17817@...y.com>
Cray-bug-id: LUS-6890
---
 e2fsck/e2fsck.h  |  1 +
 e2fsck/problem.c |  3 ++-
 e2fsck/unix.c    | 15 ++++++++-------
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/e2fsck/e2fsck.h b/e2fsck/e2fsck.h
index 1c7a67cb..64140fc3 100644
--- a/e2fsck/e2fsck.h
+++ b/e2fsck/e2fsck.h
@@ -174,6 +174,7 @@ struct resource_track {
 #define E2F_OPT_NOOPT_EXTENTS	0x10000 /* don't optimize extents */
 #define E2F_OPT_ICOUNT_FULLMAP	0x20000 /* use an array for inode counts */
 #define E2F_OPT_UNSHARE_BLOCKS  0x40000
+#define E2F_OPT_VERBOSE		0x80000 /* be verbose and PREEN_NOMSG ignore */
 
 /*
  * E2fsck flags
diff --git a/e2fsck/problem.c b/e2fsck/problem.c
index 0e6bacec..2576c9bb 100644
--- a/e2fsck/problem.c
+++ b/e2fsck/problem.c
@@ -2259,7 +2259,8 @@ int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx)
 		if (ldesc->flags & PRL_SUPPRESS)
 			suppress++;
 	}
-	if ((ptr->flags & PR_PREEN_NOMSG) &&
+	if (((ctx->options & E2F_OPT_VERBOSE) == 0) &&
+	    (ptr->flags & PR_PREEN_NOMSG) &&
 	    (ctx->options & E2F_OPT_PREEN))
 		suppress++;
 	if ((ptr->flags & PR_NO_NOMSG) &&
diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index 5b3552ec..b073615e 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -60,7 +60,6 @@ extern int optind;
 /* Command line options */
 static int cflag;		/* check disk */
 static int show_version_only;
-static int verbose;
 
 static int replace_bad_blocks;
 static int keep_bad_blocks;
@@ -133,7 +132,7 @@ static void show_stats(e2fsck_t	ctx)
 		frag_percent_total = (frag_percent_total + 5) / 10;
 	}
 
-	if (!verbose) {
+	if ((ctx->options & E2F_OPT_VERBOSE) == 0) {
 		log_out(ctx, _("%s: %u/%u files (%0d.%d%% non-contiguous), "
 			       "%llu/%llu blocks\n"),
 			ctx->device_name, inodes_used, inodes,
@@ -143,7 +142,7 @@ static void show_stats(e2fsck_t	ctx)
 	}
 	profile_get_boolean(ctx->profile, "options", "report_features", 0, 0,
 			    &i);
-	if (verbose && i) {
+	if ((ctx->options & E2F_OPT_VERBOSE) && i) {
 		log_out(ctx, "\nFilesystem features:");
 		mask = &ctx->fs->super->s_feature_compat;
 		for (i = 0; i < 3; i++, mask++) {
@@ -807,6 +806,7 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
 	char 		*jbd_debug;
 #endif
 	unsigned long long phys_mem_kb;
+	int		verbose = 0;
 
 	retval = e2fsck_allocate_context(&ctx);
 	if (retval)
@@ -1037,8 +1037,8 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
 		ctx->options |= E2F_OPT_TIME | E2F_OPT_TIME2;
 	profile_get_boolean(ctx->profile, "options", "report_verbose", 0, 0,
 			    &c);
-	if (c)
-		verbose = 1;
+	if (c || verbose)
+		ctx->options |= E2F_OPT_VERBOSE;
 
 	profile_get_boolean(ctx->profile, "options", "no_optimize_extents",
 			    0, 0, &c);
@@ -1231,8 +1231,9 @@ static errcode_t e2fsck_check_mmp(ext2_filsys fs, e2fsck_t ctx)
 	if (retval)
 		goto check_error;
 
-	/* Print warning if e2fsck will wait for more than 20 secs. */
-	if (verbose || wait_time > EXT4_MMP_MIN_CHECK_INTERVAL * 4) {
+	/* Print warning if e2fck will wait for more than 20 secs. */
+	if ((ctx->options & E2F_OPT_VERBOSE) ||
+	     wait_time > EXT4_MMP_MIN_CHECK_INTERVAL * 4) {
 		log_out(ctx, _("MMP interval is %u seconds and total wait "
 			       "time is %u seconds. Please wait...\n"),
 			mmp_check_interval, wait_time * 2);
-- 
2.14.3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ