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]
Message-ID: <4BB7AD20.1080307@redhat.com>
Date:	Sat, 03 Apr 2010 16:03:28 -0500
From:	Eric Sandeen <sandeen@...hat.com>
To:	ext4 development <linux-ext4@...r.kernel.org>
Subject: [PATCH] e2fsck: make -y -y answer "no" to Abort?

RH Bug 484913 - Change verbage of e2fsck questioning to make the "-y"
switch more useful

demonstrates:

sh-3.2# e2fsck -y /dev/VolGroup00/VolVol02
e2fsck 1.41.3 (12-Oct-2008)
The filesystem size (according to the superblock) is 14090240 blocks
The physical size of the device is 8847360 blocks
Either the superblock or the partition table is likely to be corrupt!

Abort? yes

"-y" generally means yes, take the corrective action but in this
case it stops fsck.

Below is a little hacky, but makes -y -y answer "no" to "Abort?"

I'm open to a better method if anyone has a suggestion.

Signed-off-by: Eric Sandeen <sandeen@...hat.com>
---

diff --git a/e2fsck/e2fsck.8.in b/e2fsck/e2fsck.8.in
index 3fb15e6..98c309e 100644
--- a/e2fsck/e2fsck.8.in
+++ b/e2fsck/e2fsck.8.in
@@ -292,7 +292,7 @@ may not be specified at the same time as the
 .B \-n
 or
 .B \-p
-options.
+options.  If given twice, will answer `no' to any `Abort?' question.
 .SH EXIT CODE
 The exit code returned by
 .B e2fsck
diff --git a/e2fsck/e2fsck.h b/e2fsck/e2fsck.h
index e763b89..2881654 100644
--- a/e2fsck/e2fsck.h
+++ b/e2fsck/e2fsck.h
@@ -155,6 +155,7 @@ struct resource_track {
 #define E2F_OPT_WRITECHECK	0x0200
 #define E2F_OPT_COMPRESS_DIRS	0x0400
 #define E2F_OPT_FRAGCHECK	0x0800
+#define E2F_OPT_YESYES		0x1000
 
 /*
  * E2fsck flags
diff --git a/e2fsck/problem.c b/e2fsck/problem.c
index 9043281..c12a70f 100644
--- a/e2fsck/problem.c
+++ b/e2fsck/problem.c
@@ -1843,9 +1843,20 @@ int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx)
 				answer = 1;
 			else
 				answer = 0;
-		} else
-			answer = ask(ctx, (ptr->prompt == PROMPT_NULL) ? "" :
+		} else {
+			/*
+			 * yesmeansno:
+			 * e2fsck -y -y really means yes, don't abort!
+			 */
+			if ((ptr->prompt == PROMPT_ABORT) &&
+			    (ctx->options & E2F_OPT_YESYES)) {
+				printf (_("%s? no\n\n"), _(prompt[(int) ptr->prompt]));
+                		answer = 0;
+			} else {
+				answer = ask(ctx, (ptr->prompt == PROMPT_NULL) ? "" :
 				     _(prompt[(int) ptr->prompt]), def_yn);
+			}
+		}
 		if (!answer && !(ptr->flags & PR_NO_OK))
 			ext2fs_unmark_valid(fs);
 
diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index d53921a..d01b3cb 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -709,6 +709,10 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
 		case 'y':
 			if (ctx->options & (E2F_OPT_PREEN|E2F_OPT_NO))
 				goto conflict_opt;
+			if (ctx->options & (E2F_OPT_YES)) {
+				printf("yesyes\n");
+				ctx->options |= E2F_OPT_YESYES;
+			}
 			ctx->options |= E2F_OPT_YES;
 			break;
 		case 't':

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