canonical / canonical/chisel

Paths from slice dependency are not preserved (symlink vs directory)

Open
#3 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
424
Forks
65
Avg merge
12d 19h
Merged PRs (30d)
1

Description

[NOTE: I'm telling chisel to create `/lib` symlink because `base-files` contains it not as a symlink but as a directory and dotnet package needs that to be a symlink because the `dotnet` executable links to `/lib/x86_64-linux-gnu/libstdc++.so.6` but `libstdc++6` package installs it in `/usr/lib/x86_64-linux-gnu/libstdc++.so.6`. On Ubuntu `usrmerge` package does the job in postinst but we don't have that so that's why I'm creating the symlink manually. (To make dotnet work.)]

When a slice lists a path entry as a symlink to directory and some other slice depends on it and installs its files into symlink, the symlink is not preserved but instead a directory is created at that path. Example:

Configuration:
```
$ tail release/slices/*
==> release/slices/base-files.yaml <==
package: base-files
slices:
lib:
contents:
/lib: { symlink: /usr/lib }
/usr/lib/:

==> release/slices/libc6.yaml <==
package: libc6
slices:
libs:
essential:
- base-files_lib
contents:
/lib/x86_64-linux-gnu/libc.so.6:
```

In this snippet you can see that `/lib` is not a symlink even though `libc6_libs` depends on `base-files_lib` which should create it.
```
$ rm -rf output && mkdir output
$ chisel cut --release release/ --root output/ base-files_lib libc6_libs
...
2022/06/02 10:39:14 Extracting files from package "base-files"...
2022/06/02 10:39:14 Extracting files from package "libc6"...
$ tree --noreport output/
output/
├── lib
│   └── x86_64-linux-gnu
│   └── libc.so.6
└── usr
└── lib
```

In this snippet you can see that `/lib` is created as symlink when no other slice installing files at that path is being installed. But afterwards it fails to install because of the symlink:
```
$ rm -rf output && mkdir output
$ chisel cut --release release/ --root output/ base-files_lib >/dev/null
...
2022/06/02 10:38:46 Extracting files from package "base-files"...
$ tree --noreport output/
output/
├── lib -> /usr/lib
└── usr
└── lib
$ chisel cut --release release/ --root output/ libc6_libs
...
2022/06/02 10:38:58 Extracting files from package "base-files"...
2022/06/02 10:38:58 Extracting files from package "libc6"...
error: cannot extract files from package "libc6": open output/lib/x86_64-linux-gnu/libc.so.6: permission denied
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.