From: Eric Sandeen <sandeen@redhat.com>
To: ext4 development <linux-ext4@vger.kernel.org>
Subject: [PATCH] e2fsck: make -y -y answer "no" to Abort?
Date: Sat, 03 Apr 2010 16:03:28 -0500 [thread overview]
Message-ID: <4BB7AD20.1080307@redhat.com> (raw)
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@redhat.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':
next reply other threads:[~2010-04-03 21:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-03 21:03 Eric Sandeen [this message]
2010-05-12 23:02 ` [PATCH] e2fsck: make -y -y answer "no" to Abort? tytso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4BB7AD20.1080307@redhat.com \
--to=sandeen@redhat.com \
--cc=linux-ext4@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).