| 1 |
Test that link errors cause the build to fail. |
| 2 |
|
| 3 |
If the directory containing the symlink is made non-writable, unlinking the |
| 4 |
symlink before hardlinking will fail with EACCES. |
| 5 |
|
| 6 |
$ make_lockdir |
| 7 |
|
| 8 |
$ make_lockpkg foo <<EOF |
| 9 |
> (version 0.0.1) |
| 10 |
> (build |
| 11 |
> (system "\ |
| 12 |
> mkdir -p %{lib}/%{pkg-self:name} \ |
| 13 |
> && printf 'real content\n' > %{lib}/%{pkg-self:name}/real.txt \ |
| 14 |
> && ln -s real.txt %{lib}/%{pkg-self:name}/link.txt \ |
| 15 |
> && touch %{lib}/%{pkg-self:name}/META \ |
| 16 |
> && chmod -w %{lib}/%{pkg-self:name}")) |
| 17 |
> EOF |
| 18 |
|
| 19 |
$ cat > dune-project <<EOF |
| 20 |
> (lang dune 3.22) |
| 21 |
> (package |
| 22 |
> (name x) |
| 23 |
> (allow_empty) |
| 24 |
> (depends foo)) |
| 25 |
> EOF |
| 26 |
|
| 27 |
Build fails with a symlink resolution error: |
| 28 |
|
| 29 |
$ build_pkg foo 2>&1 | sanitize_pkg_digest foo.0.0.1 | dune_cmd subst '\.sandbox/[^/]+' '.sandbox/SANDBOX' |
| 30 |
Error: |
| 31 |
unlink(_build/.sandbox/SANDBOX/_private/default/.pkg/foo.0.0.1-DIGEST_HASH/target/lib/foo/link.txt): Permission denied |
| 32 |
-> required by |
| 33 |
_build/_private/default/.pkg/foo.0.0.1-DIGEST_HASH/target |
| 34 |
[1] |
| 35 |
|
| 36 |
Restore permissions for cleanup: |
| 37 |
|
| 38 |
$ chmod -R +w _build 2>/dev/null; rm -rf _build |