aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pkg/bindings/images/build.go2
-rw-r--r--test/system/070-build.bats14
2 files changed, 12 insertions, 4 deletions
diff --git a/pkg/bindings/images/build.go b/pkg/bindings/images/build.go
index b56afbceb..346d55c47 100644
--- a/pkg/bindings/images/build.go
+++ b/pkg/bindings/images/build.go
@@ -450,7 +450,7 @@ func nTar(excludes []string, sources ...string) (io.ReadCloser, error) {
hdr.Typeflag = tar.TypeLink
hdr.Linkname = orig
hdr.Size = 0
-
+ hdr.Name = name
return tw.WriteHeader(hdr)
}
f, err := os.Open(path)
diff --git a/test/system/070-build.bats b/test/system/070-build.bats
index 9e1559013..0f3f3fa7f 100644
--- a/test/system/070-build.bats
+++ b/test/system/070-build.bats
@@ -768,19 +768,27 @@ EOF
@test "podman build COPY hardlinks " {
tmpdir=$PODMAN_TMPDIR/build-test
- mkdir -p $tmpdir
+ subdir=$tmpdir/subdir
+ subsubdir=$subdir/subsubdir
+ mkdir -p $subsubdir
dockerfile=$tmpdir/Dockerfile
cat >$dockerfile <<EOF
FROM $IMAGE
COPY . /test
EOF
- ln $dockerfile $tmpdir/hardlink
+ ln $dockerfile $tmpdir/hardlink1
+ ln $dockerfile $subdir/hardlink2
+ ln $dockerfile $subsubdir/hardlink3
run_podman build -t build_test $tmpdir
run_podman run --rm build_test stat -c '%i' /test/Dockerfile
dinode=$output
- run_podman run --rm build_test stat -c '%i' /test/hardlink
+ run_podman run --rm build_test stat -c '%i' /test/hardlink1
+ is "$output" "$dinode" "COPY hardlinks work"
+ run_podman run --rm build_test stat -c '%i' /test/subdir/hardlink2
+ is "$output" "$dinode" "COPY hardlinks work"
+ run_podman run --rm build_test stat -c '%i' /test/subdir/subsubdir/hardlink3
is "$output" "$dinode" "COPY hardlinks work"
run_podman rmi -f build_test