Bug#1010594: debhelper: Dh_Lib.pm assumes source "Section:" field is required, but it's documented as optional

2022-05-08 Thread Niels Thykier
Max-Julian Pogner:
> Package: debhelper
> Version: 13.7.1
> Severity: normal
> X-Debbugs-Cc: max-jul...@pogner.at
> 
> Dear Maintainer,
> 
>* What led up to the situation?
> 
> When using ``dh_testdir``, the following error messages appeared to me:
> 
>> Use of uninitialized value $v in substitution (s///) at 
>> /usr/share/perl5/Debian/Debhelper/Dh_Lib.pm line 1767, <$fd> line 9.
>> Use of uninitialized value $v in substitution (s///) at 
>> /usr/share/perl5/Debian/Debhelper/Dh_Lib.pm line 1768, <$fd> line 9.
> 


Hi,

Thanks for reporting this bug.


> [...]
> 
> I therefore think, that either
> 
>a) the documentation deb-src-control is incomplete and the source field 
> "Section:" should be marked as required there, or
>b) the Dh_Lib.pm should assign some default value to variable 
> $source_section after the loop ``while (<$fd>) {`` in lines 1786 to 1835 has 
> finished, or
>c) Dh_Lib.pm line 1994, which reads
>   
>   > $package_sections{$package} = _strip_spaces($field_values{'section'} 
> // $source_section);;
> 
>   should be changed to cope with the possibility that variable 
> $source_section has value ``undef``, or
>d) something else?
> 
> 
> Please advise what would be the next step, maybe i can provide a patch then.
> 
> 
> best regards,
> 
> Max
> 
> [...]


I am inclined to go with option C by having `_strip_spaces` cope with
its input being undefined and just immediately returning (or skipping
the stripping part).

Thanks for considering to provide a patch, it is very appreciated. :)  I
have already applied your patch from #1010591.  If you prefer, you are
also very welcome to use salsa.debian.org to provide a merge request at
https://salsa.debian.org/debian/debhelper/-/merge_requests

Thanks,
~Niels



Bug#1010594: debhelper: Dh_Lib.pm assumes source "Section:" field is required, but it's documented as optional

2022-05-05 Thread Max-Julian Pogner
Package: debhelper
Version: 13.7.1
Severity: normal
X-Debbugs-Cc: max-jul...@pogner.at

Dear Maintainer,

   * What led up to the situation?

When using ``dh_testdir``, the following error messages appeared to me:

> Use of uninitialized value $v in substitution (s///) at 
> /usr/share/perl5/Debian/Debhelper/Dh_Lib.pm line 1767, <$fd> line 9.
> Use of uninitialized value $v in substitution (s///) at 
> /usr/share/perl5/Debian/Debhelper/Dh_Lib.pm line 1768, <$fd> line 9.

However, dh_testdir to the best of my knowledge continued normally after that.


   * What exactly did you do (or not do) that was effective (or
 ineffective)?

My investigation suggests, that Dh_Lib.pm assumes the source field "Section:" 
to be present always in the file ``debian/control``, although 
https://manpages.debian.org/sid/dpkg-dev/deb-src-control.5.en.html documents 
the "Section" source field to be optional (in that other source fields are 
explicitly marked "required" or "recommended", but this source field is 
neither).

I therefore think, that either

   a) the documentation deb-src-control is incomplete and the source field 
"Section:" should be marked as required there, or
   b) the Dh_Lib.pm should assign some default value to variable 
$source_section after the loop ``while (<$fd>) {`` in lines 1786 to 1835 has 
finished, or
   c) Dh_Lib.pm line 1994, which reads
  
  > $package_sections{$package} = _strip_spaces($field_values{'section'} // 
$source_section);;

  should be changed to cope with the possibility that variable 
$source_section has value ``undef``, or
   d) something else?


Please advise what would be the next step, maybe i can provide a patch then.


best regards,

Max



-- System Information:
Debian Release: bookworm/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 5.17.0-1-amd64 (SMP w/12 CPU threads; PREEMPT)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_GB:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages debhelper depends on:
ii  autotools-dev20220109.1
ii  dh-autoreconf20
ii  dh-strip-nondeterminism  1.13.0-1
ii  dpkg 1.21.7
ii  dpkg-dev 1.21.7
ii  dwz  0.14-1
ii  file 1:5.41-4
ii  libdebhelper-perl13.7.1
ii  libdpkg-perl 1.21.7
ii  man-db   2.10.2-1
ii  perl 5.34.0-4
ii  po-debconf   1.0.21+nmu1

debhelper recommends no packages.

Versions of packages debhelper suggests:
pn  dh-make  

-- no debconf information