URL:
<https://savannah.gnu.org/bugs/?55334>
Summary: preconv fails when build with libuchardet on
MS-Windows
Project: GNU troff
Submitted by: eliz
Submitted on: Sun 30 Dec 2018 05:44:25 PM IST
Category: Preprocessor preconv
Severity: 3 - Normal
Item Group: Incorrect behaviour
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Planned Release: None
_______________________________________________________
Details:
If preconv is built with libuchardet, it produces partial output, "swallowing"
the initial portion of its input.
The reason for that is that the function detect_file_encoding calls 'fstat'
and 'fseek' on the input stream, and those are non-portable when the input
stream is not a file, but a pipe or a console device. On MS-Windows, 'fstat'
reports a small value (the size of the pipe buffer), and 'fseek' simply fails.
So the initial portion of the inout, read by detect_file_encoding, never
shows in the output.
The solution I propose is to copy stdin to a temporary file, and read from
that file instead. The proposed patch is in the attachment. The changes are
currently for MS-Windows only, but maybe other platforms will need them as
well.
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Sun 30 Dec 2018 05:44:25 PM IST Name: preconv_decode.dif Size: 2KiB
By: eliz
<http://savannah.gnu.org/bugs/download.php?file_id=45792>
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?55334>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
_______________________________________________
bug-groff mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-groff