Bug#956233: lintian: Internal error opening files since 2.63.0

2020-04-08 Thread Felix Lechner
Control: retitle -1 lintian: UTF-8 filenames cause internal errors

Hi Dmitry,

On Wed, Apr 8, 2020 at 10:30 AM Dmitry Shachnev  wrote:
>
>   Can't open 
> '/tmp/lintian-pool-z2LddsoVG9/pool/s/sphinx/sphinx_2.4.3-2+salsaci_source/unpacked/tests/roots/test-images/testimäge.png'
>  with mode '<:raw': 'No such file or directory' at 
> /usr/share/lintian/checks/cruft.pm line 992

This error is about UTF-8 filenames. We have a solution in Lintian,
but it does not work reliably due to a Perl bug.

In my opinion, the bug is serious enough to patch all versions of Perl
shipped in Debian, as explained below. In lieu of what would have been
an upcoming email to debian-perl, they are hereby copied.

In a nutshell, file tests such as '-f' do not work reliably with
strings that were internally "upgraded" by Perl (i.e. utf8::upgrade).
More details about this dangerous bug are available here [1] and [2].
Other system calls such as 'stat' and 'open' are likewise affected.
This bug shows the problem with 'open'.

It is amazing that the bug has been open for so long. It is literally
the well-known "Unicode bug", but for file names. Apparently there is
no common solution for all Perl platforms. (The use of UTF-8 filenames
also appears to be uncommon outside Linux, or is implemented
differently, i.e. MacOS.)

In my view, many Perl scripts in Debian, including those for
installation and security purposes, depend on file tests working
reliably. Perhaps our Perl interpreters should be patched with a
Debian-specific fix.

Related questions about file name mangling or matching in modules,
such as Path::Tiny and File::Find::Rule, may have to be explored or
mitigated before this bug can be considered completely closed.

The credit for identifying the bug in Lintian (and saving my sanity)
goes to Grinnz on #debian-perl.

Kind regards,
Felix Lechner

[1] https://github.com/Perl/perl5/issues/10550
[2] https://github.com/Perl/perl5/issues/9674



Bug#956233: lintian: Internal error opening files since 2.63.0

2020-04-08 Thread Dmitry Shachnev
Package: lintian
Version: 2.64.0
Severity: important

Dear Maintainer,

Lintian recently started getting internal error when checking sphinx package:

The error is:

  Can't open 
'/tmp/lintian-pool-z2LddsoVG9/pool/s/sphinx/sphinx_2.4.3-2+salsaci_source/unpacked/tests/roots/test-images/testimäge.png'
 with mode '<:raw': 'No such file or directory' at 
/usr/share/lintian/checks/cruft.pm line 992
  Lintian::cruft::open(GLOB(0x5563649da270), "<:raw", 
"/tmp/lintian-pool-z2LddsoVG9/pool/s/sphinx/sphinx_2.4.3-2+sal"...) called at 
/usr/share/lintian/checks/cruft.pm line 992
  Lintian::cruft::full_text_check(Lintian::cruft=HASH(0x556364a09fa0), 
Lintian::File::Path=HASH(0x5563605a7948), 
"tests/roots/test-images/testim\x{c3}\x{a4}ge.png", "testim\x{c3}\x{a4}ge.png", 
"tests/roots/test-images/") called at /usr/share/lintian/checks/cruft.pm line 
710
  ...
  internal error: cannot run cruft check on package 
source:sphinx/2.4.3-2+salsaci

Visible here:
https://salsa.debian.org/python-team/modules/sphinx/-/jobs/654529

Note that the file is named testimäge.png.

--
Dmitry Shachnev


signature.asc
Description: PGP signature