From 688841e3543777f12ff928e75ed1586f6dc67f8e1291eb9f2d0b3b0fd925ca06 Mon Sep 17 00:00:00 2001 From: Petr Uzel Date: Wed, 2 Nov 2011 09:39:46 +0000 Subject: [PATCH] add util-linux-dmesg-fix-printing-of-multibyte-characters.patch (bnc#725993) OBS-URL: https://build.opensuse.org/package/show/Base:System/util-linux?expand=0&rev=102 --- ...fix-printing-of-multibyte-characters.patch | 52 +++++++++++++++++++ util-linux.changes | 6 +++ util-linux.spec | 2 + 3 files changed, 60 insertions(+) create mode 100644 util-linux-dmesg-fix-printing-of-multibyte-characters.patch diff --git a/util-linux-dmesg-fix-printing-of-multibyte-characters.patch b/util-linux-dmesg-fix-printing-of-multibyte-characters.patch new file mode 100644 index 0000000..00913de --- /dev/null +++ b/util-linux-dmesg-fix-printing-of-multibyte-characters.patch @@ -0,0 +1,52 @@ +From 131b477b61c7eb82aef913bae5aec63f019b7076 Mon Sep 17 00:00:00 2001 +From: Petr Uzel +Date: Tue, 1 Nov 2011 16:17:57 +0100 +Subject: [PATCH] dmesg: fix printing of multibyte characters + +Also make it compile if HAVE_WIDECHAR is not defined. + +Addresses: https://bugzilla.novell.com/show_bug.cgi?id=725993 +Reported-by: Harald Koenig +Signed-off-by: Petr Uzel +--- + sys-utils/dmesg.c | 16 ++++++++-------- + 1 files changed, 8 insertions(+), 8 deletions(-) + +Index: util-linux-2.20.1/sys-utils/dmesg.c +=================================================================== +--- util-linux-2.20.1.orig/sys-utils/dmesg.c ++++ util-linux-2.20.1/sys-utils/dmesg.c +@@ -391,10 +391,11 @@ static void safe_fwrite(const char *buf, + for (i = 0; i < size; i++) { + const char *p = buf + i; + int rc, hex = 0; ++ size_t len = 1; + + #ifdef HAVE_WIDECHAR + wchar_t wc; +- size_t len = mbrtowc(&wc, p, size - i, &s); ++ len = mbrtowc(&wc, p, size - i, &s); + + if (len == 0) /* L'\0' */ + return; +@@ -402,16 +403,15 @@ static void safe_fwrite(const char *buf, + if (len == (size_t)-1 || len == (size_t)-2) { /* invalid sequence */ + memset(&s, 0, sizeof (s)); + len = hex = 1; +- + } else if (len > 1 && !iswprint(wc)) { /* non-printable multibyte */ + hex = 1; +- } else +-#endif +- { ++ } ++ i += len - 1; ++#else + if (!isprint((unsigned int) *p) && + !isspace((unsigned int) *p)) /* non-printable */ + hex = 1; +- } ++#endif + if (hex) + rc = fwrite_hex(p, len, out); + else diff --git a/util-linux.changes b/util-linux.changes index f1e31e0..13e6a46 100644 --- a/util-linux.changes +++ b/util-linux.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Nov 2 09:37:12 UTC 2011 - puzel@suse.com + +- add util-linux-dmesg-fix-printing-of-multibyte-characters.patch + (bnc#725993) + ------------------------------------------------------------------- Thu Oct 20 13:01:22 UTC 2011 - puzel@suse.com diff --git a/util-linux.spec b/util-linux.spec index 2672a60..9900642 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -87,6 +87,7 @@ Patch1: util-linux-2.12r-fdisk_remove_bogus_warnings.patch # crypto patch Patch2: util-linux-2.17.1-mount_losetup_crypto.patch Patch5: util-linux-2.20-libmount-deps.patch +Patch6: util-linux-dmesg-fix-printing-of-multibyte-characters.patch ## ## adjtimex @@ -189,6 +190,7 @@ Files to develop applications using the libmount library. %patch1 -p1 %patch2 -p1 %patch5 -p1 +%patch6 -p1 # cd adjtimex-*