Opened 6 years ago

Last modified 5 years ago

#2385 new defect

UnicodeDecode error in runprocess.py

Reported by: roger_fong Owned by:
Priority: minor Milestone: 0.9.+
Version: 0.8.7 Keywords: encoding
Cc:

Description

File "/usr/lib/python2.6/site-packages/buildbot_slave-0.8.5-py2.6.egg/buildslave/runprocess.py", line 472, in _startCommand

msg += " %s=%s

" % (name, self.environ[name])

This part of the code prints out environment variables on your system. If your environment name has a character (like a smart quote) that the ascii decoder can't decode then this line will generate UnicodeDecode? error. Fix would be to just change the line to:

msg += " %s=%s

" % (name, (self.environ[name]).decode('UTF-8')) or something equivalent.

I saw this problem in 0.8.3, 0.8.5 and 0.8.7

Change History (4)

comment:1 Changed 6 years ago by dustin

  • Keywords encoding added
  • Milestone changed from undecided to 0.8.8

Hm, I don't think we want to assume it's utf-8.

Rather, we should include this data in the log as a bytestring, like the "normal" log output from a build step.

comment:2 Changed 6 years ago by dustin

Ah, I see - msg is turning into unicode from a unicode key or value in the environment provided to the step. I wonder if we should *encode* those to utf-8 first?

comment:3 Changed 6 years ago by tom.prince

Is the unicode data coming from os.environ, or is it being passed from buildbot?

comment:4 Changed 5 years ago by dustin

  • Milestone changed from 0.8.8 to 0.9.+

All log data is unicode in nine, so this shouldn't be a problem.

Note: See TracTickets for help on using tickets.