Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 902215 - portage.tests.emerge.test_simple.SimpleEmergeTestCase test failure with app-alternatives/tar[libarchive]
Summary: portage.tests.emerge.test_simple.SimpleEmergeTestCase test failure with app-a...
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Binary packages support (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
Depends on:
Blocks: libarchive-tar
  Show dependency tree
Reported: 2023-03-20 04:25 UTC by Sam James
Modified: 2024-04-23 16:11 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
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
  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'
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-03-20 04:25:55 UTC
$ grep -rsin -- --xattrs-include
lib/_emerge/                tar_options = ["--xattrs", "--xattrs-include='*'"]
grep: lib/_emerge/__pycache__/BinpkgExtractorAsync.cpython-39.pyc: binary file matches
lib/portage/dbapi/            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/ 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.