Debian Bug report logs - #851588
diffoscope: skip tests if binutils can't handle the object file format

version graph

Package: src:diffoscope; Maintainer for src:diffoscope is Reproducible builds folks <reproducible-builds@lists.alioth.debian.org>;

Reported by: Mattia Rizzolo <mattia@debian.org>

Date: Mon, 16 Jan 2017 17:09:01 UTC

Severity: normal

Tags: patch

Found in version diffoscope/68

Fixed in version diffoscope/69

Done: Chris Lamb <lamby@debian.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Reproducible builds folks <reproducible-builds@lists.alioth.debian.org>:
Bug#851588; Package src:diffoscope. (Mon, 16 Jan 2017 17:09:04 GMT) (full text, mbox, link).


Message #3 received at submit@bugs.debian.org (full text, mbox, reply):

From: Mattia Rizzolo <mattia@debian.org>
To: submit@bugs.debian.org
Subject: diffoscope: skip tests if binutils can't handle the object file format
Date: Mon, 16 Jan 2017 18:06:48 +0100
[Message part 1 (text/plain, inline)]
source: diffoscope
version: 68
tags: patch

So, I finally managed to look into the tests failures were have been
seeing in ubuntu's autopkgtest in armhf (and probably also ppc64el and
s390x, but I didn't test for that).
As supposed, the reason is that we're trying to disassemble x86-64
binaries, and the installed multiarch can't deal with them; remember
that the failing tests happen during the 2 py.test call, run without
_any_ recommended package installed.

Now, I came up with a patch, but my python foo has its limit, and I
think somebody might improve it quite some (e.g. please tell me how I
can write a decorated fuction that doesn't take any value as input and
still returns only pytest.mark.skipif()... what I did is uglyugly), so
I'm filing it as a bug here instead of committing; see the attachment :)

