Kind 'tar' only stages the contents of the first directory in a tar file

Summary

When a tar file is staged, BuildStream assumes it will contain a single directory (i.e. not a tar-bomb) and will only stage the contents of the first directory.

Steps to reproduce

Attempt to stage a tar file with multiple top-level directories.

What is the current bug behavior?

Currently only the contents of the first directory are staged.

What is the expected correct behavior?

One of the following:

  1. An error should be produced warning that tar files with multiple top-level directories are not supported
  2. There needs to be a method to define how the archive should be staged
  3. There needs to be a default behaviour which allows the staging of multiple directories.

Relevant logs and/or screenshots

My specific example cannot be shown as it contains sensitive information, however this is very easy to reproduce.

Other relevant information

I'm reporting this as a bug, because often we don't get to choose what the tar files we stage contains. In this case I'm staging a tar file provided by a customer of a customer, while it is possible to untar it and host another copy locally, it's not a very nice solution in the long run.

  • BuildStream version affected: /milestone %BuildStream_v1.2.3