[Scons-users] False line length calculation

Roland.Stark-EXT at continental-corporation.com Roland.Stark-EXT at continental-corporation.com
Fri Aug 15 04:02:03 EDT 2014


There is an issue with line length calculation in the following file: 
SCons/Platform/__init__.py
(my OS is Windows7)

Line 173-177:
  length = 0
  for c in cmd:
      length += len(c)
  if length <= maxline:
      return self.cmd
 
This block of code ignores white spaces which leads to a problem if 
MAXLINELENGTH is set to the limit.

Example:
  env['MAXLINELENGTH'] = 8192
  Command: "link /DEBUG /DLL /nologo /SUBSYSTEM:WINDOWS /MACHINE:X86 /dll 
/out:... algo\ld_sim\sim_swc_ld_vis2\vis_vis_object.obj"
  (line length = 8215, 79 separator spaces):
  Calculated length = 8215 - 79 = 8136 => 8136 < 8192 => no use of 
temporary file => SCons build fails

I've seen this issue in version 2.2.0 but it's still existing in 2.3.2. 
I'm not sure if this obvious bug has some reasons, since it was correct in 
a former scons release.

Workaround: Reduce MAXLINELENGTH (keep a little space to OS limit)

Fix A (as in former scons release):
  if (reduce((lambda x, y: x + len(y)), cmd, len(cmd) - 1)) <= maxline:
      return self.cmd

Fix B (alternative):
  length = 0
  for c in cmd:
      length += len(c)
  length += len(cmd) - 1
  print ">>> Len = %i" % length
  if length <= maxline:
      return self.cmd

I would appreciate some feedback whether this is a bug or not.

Regards,
Roland
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20140815/d3766cda/attachment.html>


More information about the Scons-users mailing list