Package: dialog Version: 1.3-20160828-2 Severity: normal Tags: patch upstream
The bug was first reported on ubuntu at the following link: https://bugs.launchpad.net/ubuntu/+source/dialog/+bug/1611969 This bug also affect Debian sid, and is still present in the last upstream release 1.3-20170509. A patch, rather naive, is enclosed. The diff has been made from the last upstream release 1.3-20170509. -- System Information: Debian Release: buster/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 4.11.0-1-amd64 (SMP w/4 CPU cores) Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to fr_FR.UTF-8), LANGUAGE=fr_FR.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to fr_FR.UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages dialog depends on: ii debianutils 4.8.1.1 ii libc6 2.24-12 ii libncursesw5 6.0+20161126-1 ii libtinfo5 6.0+20161126-1 dialog recommends no packages. dialog suggests no packages. -- no debconf information
--- util.c.bak 2017-07-07 06:38:19.947542727 +0200 +++ util.c 2017-07-07 07:38:51.895267395 +0200 @@ -2274,7 +2274,7 @@ *p = ' '; if (has_newlines) { /* If prompt contains "\n" strings */ - if (*p == '\\' && *(p + 1) == 'n') { + if (*p == '\\' && *(p + 1) == 'n') { /* If current char is a "\n" */ *s++ = '\n'; p += 2; p1 = p; @@ -2298,7 +2298,7 @@ } } else /* If *p != '\n' */ *s++ = *p++; - } else if (dialog_vars.trim_whitespace) { + } else if (dialog_vars.trim_whitespace) { /* Trim whitespaces and "\n" */ if (*p == ' ') { if (*(s - 1) != ' ') { *s++ = ' '; @@ -2321,7 +2321,16 @@ if (!trim_blank(base, s)) *s++ = *p; p++; - } else + } else if (*p == '\n') { + if (dialog_vars.cr_wrap) + *s++ = *p++; + else if (*(s - 1) != ' ') { + /* Strip '\n's if cr_wrap is not set. */ + *s++ = ' '; + p++; + } else + p++; + } else /* If *p != '\n' */ *s++ = *p++; } }