diff --git a/coverage.txt b/coverage.txt index 13fe9ca..437ff49 100644 --- a/coverage.txt +++ b/coverage.txt @@ -330,3 +330,5 @@ Needs-QEMU: true Test: error-if-stdout-is-tty Test: variant-custom-timeout + +Test: include-deb-file diff --git a/mmdebstrap b/mmdebstrap index ecc352a..65a4490 100755 --- a/mmdebstrap +++ b/mmdebstrap @@ -4282,7 +4282,7 @@ sub main() { } elsif ($opt_value =~ /^\.?\.?\//) { # Treat option as a single path name and don't split by comma # or whitespace -- append the normalized path. - push @{ $options->{include} }, sanitize_path($opt_value); + push @{ $options->{include} }, &{$sanitize_path}($opt_value); } else { for my $pkg (split /[,\s]+/, $opt_value) { # strip leading and trailing whitespace @@ -4294,7 +4294,7 @@ sub main() { # Make paths canonical absolute paths, resolve symlinks # and check if it's an existing file. if ($pkg =~ /^\.?\.?\//) { - $pkg = sanitize_path($pkg); + $pkg = &{$sanitize_path}($pkg); } push @{ $options->{include} }, $pkg; } diff --git a/tests/include-deb-file b/tests/include-deb-file new file mode 100644 index 0000000..a578948 --- /dev/null +++ b/tests/include-deb-file @@ -0,0 +1,21 @@ +#!/bin/sh + +set -eu +export LC_ALL=C.UTF-8 + +{{ CMD }} --variant=apt \ + --customize-hook='mkdir "$1"/tmp/apt' \ + --customize-hook='chroot "$1" env --chdir=/tmp/apt apt-get download busybox' \ + --customize-hook='copy-out /tmp/apt /tmp' \ + {{ DIST }} /dev/null {{ MIRROR }} +pkg="$(find /tmp/apt -type f)" +# some sanity checks +[ -f "$pkg" ] +case $pkg in + /tmp/apt/busybox*_{{ HOSTARCH }}.deb) : ;; + *) exit 1;; +esac +# now try to install that package +{{ CMD }} --variant=apt --include="$pkg" \ + --customize-hook='chroot "$1" dpkg-query -W -f="\${Status}\n" busybox | grep "^install ok installed$"' \ + {{ DIST }} /dev/null {{ MIRROR }}