containers / BuildSourceImage

Tool to build a source image based on an existing OCI image
GNU General Public License v2.0
29 stars 14 forks source link

bug: symlink inside the source layer is not relative #44

Closed vbatts closed 5 years ago

vbatts commented 5 years ago

currently:

[vbatts@beats] {master} ~/src/github.com/containers/BuildSourceImage$ tar tvf output/blobs/sha256/5893f32b044b6350829dfba5c52705eb0d87754c972d5c9d0e4068210604f42e
drwxrw-rw- root/root         0 1969-12-31 19:00 ./
drwxrwxrwx root/root         0 1969-12-31 19:00 ./blobs/
drwxrwxrwx root/root         0 1969-12-31 19:00 ./blobs/sha256/
-rw-rw-rw- root/root     26435 1969-12-31 19:00 ./blobs/sha256/b7a2184993940e9834c0fc578b4dff11889a3bb20055bc78ecada1924325a789
drwxrwxrwx root/root         0 1969-12-31 19:00 ./rpm_dir/
lrwxrwxrwx root/root         0 1969-12-31 19:00 ./rpm_dir/libutempter-1.1.6-16.fc30.src.rpm -> /blobs/sha256/b7a2184993940e9834c0fc578b4dff11889a3bb20055bc78ecada1924325a789

Though that symlink from the expected file name is pointing to /blobs/sha256/ which unless this is extracted at the root of a filesystem, will be a broken link.

This instead should be relative like ./rpm_dir/libutempter-1.1.6-16.fc30.src.rpm -> ../blobs/sha256/b7a2184993940e9834c0fc578b4dff11889a3bb20055bc78ecada1924325a789. The only accounting here needs to be if we'll allow for nested directories, and that path may be more than just ../ prefixed.