Re: [lintian] 02/02: Avoid emitting "Can't use an undefined value as an ARRAY reference" warnings when debian/patches is a file, not a directory. (Closes: #889535)

2018-02-04 Thread Chris Lamb
Hi Niels,

> This looks like it would still cause issues if d/patches is a symlink to
> a file.

Great spot. Should be addressed in:

  
https://anonscm.debian.org/git/lintian/lintian.git/commit/?id=530c5878a1c2198d79d35e8eafebbc9c8e6d91ec

:)


Regards,

-- 
  ,''`.
 : :'  : Chris Lamb
 `. `'`  la...@debian.org / chris-lamb.co.uk
   `-



Re: [lintian] 02/02: Avoid emitting "Can't use an undefined value as an ARRAY reference" warnings when debian/patches is a file, not a directory. (Closes: #889535)

2018-02-04 Thread Niels Thykier
Chris Lamb:
> This is an automated email from the git hooks/post-receive script.
> 
> lamby pushed a commit to branch master
> in repository lintian.
> 
> commit 76a12dd8be5bd2308918d4019a880d84ced00877
> Author: Chris Lamb 
> Date:   Sun Feb 4 09:36:00 2018 +
> 
> Avoid emitting "Can't use an undefined value as an ARRAY reference" 
> warnings when debian/patches is a file, not a directory. (Closes: #889535)
> ---
>  checks/patch-systems.pm | 5 +++--
>  debian/changelog| 4 
>  2 files changed, 7 insertions(+), 2 deletions(-)
> 

Hi,

Thanks for fixing this bug; just one comment.

> diff --git a/checks/patch-systems.pm b/checks/patch-systems.pm
> index cac174e..d73a653 100644
> --- a/checks/patch-systems.pm
> +++ b/checks/patch-systems.pm
> @@ -47,13 +47,14 @@ sub run {
>  my $droot = $info->index_resolved_path('debian/');
>  return if not $droot;
>  my $dpdir = $droot->resolve_path('patches');
> +my $resolved;
>  my $patch_series;
>  my %known_files;
>  
>  # Find debian/patches/series, assuming debian/patches is a (symlink to a)
>  # dir.  There are cases, where it is a file (ctwm: #778556)
>  if ($dpdir and ($dpdir->is_dir or $dpdir->is_symlink)) {
> -my $resolved = $dpdir->resolve_path;
> +$resolved = $dpdir->resolve_path;
>  $patch_series = $resolved->resolve_path('series') if 
> $resolved->is_dir;
>  }
>  
> @@ -227,7 +228,7 @@ sub run {
>  }
>  
>  #- look for unreferenced files in debian/patches
> -if ($dpdir and $format ne '2.0') {
> +if ($resolved and $format ne '2.0') {
>  # Check all series files, including $vendor.series
>  foreach my $file ($dpdir->children) {
>  next unless $file =~ /\/(.+\.)?series$/;
> [...]


This looks like it would still cause issues if d/patches is a symlink to
a file.  In that case, $resolved would still be valid path (to the
file).  Adding a "and $resolved->is_dir" should solve that.

Thanks,
~Niels