From ac8105a2910d07064549acbeba6ed6a88e4c6933 Mon Sep 17 00:00:00 2001 From: openeuler-basic Date: Wed, 8 Jan 2020 15:20:14 +0800 Subject: [PATCH] fix quit dialog for non-libreadline version --- ...t-dialog-for-non-libreadline-version.patch | 52 +++++++++++++++++++ util-linux.spec | 9 +++- 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 fdisk-fix-quit-dialog-for-non-libreadline-version.patch diff --git a/fdisk-fix-quit-dialog-for-non-libreadline-version.patch b/fdisk-fix-quit-dialog-for-non-libreadline-version.patch new file mode 100644 index 0000000..b9e5559 --- /dev/null +++ b/fdisk-fix-quit-dialog-for-non-libreadline-version.patch @@ -0,0 +1,52 @@ +From 40af0db4cdadc50d9ba7ea77d8fa0689bf976f9f Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Thu, 5 Sep 2019 12:34:01 +0200 +Subject: [PATCH] fdisk: fix quit dialog for non-libreadline version + +We need to clear stdin errors otherwise it returns EOF forever after +CTRL+D. + +Reported-by: Lukas Czerner +Signed-off-by: Karel Zak +--- + disk-utils/fdisk.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/disk-utils/fdisk.c b/disk-utils/fdisk.c +index 81334d0..0502fa3 100644 +--- a/disk-utils/fdisk.c ++++ b/disk-utils/fdisk.c +@@ -109,6 +109,7 @@ int get_user_reply(const char *prompt, char *buf, size_t bufsz) + if (is_interactive) + rl_callback_handler_install(prompt, reply_linehandler); + #endif ++ errno = 0; + reply_running = 1; + do { + int rc; +@@ -158,6 +159,7 @@ int get_user_reply(const char *prompt, char *buf, size_t bufsz) + if (!*buf) { + DBG(ASK, ul_debug("cancel by CTRL+D")); + ret = -ECANCELED; ++ clearerr(stdin); + goto done; + } + +@@ -168,13 +170,13 @@ int get_user_reply(const char *prompt, char *buf, size_t bufsz) + if (sz && *(buf + sz - 1) == '\n') + *(buf + sz - 1) = '\0'; + +- DBG(ASK, ul_debug("user's reply: >>>%s<<<", buf)); + done: + #ifdef HAVE_LIBREADLINE + if (is_interactive) + rl_callback_handler_remove(); + #endif + sigaction(SIGINT, &oldact, NULL); ++ DBG(ASK, ul_debug("user's reply: >>>%s<<< [rc=%d]", buf, ret)); + return ret; + } + +-- +1.8.3.1 + diff --git a/util-linux.spec b/util-linux.spec index 4ff699c..cf1b7c5 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -3,7 +3,7 @@ Name: util-linux Version: %{_pre_version__}.1 -Release: 4 +Release: 5 Summary: A random collection of Linux utilities License: GPLv2 and GPLv2+ and LGPLv2+ and BSD with advertising and Public Domain URL: https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git @@ -68,6 +68,7 @@ Patch6026: include-add-no-return-function-attribute.patch Patch6027: agetty-Fix-input-of-non-ASCII-characters-in-get_logn.patch Patch6028: script-be-sensitive-to-another-SIGCHLD-ssi_codes.patch Patch6029: su-be-sensitive-to-another-SIGCHLD-ssi_codes.patch +Patch6030: fdisk-fix-quit-dialog-for-non-libreadline-version.patch %description The util-linux package contains a random collection of files that @@ -300,6 +301,12 @@ fi %{_mandir}/man8/{swapoff.8*,swapon.8*,switch_root.8*,umount.8*,wdctl.8.gz,wipefs.8*,zramctl.8*} %changelog +* Wed Jan 8 2020 openEuler Buildteam - 2.32.1-5 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC:fix quit dialog for non-libreadline version + * Tue Dec 31 2019 openEuler Buildteam - 2.32.1-4 - Type:enhancement - ID:NA -- Gitee