alternative-bin-sh autopkgtest redirect tar to busybox

Bug #2004500 reported by Paride Legovini
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lsb-release-minimal (Ubuntu)
Fix Released
High
Brian Murray

Bug Description

The alternative-bin-sh autopkgtest is meant to run a set of tests using busybox as /bin/sh, however this somehow happens to also redirect /bin/tar. This causes autopkgtest failures. To reproduce locally fetch the lsb-release-minimal (12.0-1) source tree and run:

autopkgtest --test-name=alternative-bin-sh -s -U --no-built-binaries ./lsb-release-minimal-12.0/ --apt-pocket=proposed=lsb-release-minimal -- lxd ubuntu-daily:lunar

Sample error:

autopkgtest [19:09:08]: test alternative-bin-sh: - - - - - - - - - - results - - - - - - - - - -
alternative-bin-sh PASS
tar: unrecognized option '--warning=none'
BusyBox v1.35.0 (Ubuntu 1:1.35.0-4ubuntu1) multi-call binary.

Usage: tar c|x|t [-ZzJjahmvokO] [-f TARFILE] [-C DIR] [FILE]...

Create, extract, or list files from a tar file

 c Create
 x Extract
 t List
 -f FILE Name of TARFILE ('-' for stdin/out)
 -C DIR Change to DIR before operation
 -v Verbose
 -O Extract to stdout
 -m Don't restore mtime
 -o Don't restore user:group
 -k Don't replace existing files
 -Z (De)compress using compress
 -z (De)compress using gzip
 -J (De)compress using xz
 -j (De)compress using bzip2
 --lzma (De)compress using lzma
 -a (De)compress based on extension
 -h Follow symlinks
 --overwrite Replace existing files
 --strip-components NUM NUM of leading components to strip
 --no-recursion Don't descend in directories
 --numeric-owner Use numeric user:group
 --no-same-permissions Don't restore access permissions
 --to-command COMMAND Pipe files to COMMAND
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
autopkgtest-virt-lxd [19:09:08]: copyup destination failed, status 2

Revision history for this message
Paride Legovini (paride) wrote :

With debugging enabled (autopkgtest --debug):

alternative-bin-sh PASS
autopkgtest: DBG: sending command to testbed: copyup /tmp/autopkgtest.xGweVn/alternative-bin-sh-artifacts/ /tmp/autopkgtest.output.4y26hx9u/artifacts/
tar: unrecognized option '--warning=none'

tags: added: update-excuse
Revision history for this message
Paride Legovini (paride) wrote :

It reasonable to decide that an Ubuntu system with busybox as its /bin/sh is broken, so we don't have a "good" autopkgtest here. Making the autopkgtest undo the /bin/sh redirect should make it pass, but it's still kind of weak test as should a failure happen before the "undo redirect" code we'd and up with a "testbed failure" again.

Do we care about testing with busybox as /bin/sh in Ubuntu?

Revision history for this message
Gioele Barabucci (gioele) wrote :

Thanks Paride for the report and the analysis.

To me this looks like a bug in autopkgtest-virt-lxd: why is the runner executing any command inside an environment that has been modified (and possibly broken) by a test with `Restrictions: breaks-testbed`?

Revision history for this message
Brian Murray (brian-murray) wrote (last edit ):

Reordering the tests so that /bin/bash or /bin/dash are the final symlink for /bin/sh allows tar to proceed. I'll upload something shortly because our workers are currently stuck trying to run this package's tests. We should investigate further the comment regarding running tar in a "broken testbed".

Changed in lsb-release-minimal (Ubuntu):
status: New → In Progress
assignee: nobody → Brian Murray (brian-murray)
importance: Undecided → High
Revision history for this message
Gioele Barabucci (gioele) wrote :

Instead of reordering the tests, I'd just add

    trap 'ln -s /bin/dash /bin/sh' EXIT

at the end of the test script. That will fix the testbed regardless of any possible test failure.

Revision history for this message
Paride Legovini (paride) wrote (last edit ):

Hi Gioele,

AIUI from [1] the breaks-testbed restriction does not ensure that no further command gets executed on the testbed system.

The alternative-bin-sh autopkgtest works in Debian because autopkgtest-virt-lxc (like many other virt servers) has the downtmp-host capability, which allows autopkgtest to retrieve artifacts using a directory which is shared with the host system. The lxd and qemu virt servers do not have this capability, so artifacts are retrieved by building a tarball on the testbed system (executing commands there) and then retrieving it (I didn't check exactly how). I don't think we have a bug in autopkgtest(-virt-lxd) here.

I think the trap you suggested should be added to alternative-bin-sh in Debian.

For downtmp-host see [2]. Thanks for chiming in!

[1] https://salsa.debian.org/ci-team/autopkgtest/-/blob/master/doc/README.package-tests.rst
[2] https://salsa.debian.org/ci-team/autopkgtest/-/blob/master/doc/README.virtualisation-server.rst

Revision history for this message
Steve Langasek (vorlon) wrote :

bug was only present in -proposed and is now fixed in -proposed; closing.

Changed in lsb-release-minimal (Ubuntu):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.