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

Bug#1001112: lintian: fpos for bash-term-in-posix-shell



Package: lintian
Version: 2.114.0

Hi,

I got these two fpos today:

I: eclipse-titan: bash-term-in-posix-shell '. "The following' [usr/bin/titanver:124]
I: eclipse-titan: bash-term-in-posix-shell 'd{4,}' [usr/bin/titanver:99]

The incriminated file is attached.


Those are fpos because those lines are within a (crazy is you ask me,
but well) `eval 'exec ${perlexe} -x $0 ${1+"$@"} ;'`.

o/

-- 
regards,
                        Mattia Rizzolo

GPG Key: 66AE 2B4A FCCF 3F52 DA18  4D18 4B04 3FCD B944 4540      .''`.
More about me:  https://mapreri.org                             : :'  :
Launchpad user: https://launchpad.net/~mapreri                  `. `'`
Debian QA page: https://qa.debian.org/developer.php?login=mattia  `-
#!/bin/sh
###############################################################################
# Copyright (c) 2000-2021 Ericsson Telecom AB
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v2.0
# which accompanies this distribution, and is available at
# https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
###############################################################################
# Find Perl in the path
# Can't use `perl -e 'print $^X'` because that may print just "perl"
perlexe=`which perl 2>/dev/null | sed -n 's/[^\/]*\(\/.*perl\)/\1/p'`
# Do it the hard way if not found
if [ -z "${perlexe}" ] ; then

GCCVER=`strings -a -10 ${1+"$@"} | sed -n '
s/.*TITAN: [0-9][0-9]* PLATFORM: [A-Z0-9][A-Z0-9]* //
/GCC: (GNU)/ {
p
}
s/.*TITAN: [0-9][0-9]* PLATFORM: [A-Z0-9][A-Z0-9]* //
/Clang: (GNU)/ {
p
}
/Sun C++/ {
s/.*\(Sun C++ *[0-9]\.[0-9]\).*/\1/g
p
}
' | sort -u`;

if [ `echo "${GCCVER}" | wc -l` != 1 ]; then
    echo -e "Error! Object files compiled with different compilers were detected:
${GCCVER}
Please clean and rebuild your project.";
    exit 1;
else
    : ; # no news is good news
fi

exit 0; # avoid flowing into Perl
fi

#! Here begins the real -*- perl -*- -ws
#line 34
# The above directive should be adjusted to the line number of ** this ** line
eval 'exec ${perlexe} -x $0 ${1+"$@"} ;'
if 0;
use strict;
use vars qw($r $v);

my $compiler = 'Compiler';

my %versions;

my $objdump = `/bin/sh -c "which objdump" 2>/dev/null`;
chomp $objdump;
exit 0 if ($objdump !~ m!^/! or !@ARGV); # go quiet if no objdump or @ARGV is empty

my $comment = '';

my @sections = qw( .titan .comment );
my $found_ver;

my $cmdline;

open (PIPE, $cmdline = "$objdump -s -j " . join(' -j ', @sections) . " @ARGV |") or die "open failed: $!";

my $obj = '?';

sub match_comment() {
    if (length($comment)) {
        ($found_ver) = $comment =~ /((GCC|Clang): \([^)]*\) \d\.\d+(?:\.\d+)?)/;
        $found_ver =~ s/ \([^)]*\)//;
	if ($found_ver) {
          print "$compiler version was $found_ver for $obj\n" if $v;

          push @{$versions{$found_ver}}, $obj;

          if (defined $r and $r ne $found_ver) {
            if (!$v) { # found version was not written, do it now
                warn "$compiler was $found_ver for $obj\n";
            }
          die      "        $r was expected\n";
          }
        }
    }
}

while (<PIPE>)
{
  chomp;
  next unless length;
  if (/^([^:]+):\s+file format/) {
    match_comment();
    $obj = $1;
    $comment = '';
  }
  elsif (my ($text) =
  m/^ \s*
  \d{4,}           # offset
  \s
  [0-9a-fA-F ]{8} # first group of hex digits
  \s
  [0-9a-fA-F ]{8} # these should be [[:xdigit:] ] but rhea's perl is ancient :(
  \s
  [0-9a-fA-F ]{8}
  \s
  [0-9a-fA-F ]{8}
  \s\s
  (.+)             # up to 16 characters of "plain" text
  $/x) {
    $comment .= $text;
  }
}

match_comment();

close (PIPE) or die "close failed: $!";

if ( scalar keys %versions > 1 ) {
    while ( my ($ver, $ref) = each %versions ) {
        warn "Compiled with $compiler $ver: ", join(', ', @$ref), "\n";
    }
    die "Error! All object files should be compiled with the same compiler version.\n"
    . "The following $compiler versions were detected: ", join(', ', keys %versions),
    "\nRun make clean and make to recompile the project if the version of the compiler changed recently.";
}

__END__


Parse the output of objdump, which looks like this:

core/XmlReader.o:     file format elf64-x86-64

Contents of section .comment:
 0000 00474343 3a202847 4e552920 342e342e  .GCC: (GNU) 4.4.
 0010 30203230 30393032 31332028 65787065  0 20090213 (expe
 0020 72696d65 6e74616c 2900               rimental).

Options:
        -r=x.x.x        expected GCC version
        -v              verbose

Error conditions:

** -r=XXX supplied and one of the objects fail to match
** more than one GCC version detected

Attachment: signature.asc
Description: PGP signature


Reply to: