On signed char platforms, 0xFF was converted to -1
which matches MBBUF_EOF, causing fold to stop processing.
* NEWS: Mention the bug fix.
* gl/lib/mbbuf.h: Avoid sign extension on signed char platforms.
* tests/fold/fold-characters.sh: Adjust test case.
Reported at https://src.fedoraproject.org/rpms/coreutils/pull-request/20
** Bug fixes
+ 'fold' will no longer truncate output when encountering 0xFF bytes.
+ [bug introduced in coreutils-9.8]
+
'kill --help' now has links to valid anchors in the html manual.
[bug introduced in coreutils-9.10]
else
{
/* Assume the program will emit the byte, but keep the error flag. */
- g.ch = mbbuf->buffer[mbbuf->offset++];
+ g.ch = (unsigned char) mbbuf->buffer[mbbuf->offset++];
}
return g;
}
bad_unicode_with_nul ()
{
# invalid UTF8|unpaired surrogate|NUL|C1 control|noncharacter
- env printf '\xC3|\xED\xBA\xAD|\u0000|\u0089|\xED\xA6\xBF\xED\xBF\xBF\n'
+ env printf '\xFF|\xED\xBA\xAD|\u0000|\u0089|\xED\xA6\xBF\xED\xBF\xBF\n'
}
-bad_unicode_with_nul > /dev/null || framework_failure_
-test $({ bad_unicode_with_nul | fold; \
- bad_unicode_with_nul; } | uniq | wc -l) = 1 || fail=1
+bad_unicode_with_nul > exp4 || framework_failure_
+bad_unicode_with_nul | fold > out4 || fail=1
+compare exp4 out4 || fail=1
+
# Check bad character at EOF
test $(env printf '\xC3' | fold | wc -c) = 1 || fail=1