[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Git][lintian/lintian][master] wrong-path-for-interpreter: allow aliased locations



Title: GitLab

Axel Beckert pushed to branch master at lintian / lintian

Commits:

  • 9266486e
    by Luca Boccassi at 2024-05-06T01:57:46+01:00
    wrong-path-for-interpreter: allow aliased locations
    
    merged-usr is mandatory in Debian since Bookworm (and much longer ago
    in Ubuntu), so /usr/bin/bash is a valid path, as is /bin/python3.
    Detect and ignore these instances.
    
    Closes: #1051338
    

2 changed files:

Changes:

  • lib/Lintian/Check/Scripts.pm
    ... ... @@ -47,6 +47,7 @@ const my $NOT_EQUAL => q{!=};
    47 47
     const my $BAD_MAINTAINER_COMMAND_FIELDS => 5;
    
    48 48
     const my $UNVERSIONED_INTERPRETER_FIELDS => 2;
    
    49 49
     const my $VERSIONED_INTERPRETER_FIELDS => 5;
    
    50
    +const my $USR_PREFIX_LENGTH => 4;
    
    50 51
     
    
    51 52
     use Moo;
    
    52 53
     use namespace::clean;
    
    ... ... @@ -692,10 +693,17 @@ sub visit_control_files {
    692 693
               'incorrect-path-for-interpreter'
    
    693 694
               : 'wrong-path-for-interpreter';
    
    694 695
     
    
    696
    +# Debian is now mandatory usr-merged, so /bin/sh and /usr/bin/sh are both acceptable
    
    697
    +        if ($expected =~ '^(/bin/|/sbin/)') {
    
    698
    +            $expected = '(?:/usr)?' . $expected;
    
    699
    +        } elsif ($expected =~ '^/usr(/bin/|/sbin/)') {
    
    700
    +            $expected = '(?:/usr)?' . substr($expected, $USR_PREFIX_LENGTH);
    
    701
    +        }
    
    702
    +
    
    695 703
             $self->pointed_hint(
    
    696 704
                 $tag_name, $item->pointer,  $interpreter,
    
    697 705
                 $NOT_EQUAL, $expected
    
    698
    -        )unless $interpreter eq $expected;
    
    706
    +        )unless $interpreter =~ $expected;
    
    699 707
     
    
    700 708
         } elsif ($item->name eq 'config') {
    
    701 709
             $self->pointed_hint('forbidden-config-interpreter',
    
    ... ... @@ -716,10 +724,17 @@ sub visit_control_files {
    716 724
               'incorrect-path-for-interpreter'
    
    717 725
               : 'wrong-path-for-interpreter';
    
    718 726
     
    
    727
    +# Debian is now mandatory usr-merged, so /bin/sh and /usr/bin/sh are both acceptable
    
    728
    +        if ($expected =~ '^(/bin/|/sbin/)') {
    
    729
    +            $expected = '(?:/usr)?' . $expected;
    
    730
    +        } elsif ($expected =~ '^/usr(/bin/|/sbin/)') {
    
    731
    +            $expected = '(?:/usr)?' . substr($expected, $USR_PREFIX_LENGTH);
    
    732
    +        }
    
    733
    +
    
    719 734
             $self->pointed_hint(
    
    720 735
                 $tag_name, $item->pointer, $interpreter,
    
    721 736
                 $NOT_EQUAL, $expected
    
    722
    -        )unless $interpreter eq $expected;
    
    737
    +        )unless $interpreter =~ $expected;
    
    723 738
     
    
    724 739
             $self->pointed_hint('unusual-control-interpreter', $item->pointer,
    
    725 740
                 $interpreter);
    

  • t/recipes/checks/scripts/scripts-control-interpreters/eval/hints
    ... ... @@ -9,8 +9,6 @@ scripts-control-interpreters-prepython (binary): unusual-control-interpreter /us
    9 9
     scripts-control-interpreters-prepython (binary): unusual-control-interpreter /usr/bin/python3 [postinst]
    
    10 10
     scripts-control-interpreters-prepython (binary): maintainer-script-interpreter /usr/bin/python3 [preinst]
    
    11 11
     scripts-control-interpreters-prepython (binary): maintainer-script-interpreter /usr/bin/python3 [postinst]
    
    12
    -scripts-control-interpreters-paths (binary): wrong-path-for-interpreter /usr/bin/bash != /bin/bash [postinst]
    
    13
    -scripts-control-interpreters-paths (binary): wrong-path-for-interpreter /bin/python3 != /usr/bin/python3 [prerm]
    
    14 12
     scripts-control-interpreters-paths (binary): unusual-control-interpreter /bin/python3 [prerm]
    
    15 13
     scripts-control-interpreters-paths (binary): maintainer-script-interpreter /usr/local/bin/bash [preinst]
    
    16 14
     scripts-control-interpreters-paths (binary): maintainer-script-interpreter /usr/bin/bash [postinst]
    


  • Reply to: