<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - intel-gpu-tools/debugger/system_routine only builds in UTF-8 locales"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=80734">80734</a>
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>chris@chris-wilson.co.uk
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>intel-gpu-tools/debugger/system_routine only builds in UTF-8 locales
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>intel-gfx-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>minor
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>ats-fd@offog.org
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>git
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Driver/intel
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>xorg
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=102034" name="attach_102034" title="Specify the encoding explicitly">attachment 102034</a> <a href="attachment.cgi?id=102034&action=edit" title="Specify the encoding explicitly">[details]</a></span>
Specify the encoding explicitly

If you try to compile intel-gpu-tools 1.7 in the C locale, where the default
encoding is ASCII, you'll get this error:

make[5]: Entering directory
'/src/xorg/intel-gpu-tools/work/intel-gpu-tools-1.7/
debugger/system_routine'
./pre_cpp.py ./sr.g4a > sr.cpp.tmp && mv sr.cpp.tmp sr.cpp
Traceback (most recent call last):
  File "./pre_cpp.py", line 38, in <module>
    lines = file.readlines()
  File "/gar/lib/python3.4/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 16:
ordinal not in range(128)

That's because pre_cpp.py is a Python 3 program, and it's just called open() on
the file, which contains a UTF-8-encoded copyright symbol, without specifying
an encoding. In that case, Python 3 defaults to whatever the locale's encoding
is, so this'll work if your locale's encoding is UTF-8, but will either crash
or misinterpret the file if not.

One fix is to explicitly specify the encoding when opening the file. Patch
attached.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
      </ul>
    </body>
</html>