Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 902215

Summary: portage.tests.emerge.test_simple.SimpleEmergeTestCase test failure with app-alternatives/tar[libarchive]
Product: Portage Development Reporter: Sam James <sam>
Component: Binary packages supportAssignee: Portage team <dev-portage>
Status: CONFIRMED ---    
Severity: normal CC: base-system, boris.staletic, flow, gentoo, mgorny
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 891393    

Description Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-03-20 04:25:48 UTC
When running ./runtests on a system with app-alternatives/tar[libarchive], I get:

```
testSimple (portage.tests.emerge.test_simple.SimpleEmergeTestCase) ... xpak ... tar: Option --xattrs-include=* is not supported
Usage:
  List:    tar -tf <archive-filename>
  Extract: tar -xf <archive-filename>
  Create:  tar -cf <archive-filename> [filenames...]
  Help:    tar --help
!!! Error Extracting 'None', pid 563197 crashed or killed, exitcode -13
Calculating dependencies  ... done!
Dependency resolution took 0.01 s.


>>> Running pre-merge checks for dev-libs/B-1

>>> Running pre-merge checks for dev-libs/A-1
 * called pkg_pretend for dev-libs/A-1

>>> Emerging binary (1 of 2) dev-libs/B-1::test_repo for /tmp/portage.runtests.urc7bfrf/tmpi38106a4/cross_root/tmp/portage.runtests.urc7bfrf/tmpi38106a4/
>>> Extracting info
>>> Extracting dev-libs/B-1

>>> Failed to emerge dev-libs/B-1 for /tmp/portage.runtests.urc7bfrf/tmpi38106a4/cross_root/tmp/portage.runtests.urc7bfrf/tmpi38106a4/, Log file:

>>>  '/tmp/portage.runtests.urc7bfrf/tmpi38106a4/var/tmp/portage/dev-libs:B-1:20230320-041956.log'
FAIL
```
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-03-20 04:25:55 UTC
$ grep -rsin -- --xattrs-include
lib/_emerge/BinpkgExtractorAsync.py:48:                tar_options = ["--xattrs", "--xattrs-include='*'"]
grep: lib/_emerge/__pycache__/BinpkgExtractorAsync.cpython-39.pyc: binary file matches
lib/portage/dbapi/vartree.py:1094:            tar_cmd = ("tar", "-x", "--xattrs", "--xattrs-include=*", "-C", dest_dir)
Comment 2 Boris Staletic 2024-04-23 16:11:08 UTC
--xattrs is supported by bsdtar.
--xattrs-include isn't, though there is a feature request for it. [0]

I couldn't find the definitive reference, but as far as I can tell, bsdtar's --xattrs does mean "all extended attribute". That would make --xattrs-include redundant. I would feel more confident if this were explicitly stated in the man page for example.

> lib/_emerge/BinpkgExtractorAsync.py:48: tar_options = ["--xattrs", "--xattrs-include='*'"]

This one is preceeded by "if --xattrs in (tar --help).stdout" (pseudocode).

bsdtar's help is very brief, so portage misses that bsdtar actually supports xattrs. I guess portage could do without that check and just assume that every version of tar supports xattrs?

Alternatively, the same check could be repurposed to distinguish between gtar and bsdtar, but... ew. That's a big too hacky.

Using os.path.realpath() and shutil.which() could also help distinguish gtar from bsdtar.