-- 
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  `-
[0001-Skip-some-tests-involving-readelf-objdump-nm-if-the-.patch (text/x-diff, attachment)]
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Reproducible builds folks <reproducible-builds@lists.alioth.debian.org>:
Bug#851588; Package src:diffoscope. (Mon, 16 Jan 2017 19:15:07 GMT) (full text, mbox, link).


Acknowledgement sent to Daniel Shahaf <danielsh@apache.org>:
Extra info received and forwarded to list. Copy sent to Reproducible builds folks <reproducible-builds@lists.alioth.debian.org>. (Mon, 16 Jan 2017 19:15:07 GMT) (full text, mbox, link).


Message #8 received at 851588@bugs.debian.org (full text, mbox, reply):

From: Daniel Shahaf <danielsh@apache.org>
To: Mattia Rizzolo <mattia@debian.org>
Cc: 851588@bugs.debian.org
Subject: Re: diffoscope: skip tests if binutils can't handle the object file format
Date: Mon, 16 Jan 2017 19:07:57 +0000
Mattia Rizzolo wrote on Mon, Jan 16, 2017 at 18:06:48 +0100:
> So, I finally managed to look into the tests failures were have been
> seeing in ubuntu's autopkgtest in armhf (and probably also ppc64el and
> s390x, but I didn't test for that).
> As supposed, the reason is that we're trying to disassemble x86-64
> binaries, and the installed multiarch can't deal with them;

Then should we look for 'x86_64-linux-gnu-readelf' rather than bare
'readelf'?  And likewise for 'objdump' and friends.

> Now, I came up with a patch, but my python foo has its limit, and I
> think somebody might improve it quite some (e.g. please tell me how I
> can write a decorated fuction that doesn't take any value as input and
> still returns only pytest.mark.skipif()... what I did is uglyugly), so
> I'm filing it as a bug here instead of committing; see the attachment :)

The expression after the "@" sign is evaluated; that should result in
a callable object, which is called with the decoratee as an argument.
In your case, you should be able to pass no parameters, e.g.,
.
    @skip_if_binutils_do_not_support_x86()
.
and then delete the sole formal argument from the function definition.

Note that the parentheses are still required in this case, since the
thing that is called with 'test_obj_compare_non_existing' as an actual
parameter is not 'skip_if_binutils_do_not_support_x86' but rather the
function it returns.

I'm not sure what's the best way to combine skip_unless_tools_exist and
pytest.mark.skipif().  The way decorators work is that they're invoked
on each other's return values, i.e.,
.
    def skip_if_binutils_do_not_support_x86():
        func1 = skip_unless_tools_exist('objdump')
        func2 = pytest.mark.skipif(...)
        return (lambda func: func2(func1(func)))
.
but whether that's readable is a question of taste.

Cheers,

Daniel


>      return obj1.compare(obj2).details
>  
>  @skip_unless_tools_exist('readelf')
> +@skip_if_binutils_do_not_support_x86(True)
>  def test_obj_compare_non_existing(monkeypatch, obj1):
>      monkeypatch.setattr(Config(), 'new_file', True)
>      difference = obj1.compare(MissingFile('/nonexisting', obj1))

> +def skip_if_binutils_do_not_support_x86(func):
> +    if tools_missing('objdump'):
> +         return skip_unless_tools_exists('objdump')
> +    out = subprocess.check_output(('objdump', '-i')).decode('utf-8').splitlines()
> +    return pytest.mark.skipif(
> +        'elf64-x86-64' not in out,
> +        reason="requires a binutils capable of reading x86-64 binaries"
> +    )
> +
>  def load_fixture(filename):
>      return pytest.fixture(
>          lambda: specialize(FilesystemFile(filename))
> -- 
> 2.11.0
> 






Information forwarded to debian-bugs-dist@lists.debian.org, Reproducible builds folks <reproducible-builds@lists.alioth.debian.org>:
Bug#851588; Package src:diffoscope. (Mon, 16 Jan 2017 19:48:04 GMT) (full text, mbox, link).


Message #11 received at 851588@bugs.debian.org (full text, mbox, reply):

From: Mattia Rizzolo <mattia@debian.org>
To: 851588@bugs.debian.org
Subject: Re: Bug#851588: diffoscope: skip tests if binutils can't handle the object file format
Date: Mon, 16 Jan 2017 20:45:48 +0100
[Message part 1 (text/plain, inline)]
[ please don't CC me in replies to diffoscope bugs ]

On Mon, Jan 16, 2017 at 07:07:57PM +0000, Daniel Shahaf wrote:
> Mattia Rizzolo wrote on Mon, Jan 16, 2017 at 18:06:48 +0100:
> > So, I finally managed to look into the tests failures were have been
> > seeing in ubuntu's autopkgtest in armhf (and probably also ppc64el and
> > s390x, but I didn't test for that).
> > As supposed, the reason is that we're trying to disassemble x86-64
> > binaries, and the installed multiarch can't deal with them;
> 
> Then should we look for 'x86_64-linux-gnu-readelf' rather than bare
> 'readelf'?  And likewise for 'objdump' and friends.

No, as that's available only on the binutils:amd64 and
binutils-multiarch:amd64 packages, and aren't available (natively) on
any other architecture; there is no binutils-amd64-linux-gnu or such
available on all architectures.  Besides, I'm not sure how other
distributions would cope.

> The expression after the "@" sign is evaluated; that should result in
> a callable object, which is called with the decoratee as an argument.
> In your case, you should be able to pass no parameters, e.g.,
> .
>     @skip_if_binutils_do_not_support_x86()
> .
> and then delete the sole formal argument from the function definition.

ISTR I tried that and didn't work, but apparently it does :S

> Note that the parentheses are still required in this case, since the
> thing that is called with 'test_obj_compare_non_existing' as an actual
> parameter is not 'skip_if_binutils_do_not_support_x86' but rather the
> function it returns.

Ok, it could be that I only tried this "variation"...


Thanks for explaining, attached the patch with that change.

-- 
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  `-
[0001-Skip-some-tests-involving-readelf-objdump-nm-if-the-.patch (text/x-diff, attachment)]
[signature.asc (application/pgp-signature, inline)]

Reply sent to Chris Lamb <lamby@debian.org>:
You have taken responsibility. (Tue, 17 Jan 2017 01:06:03 GMT) (full text, mbox, link).


Notification sent to Mattia Rizzolo <mattia@debian.org>:
Bug acknowledged by developer. (Tue, 17 Jan 2017 01:06:03 GMT) (full text, mbox, link).


Message #16 received at 851588-close@bugs.debian.org (full text, mbox, reply):

From: Chris Lamb <lamby@debian.org>
To: 851588-close@bugs.debian.org
Subject: Bug#851588: fixed in diffoscope 69
Date: Tue, 17 Jan 2017 01:03:29 +0000
Source: diffoscope
Source-Version: 69

