canonical/chisel

Chisel dies on symlink when run for second time

woky opened this issue · 0 comments

woky commented

Chisel version: 2b260842c9c

Currently chisel cannot be run repeatedly on already populated output directory when there are symlinks. IOW chisel run is not idempotent.

Example slice (libc6_libs dependency omitted for brevity):

$ cat slices/libkeyutils1.yaml 
package: libkeyutils1

slices:
  libs:
    contents:
      /lib/x86_64-linux-gnu/libkeyutils.so.*:

First run is OK:

$ mkdir output
$ chisel cut --release . --root output/ libkeyutils1_libs
...
2022/06/03 12:16:25 Extracting files from package "libkeyutils1"...
$ tree --noreport -p output/
[drwxrwxr-x]  output/
└── [drwxr-xr-x]  lib
    └── [drwxr-xr-x]  x86_64-linux-gnu
        ├── [lrwxrwxrwx]  libkeyutils.so.1 -> libkeyutils.so.1.9
        └── [-rw-r--r--]  libkeyutils.so.1.9

Second run fails (no changes in output/):

$ chisel cut --release . --root output/ libkeyutils1_libs
...
2022/06/03 12:17:03 Extracting files from package "libkeyutils1"...
error: cannot extract from package "libkeyutils1": symlink libkeyutils.so.1.9 output/lib/x86_64-linux-gnu/libkeyutils.so.1: file exists