Bug#1024469: lib/debian/tests/test_debfile.py::TestDebFile::test_control fails when tar(1) is not GNU tar

2022-11-20 Thread Michał Górny
On Mon, 2022-11-21 at 00:03 +1100, Stuart Prescott wrote:
> The error is coming from the invocation of dpkg-deb which runs
> ["tar", "-x", "-m", "-f", "-", "--warning=no-timestamp"]
> 
> Do I take it that on your system dpkg-deb exists but is entirely 
> non-functional because it can't actually work with any archives?

Ah, I've just looked into dpkg and it seems to switch to `gtar`
invocation if such an executable is present.  So it failed only because
I haven't rebuilt dpkg after we've switched to installing GNU tar
as `gtar`.  In this case, there is nothing to be fixed in dpkg and we
just need to handle this on Gentoo end.

I'm sorry for the false report and thank you for all your guidance.

-- 
Best regards,
Michał Górny



Bug#1024469: lib/debian/tests/test_debfile.py::TestDebFile::test_control fails when tar(1) is not GNU tar

2022-11-20 Thread Michał Górny
On Mon, 2022-11-21 at 00:03 +1100, Stuart Prescott wrote:
> Hi Michał,
> 
> Thanks for the intriguing report.
> 
> The error is coming from the invocation of dpkg-deb which runs
> ["tar", "-x", "-m", "-f", "-", "--warning=no-timestamp"]
> 
> Do I take it that on your system dpkg-deb exists but is entirely 
> non-functional because it can't actually work with any archives?

Ah, I didn't even realize I have dpkg installed!  I've never used it but
if you think it's broken, then it probably is ;-).

> If that's the case, I guess the real solution is fixing dpkg-deb. In the 
> meantime, I'll need to think about how the test can navigate its way 
> around a broken dpkg-deb being installed — at present, it assumes that 
> the tools it finds are not broken.

Indeed.  Should I file a new bug against dpkg, or can you "reassign"
this one then?

As for python-debian, please don't worry too much about it.  This setup
with bsdtar is quite experimental, and mostly meant to catch and report
potential issues right now.  I don't think you have to worry about real
users being affected right now.

-- 
Best regards,
Michał Górny



Bug#1024469: lib/debian/tests/test_debfile.py::TestDebFile::test_control fails when tar(1) is not GNU tar

2022-11-20 Thread Stuart Prescott

Hi Michał,

Thanks for the intriguing report.

The error is coming from the invocation of dpkg-deb which runs
["tar", "-x", "-m", "-f", "-", "--warning=no-timestamp"]

Do I take it that on your system dpkg-deb exists but is entirely 
non-functional because it can't actually work with any archives?


If that's the case, I guess the real solution is fixing dpkg-deb. In the 
meantime, I'll need to think about how the test can navigate its way 
around a broken dpkg-deb being installed — at present, it assumes that 
the tools it finds are not broken.


regards
Stuart

--
Stuart Prescotthttp://www.nanonanonano.net/   stu...@nanonanonano.net
Debian Developer   http://www.debian.org/ stu...@debian.org
GPG fingerprint90E2 D2C1 AD14 6A1B 7EBB 891D BBC1 7EBB 1396 F2F7



Bug#1024469: lib/debian/tests/test_debfile.py::TestDebFile::test_control fails when tar(1) is not GNU tar

2022-11-19 Thread Michał Górny
Package: python-debian
Version: 0.1.49

When tar(1) executable is a non-GNU implementation of tar (bsdtar from
libarchive here), test_control fails trying to pass unsupported `--
warning=no-timestamp` option:

```
=== FAILURES ===
___ TestDebFile.test_control ___

self = 
sample_deb = '/tmp/portage/dev-python/python-debian-
0.1.49/temp/test_debfile.cwjvb8xc/test.ar'

@pytest.mark.skipif(not _dpkg_deb_path, reason="dpkg-deb not
installed")
def test_control(self, sample_deb):
# type: (str) -> None
""" test for control contents equality """
with os.popen("dpkg-deb -f %s" % sample_deb) as dpkg_deb:
filecontrol = "".join(dpkg_deb.readlines())

with debfile.DebFile(sample_deb) as deb:
ctrl = deb.control.get_content("control")
assert ctrl is not None
>   assert ctrl.decode("utf-8") == filecontrol

[... cut long diff between expcected and "" ...]
deb= 
dpkg_deb   = 
filecontrol = ''
sample_deb = '/tmp/portage/dev-python/python-debian-
0.1.49/temp/test_debfile.cwjvb8xc/test.ar'
self   = 

lib/debian/tests/test_debfile.py:623: AssertionError
- Captured stderr call -
tar: Option --warning=no-timestamp is not supported
Usage:
  List:tar -tf 
  Extract: tar -xf 
  Create:  tar -cf  [filenames...]
  Help:tar --help
dpkg-deb: error: tar subprocess returned error exit status 1
```

This is Gentoo Linux/amd64 with libarchive-3.6.1.  GNU tar is available
as `gtar` if you really need it.  I suspect the same problem applies to
*BSD systems.

-- 
Best regards,
Michał Górny