We believe that the bug you reported is fixed in the latest version of
diffoscope, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 851588@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Chris Lamb <lamby@debian.org> (supplier of updated diffoscope package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Tue, 17 Jan 2017 11:33:54 +1100
Source: diffoscope
Binary: diffoscope
Architecture: source
Version: 69
Distribution: unstable
Urgency: medium
Maintainer: Reproducible builds folks <reproducible-builds@lists.alioth.debian.org>
Changed-By: Chris Lamb <lamby@debian.org>
Description:
 diffoscope - in-depth comparison of files, archives, and directories
Closes: 851588
Changes:
 diffoscope (69) unstable; urgency=medium
 .
   [ Chris Lamb ]
   * Skip tests if binutils can't handle the object file format. Based on a
     patch by Mattia Rizzolo. (Closes: #851588)
   * Move external tool definitions out of misleading "exceptions" module.
   * Save some complicated logic by setting default RE_FILE_{EXTENSION,TYPE}
   * Test --html-dir option.
   * Misc:
     * Add missing `data` imports.
     - Inherit GzipFile from File, not object.
     - Remove unused imports in comparator tests.
     - Consistently space out environment exports in debian/rules.
 .
   [ Mattia Rizzolo ]
   * If both RE_FILE_TYPE and RE_FILE_EXTENSION are defined, AND them
   * Use the path attribute of the specialized file instead of the original name
     in tests.
   * tests/main:
     * Shorten argument lists by unpacking common arguments.
     * Disable jQuery while testing --htmldir so tests can run without it.
   * tests/comparators:
     * Refactor into packages with smaller modules.
     * Rename load_fixture() to init_fixture().
     * Add a load_fixture() function wrapping both init_fixture() and data().
Checksums-Sha1:
 cde537161c1dd090f865df2847616b3c097a0493 2940 diffoscope_69.dsc
 fc3535cdb6eca0c1c04e3d28002a53b3fe8d6dfb 324992 diffoscope_69.tar.xz
Checksums-Sha256:
 f0e73fe5c5bb2b648cca7ccb950d05c4a55a1c9f2e0bd47d5f5f5ecb05610698 2940 diffoscope_69.dsc
 d92aa4065d9d90b139dc8f8adfcfb6fb9f7e56662bf275bf94e4e22468657004 324992 diffoscope_69.tar.xz
Files:
 8ddc0ab3130078c9621a693e3b3c4544 2940 devel optional diffoscope_69.dsc
 cceb87d2854f55b91fcbb6344ab9a143 324992 devel optional diffoscope_69.tar.xz

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEwv5L0nHBObhsUz5GHpU+J9QxHlgFAlh9aBAACgkQHpU+J9Qx
HliFcA/+M463cVAKBZA9iVDau+bQKRyGhjN6bfrs3bN3HFzq7OSPfbC1Z1AQun4/
Ko1X1UMfQEhFdoqTazNOusxDqQclJ2YMO82noUZ7q6SqBIS8IJot9dkPkGu81AAu
FDp8a0tSTMK7tGvgl3PD19cwlPMG62m4wezKvIJ8W5PUQgN869u9UUepQKriV/pH
wz8RPCfcH0B2eW8cy/zCGxL10ifVyBYJS3OU5j1yp7Wowysuxcr4Mwoq0cLifx56
WnF/QgBWxDMRdsVTVSnAjtOF9Zj/OumdayrX3UXMnm69rfyu+6pDh0eg1Vq9PwjY
tJMTQGwdSGNUVktwxVfJPVcIq6WYkKPMX8ajWqvQr6n5QBTK460JNHf49OjhFTgX
q3UVhTE+mgPUvHs2KoFh8gtEBjeuRHlmppMP7Cg9ZwEUfbygwrV/Tzb1oPZF48+L
IQ+l1oUEOjZao4LyaaG3Ga6K8inOnDLzfWl6BM7YqJ4LqjGnb22DM7YSEKO1Q+cL
A8CkWkFiKNMJ9IFoztxmcDl/3uHT+CPMxZ1SFlQuoMsa4hp6FlGVzQHdhelVF+iO
CEw0meJznh+LvWXvGCclEoVUlnXy97ICoX8XLccOhpxbr4JLyUN5/UcosgyciEqI
wFRvXLROqbVriravdfgv9/fXn1Bsf1O3JgCZqVl1FSBj6mJC3Zk=
=s0/s
-----END PGP SIGNATURE-----




Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Tue, 14 Feb 2017 07:35:20 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Wed May 17 13:54:59 2023; Machine Name: bembo

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.