Bug#1025722: duck fails with 'Can't close(GLOB(0x558bebc05958)) filehandle: 'Is a directory' at /usr/share/duck/lib/checks/patch_files.pm line 101'

2022-12-08 Thread Niko Tyni
On Thu, Dec 08, 2022 at 12:45:29AM +0100, gregor herrmann wrote:
> Package: duck
> Version: 0.14.0
> Severity: grave
> Justification: renders package unusable
> X-Debbugs-Cc: p...@packages.debian.org

> As of today, duck (called in any source package directory) fails with
> 
> Can't close(GLOB(0x558bebc05958)) filehandle: 'Is a directory' at 
> /usr/share/duck/lib/checks/patch_files.pm line 101'
> 
> 92# iterate over all patchdirs, process all files found
> 93foreach my $patchdir (@patchdirs) {
> 94my $dirhandle = dir($patchdir)->open;
> 95
> 96while (my $patchfile = $dirhandle->read) {
> 97open my $pf, "<", $patchdir . "/" . $patchfile;
> 98
> 99my @pf_raw = <$pf>;
>100
>101close($pf);
> 
> This may or may not be caused by a recent change in src:perl [0], hence
> cc'in the perl maintainers

Thanks. It's definitely that change, but I think the bug is in duck.
The above code is treating directories as plain files under autodie,
so bailing out seems warranted. Earlier it just failed silently.

A straightforward fix would be inserting something like

next if -d $patchdir . "/" . $patchfile;

on line 97 or so (but using File::Spec->catfile() would feel cleaner
to me.)

Baptiste: please let us know if/when duck is fixed so we can add a
suitable Breaks entry on the perl side. (And obviously let us also know
if you disagree about the bug :)

BTW it seems like duck could use an autopkgtest test suite so things
like this would be detected automatically.
-- 
Niko Tyni   nt...@debian.org



Bug#1025722: duck fails with 'Can't close(GLOB(0x558bebc05958)) filehandle: 'Is a directory' at /usr/share/duck/lib/checks/patch_files.pm line 101'

2022-12-08 Thread Baptiste Beauplat
Hi Gregor,

Thanks for catching this.

On Thu, 2022-12-08 at 00:45 +0100, gregor herrmann wrote:
> As of today, duck (called in any source package directory) fails with
> 
> Can't close(GLOB(0x558bebc05958)) filehandle: 'Is a directory' at
> /usr/share/duck/lib/checks/patch_files.pm line 101'
> 
>     92  # iterate over all patchdirs, process all files found
>     93  foreach my $patchdir (@patchdirs) {
>     94  my $dirhandle = dir($patchdir)->open;
>     95  
>     96  while (my $patchfile = $dirhandle->read) {
>     97  open my $pf, "<", $patchdir . "/" .
> $patchfile;
>     98  
>     99  my @pf_raw = <$pf>;
>    100  
>    101  close($pf);
> 
> This may or may not be caused by a recent change in src:perl [0],
> hence
> cc'in the perl maintainers

Regardless of if it's indeed a problem introduced by the new perl
upload, I'll fix it in the code. The read() will always return at the
very least `.` and `..`, and those should definitly be skipped in that
context.

-- 
Baptiste Beauplat



signature.asc
Description: This is a digitally signed message part


Bug#1025722: duck fails with 'Can't close(GLOB(0x558bebc05958)) filehandle: 'Is a directory' at /usr/share/duck/lib/checks/patch_files.pm line 101'

2022-12-07 Thread gregor herrmann
Package: duck
Version: 0.14.0
Severity: grave
Justification: renders package unusable
X-Debbugs-Cc: p...@packages.debian.org

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

As of today, duck (called in any source package directory) fails with

Can't close(GLOB(0x558bebc05958)) filehandle: 'Is a directory' at 
/usr/share/duck/lib/checks/patch_files.pm line 101'

92  # iterate over all patchdirs, process all files found
93  foreach my $patchdir (@patchdirs) {
94  my $dirhandle = dir($patchdir)->open;
95  
96  while (my $patchfile = $dirhandle->read) {
97  open my $pf, "<", $patchdir . "/" . $patchfile;
98  
99  my @pf_raw = <$pf>;
   100  
   101  close($pf);

This may or may not be caused by a recent change in src:perl [0], hence
cc'in the perl maintainers


Cheers,
gregor

[0]

perl (5.36.0-5) unstable; urgency=medium

  * Backported upstream changes:
+ only clear the stream error state in readline() for glob()
  (Closes: #1016369)
…

 -- Niko Tyni   Tue, 06 Dec 2022 11:43:06 +0200


- -- System Information:
Debian Release: bookworm/sid
  APT prefers unstable
  APT policy: (990, 'unstable'), (500, 'unstable-debug'), (500, 
'stable-security'), (500, 'oldoldstable'), (500, 'experimental'), (500, 
'testing'), (500, 'stable'), (500, 'oldstable')
merged-usr: no
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.0.0-4-amd64 (SMP w/4 CPU threads; PREEMPT)
Kernel taint flags: TAINT_WARN, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=C, LC_CTYPE=de_AT.utf8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)
LSM: AppArmor: enabled

Versions of packages duck depends on:
ii  devscripts   2.22.2
ii  dpkg-dev 1.21.12
ii  libconfig-inifiles-perl  3.03-1
ii  libconfig-simple-perl4.59-6.1
ii  libdomain-publicsuffix-perl  0.19-2
ii  libfile-which-perl   1.27-2
ii  libmailtools-perl2.21-2
ii  libnet-dns-perl  1.35-1
ii  libparallel-forkmanager-perl 2.02-1
ii  libparse-debcontrol-perl 2.005-6
ii  libpath-class-perl   0.37-4
ii  libregexp-common-email-address-perl  1.01-6
ii  libregexp-common-perl2017060201-3
ii  libstring-similarity-perl1.04-3+b1
ii  libwww-curl-perl 4.17-8+b1
ii  libxml-xpath-perl1.48-1
ii  libyaml-libyaml-perl 0.84+ds-1+b1
ii  lynx 2.9.0dev.10-1+b1
ii  perl 5.36.0-5
ii  publicsuffix 20220811.1734-1

duck recommends no packages.

Versions of packages duck suggests:
ii  brz [bzr]   3.3.1-1
ii  git 1:2.38.1-1
ii  mercurial   6.3.1-2
ii  subversion  1.14.2-4+b1

- -- no debconf information

-BEGIN PGP SIGNATURE-

iQKTBAEBCgB9FiEE0eExbpOnYKgQTYX6uzpoAYZJqgYFAmORJZlfFIAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEQx
RTEzMTZFOTNBNzYwQTgxMDREODVGQUJCM0E2ODAxODY0OUFBMDYACgkQuzpoAYZJ
qgaZtw//QqED5auXM1gfiGMwnS/OjU6jPnHjZ6kKu8QM12jH35Pgv8+TMvOePliR
6cLLHA4+GooqUBLrBLIJSw49YzSuxV2SxesjD9RsKHRsLkeqOaAU4kAS1CnW1POp
qNZP7/qNjmOl0B7xeQEljehseILWgFmGEe3selRI0maHHwSLnMr0YmPN36kg3s0X
/8qPh0xOUrbrooeAH76rcOqapnA2RKoGq7SvuY4cmLvIz/SwHq18CADaMNFvW1u3
RRq8orKf7DXWkAoBIRfFg1HYBppYGWA4yn3k5GwRxS9/YYdDTOoYrDFbGQTFhnpZ
T+KSx1DaTPum6A3MkXgdSB+OFUlxzbvrt7y+ULz6+ZHe3kaqjPHMe6i1cjPnhD+s
nLZ7n5f67f0oZq7zHRTANIASCEWs+Xp2fuwGzs910A80LUUwe9vvNkEx6WEf7QdS
yAbChHZhkIfFI1B5Bh/dYdxklfmkj5KrfFCKaLChLKbEr3EgC3LdwI5sNvOuWu+7
EgyzntYCPg1BvmFE1cZYzcCmAfvF9OOEd7Om16j1Z1e/ydHycWJcm0OrROcZDroK
e2ZIcxE9B4lpSCVVyE0PeDjgqlEFLalI5EyJhktFz14kWOj6wdJ1ekufWRtw+N8R
sw87whJFSxgKZ4m4NtWWTVwpTCIxl36GyasLKv7/sNqZUSh2+1Q=
=P4E5
-END PGP SIGNATURE-