diff options
author | Jürg Billeter <j@bitron.ch> | 2019-01-28 19:14:53 +0000 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2019-02-14 16:05:38 +0100 |
commit | e7e4086e293722bfe556c8e6ef07b0f37821cb38 (patch) | |
tree | 08616ef2cd5f7df0de87a83cb13dd10e8894ad34 /tests/integration | |
parent | 174f53944203d82da9e2e1bff2509b725b085f04 (diff) | |
download | buildstream-e7e4086e293722bfe556c8e6ef07b0f37821cb38.tar.gz |
utils.py: Change _ensure_real_directory() to not resolve symlinks
Resolving symlinks during staging causes various issues:
* Split rules may not work properly as the resolved paths will differ
depending on whether another artifact with a directory symlink has
been staged in the same root directory or not, e.g., as part of
compose.
* The order of symlinks in file lists is difficult to get right to
guarantee consistent and predictable behavior as paths in a file list
might rely on symlinks in the same file list. See #647 and #817.
* Staging order differences can lead to surprising results. See #390.
* Difficult to properly support absolute symlinks. Absolute symlinks are
currently converted to relative symlinks, however, this doesn't always
work. See #606 and #830.
This will require changes in projects that rely on the current behavior.
However, the changes are expected to be small and are often a sign of
buggy element files. E.g., elements that don't fully obey `bindir` or
`sbindir` variables.
Diffstat (limited to 'tests/integration')
-rw-r--r-- | tests/integration/compose-symlinks.py | 11 | ||||
-rw-r--r-- | tests/integration/symlinks.py | 10 |
2 files changed, 7 insertions, 14 deletions
diff --git a/tests/integration/compose-symlinks.py b/tests/integration/compose-symlinks.py index c6027bf2b..027feea7c 100644 --- a/tests/integration/compose-symlinks.py +++ b/tests/integration/compose-symlinks.py @@ -18,7 +18,7 @@ DATA_DIR = os.path.join( ) -# Test that staging a file inside a directory symlink works as expected. +# Test that staging a file inside a directory symlink fails. # # Regression test for https://gitlab.com/BuildStream/buildstream/issues/270 @pytest.mark.datafiles(DATA_DIR) @@ -34,11 +34,6 @@ def test_compose_symlinks(cli, tmpdir, datafiles): os.symlink(os.path.join('usr', 'sbin'), symlink_file, target_is_directory=True) result = cli.run(project=project, args=['build', 'compose-symlinks/compose.bst']) - result.assert_success() - result = cli.run(project=project, args=['artifact', 'checkout', 'compose-symlinks/compose.bst', - '--directory', checkout]) - result.assert_success() - - assert set(walk_dir(checkout)) == set(['/sbin', '/usr', '/usr/sbin', - '/usr/sbin/init', '/usr/sbin/dummy']) + assert result.exit_code == -1 + assert 'Destination is a symlink, not a directory: /sbin' in result.stderr diff --git a/tests/integration/symlinks.py b/tests/integration/symlinks.py index 22ff527f8..5674b5778 100644 --- a/tests/integration/symlinks.py +++ b/tests/integration/symlinks.py @@ -44,7 +44,7 @@ def test_absolute_symlinks_made_relative(cli, tmpdir, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') -def test_allow_overlaps_inside_symlink_with_dangling_target(cli, tmpdir, datafiles): +def test_disallow_overlaps_inside_symlink_with_dangling_target(cli, tmpdir, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) checkout = os.path.join(cli.directory, 'checkout') element_name = 'symlinks/dangling-symlink-overlap.bst' @@ -53,10 +53,8 @@ def test_allow_overlaps_inside_symlink_with_dangling_target(cli, tmpdir, datafil assert result.exit_code == 0 result = cli.run(project=project, args=['artifact', 'checkout', element_name, '--directory', checkout]) - assert result.exit_code == 0 - - # See the dangling-symlink*.bst elements for details on what we are testing. - assert_contains(checkout, ['/usr/orgs/orgname/etc/org.conf']) + assert result.exit_code == -1 + assert 'Destination is a symlink, not a directory: /opt/orgname' in result.stderr @pytest.mark.datafiles(DATA_DIR) @@ -75,4 +73,4 @@ def test_detect_symlink_overlaps_pointing_outside_sandbox(cli, tmpdir, datafiles # tries to actually write there. result = cli.run(project=project, args=['artifact', 'checkout', element_name, '--directory', checkout]) assert result.exit_code == -1 - assert "Destination path resolves to a path outside of the staging area" in result.stderr + assert 'Destination is a symlink, not a directory: /opt/escape-hatch' in result.stderr |