bugGNU troff - Bugs: bug #55335, [PATCH] preconv produces CR CR LF...


bug #55335: [PATCH] preconv produces CR CR LF end-of-line on MS-Windows

Submitted by:  Eli Zaretskii <eliz>
Submitted on:  Sun 30 Dec 2018 03:49:50 PM UTC  
Category:  Preprocessor preconv Severity:  3 - Normal
Item Group:  Incorrect behaviour Status:  Need Info
Privacy:  Public Assigned to:  None
Open/Closed:  Open Planned Release:  None

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Thu 22 Oct 2020 05:24:20 PM UTC, comment #3: 

I don't see a risk here.  If i read src/include/nonposix.h correctly, SET_BINARY() is a NOOP on any sane system.  So given that Eli tested it extensively on Windows, i think no further testing is needed.  Any developer who understands in principle what SET_BINARY() is supposed to do (i.e., not me) and who thinks the patch looks good to code inspection should just push it.

Ingo Schwarze <schwarze>
Project Member
Wed 21 Oct 2020 02:20:24 PM UTC, comment #2: 

You mean, someone other than myself?

Eli Zaretskii <eliz>
Wed 21 Oct 2020 07:26:10 AM UTC, comment #1: 

Do we have someone with access to a Windows machine to test this on?

Eli filed it almost immediately after the previous release; it'd be nice to do something about it before the next one.

G. Branden Robinson <gbranden>
Project Administrator
Sun 30 Dec 2018 03:49:50 PM UTC, original submission:  

When compiled for MS-Windows, preconv reads its input in binary mode, thus leaving the CR characters of the CR LF end-of-line marker unconverted to the Unix LF-only format.  However, the output is written in the default text mode, which adds another CR before LF, thus producing files with an extra CR.  This causes pic (and possibly other preprocessors) to complain about "invalid input character code 13".

The solution is to switch stdout to binary mode when needed.  The proposed patch is in the attachment.

Eli Zaretskii <eliz>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #45793:  preconv_binary.dif added by eliz (613B - application/vnd.ms-excel)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by schwarze (Posted a comment)
  • -email is unavailable- added by gbranden (Posted a comment)
  • -email is unavailable- added by eliz (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-10-21 gbranden StatusNone => Need Info
    2020-10-13 barx Carbon-CopyRemoved 93119 => -
    2020-10-13 barx Summarypreconv produces CR CR LF end-of-line on MS-Windows => [PATCH] preconv produces CR CR LF end-of-line on MS-Windows
    2018-12-30 eliz Attached File- => Added preconv_binary.dif, #45793

    Back to the top

    Powered by Savane 3.5