On Mar 18, 2014, at 11:11 AM, Phillip Susi <psusi@xxxxxxxxxx> wrote: > mke2fs displays an interactive y/n prompt for certain situations. > This is not appropriate to do when stdin is not a tty. > > Signed-off-by: Phillip Susi <psusi@xxxxxxxxxx> > --- > misc/util.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/misc/util.c b/misc/util.c > index 92ab79f..c469744 100644 > --- a/misc/util.c > +++ b/misc/util.c > @@ -71,6 +71,8 @@ void proceed_question(void) > char buf[256]; > const char *short_yes = _("yY"); > > + if (!isatty(0)) > + return; This means that mke2fs will silently continue to format whatever accidental device was specified on the command line, instead of stopping and asking the user for confirmation. Instead, it should exit with an error in this case. There is already the "-f" (force) option to override the cases where this prompt is used, so if the user wants to do something unusual they should use that as part of the script driving mke2fs. The only time when I think "force" is required when it shouldn't be is in case of full-device formatting. I don't think this should be considered a problem unless there is already a partition table on the device. Formatting the whole device is desirable to avoid alignment issues on RAID devices, so I would be happy if that restriction was lifted. Cheers, Andreas
Attachment:
signature.asc
Description: Message signed with OpenPGP using GPGMail