Public bug reported:

In verbose mode, if files differ in share_files(), dhpython will try to
show a diff of the files. When these files are static libraries, this
raises a UnicodeDecodeError. For example, from a recent numpy build on
arm64[1]:

W: dh_python3 fs:146: Paths differ: 
debian/python3-numpy/usr/lib/python3.10/dist-packages/numpy/random/lib/libnpyrandom.a
 and 
debian/python3-numpy/usr/lib/python3/dist-packages/numpy/random/lib/libnpyrandom.a
Traceback (most recent call last):
  File "/usr/bin/dh_python3", line 284, in <module>
    main()
  File "/usr/bin/dh_python3", line 210, in main
    fix_locations(package, interpreter, SUPPORTED, options)
  File "/usr/share/dh-python/dhpython/fs.py", line 53, in fix_locations
    share_files(srcdir, dstdir, interpreter, options)
  File "/usr/share/dh-python/dhpython/fs.py", line 127, in share_files
    share_files(fpath1, fpath2, interpreter, options)
  File "/usr/share/dh-python/dhpython/fs.py", line 127, in share_files
    share_files(fpath1, fpath2, interpreter, options)
  File "/usr/share/dh-python/dhpython/fs.py", line 127, in share_files
    share_files(fpath1, fpath2, interpreter, options)
  File "/usr/share/dh-python/dhpython/fs.py", line 149, in share_files
    fromlines = fp1.readlines()
  File "/usr/lib/python3.10/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf6 in position 75: 
invalid start byte
make[1]: *** [debian/rules:46: override_dh_python3] Error 1
make[1]: Leaving directory '/<<PKGBUILDDIR>>'
make: *** [debian/rules:15: binary-arch] Error 2
dpkg-buildpackage: error: fakeroot debian/rules binary-arch subprocess returned 
exit status 2

There is already logic to skip this diff for .so files, so the same
should be done for .a files.

[1] https://launchpadlibrarian.net/624822201/buildlog_ubuntu-kinetic-
arm64.numpy_1%3A1.21.5-1build2_BUILDING.txt.gz

** Affects: dh-python (Ubuntu)
     Importance: Medium
         Status: Confirmed

** Changed in: dh-python (Ubuntu)
   Importance: Undecided => Medium

** Changed in: dh-python (Ubuntu)
       Status: New => In Progress

** Changed in: dh-python (Ubuntu)
     Assignee: (unassigned) => Nick Rosbrook (enr0n)

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to dh-python in Ubuntu.
https://bugs.launchpad.net/bugs/1990562

Title:
  attempting to diff static library files raises UnicodeDecodeError

Status in dh-python package in Ubuntu:
  Confirmed

Bug description:
  In verbose mode, if files differ in share_files(), dhpython will try
  to show a diff of the files. When these files are static libraries,
  this raises a UnicodeDecodeError. For example, from a recent numpy
  build on arm64[1]:

  W: dh_python3 fs:146: Paths differ: 
debian/python3-numpy/usr/lib/python3.10/dist-packages/numpy/random/lib/libnpyrandom.a
 and 
debian/python3-numpy/usr/lib/python3/dist-packages/numpy/random/lib/libnpyrandom.a
  Traceback (most recent call last):
    File "/usr/bin/dh_python3", line 284, in <module>
      main()
    File "/usr/bin/dh_python3", line 210, in main
      fix_locations(package, interpreter, SUPPORTED, options)
    File "/usr/share/dh-python/dhpython/fs.py", line 53, in fix_locations
      share_files(srcdir, dstdir, interpreter, options)
    File "/usr/share/dh-python/dhpython/fs.py", line 127, in share_files
      share_files(fpath1, fpath2, interpreter, options)
    File "/usr/share/dh-python/dhpython/fs.py", line 127, in share_files
      share_files(fpath1, fpath2, interpreter, options)
    File "/usr/share/dh-python/dhpython/fs.py", line 127, in share_files
      share_files(fpath1, fpath2, interpreter, options)
    File "/usr/share/dh-python/dhpython/fs.py", line 149, in share_files
      fromlines = fp1.readlines()
    File "/usr/lib/python3.10/codecs.py", line 322, in decode
      (result, consumed) = self._buffer_decode(data, self.errors, final)
  UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf6 in position 75: 
invalid start byte
  make[1]: *** [debian/rules:46: override_dh_python3] Error 1
  make[1]: Leaving directory '/<<PKGBUILDDIR>>'
  make: *** [debian/rules:15: binary-arch] Error 2
  dpkg-buildpackage: error: fakeroot debian/rules binary-arch subprocess 
returned exit status 2

  There is already logic to skip this diff for .so files, so the same
  should be done for .a files.

  [1] https://launchpadlibrarian.net/624822201/buildlog_ubuntu-kinetic-
  arm64.numpy_1%3A1.21.5-1build2_BUILDING.txt.gz

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dh-python/+bug/1990562/+subscriptions


-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to