[Scons-users] Bug report intelc tempfile

Mats Wichmann mats at wichmann.us
Fri Nov 29 11:26:59 EST 2019


On 11/29/19 9:02 AM, orenaud at coventor.com wrote:
> Hi,
> 
> I hit a bug in SCons 3.1.1 when using the Intel C++ compiler on Windows. 
> I found the reason for this bug, and a workaround. This is a regression 
> from SCons 2.
...
> When I look into the sources of SCons, I see that mslib.py, mslink.py 
> and msvc.py set the env variable TEMPFILEARGJOIN to os.linesep, which on 
> Windows is \r\n. The intelc SCons tool shares most of its env with the 
> one from msvc, so it inherits that variable. The code that writes the 
> tempfile(Platform/__init__.py) opens a tempfile in text mode (line 208), 
> joins the arguments with TEMPFILEARGJOIN (\r\n), and writes the result 
> to the tempfile (line 230). But because the tempfile is opened in text 
> mode, the \n in \r\n gets converted to \r\n, and thus the actual newline 
> written to the file is \r\r\n. For some reason, msvc is ok with this 
> fancy newline, but intelc is not.

The TEMPFILEARGJOIN stuff (not being a space, that is) is new, to 
address https://github.com/SCons/scons/issues/3350, and so probably 
never got a tryout on intelc - after all, there's no intelc in the scons 
CI setup, sadly.

> 
> The workaround I use is to set TEMPFILEARGJOIN to \n. I think the real 
> fix is probably to open the tempfile in binary mode instead of text.
> 
> Olivier Renaud

It's a file that clearly contains text, so to me your workaround sounds 
the better choice: let Python deal with line endings. But let's wait for 
other comments...


More information about the Scons-users mailing list