From 6f8bb8c9775ce96fbbd6b45209788d7c39e47067 Mon Sep 17 00:00:00 2001 From: Johannes 'josch' Schauer Date: Sun, 20 Jan 2019 10:39:45 +0100 Subject: [PATCH] since copy() is using syswrite(), we must flush the filehandle before calling it --- coverage.sh | 10 ++++++---- mmdebstrap | 6 ++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/coverage.sh b/coverage.sh index 34294f2..6711989 100755 --- a/coverage.sh +++ b/coverage.sh @@ -419,8 +419,9 @@ cat << END > shared/test.sh #!/bin/sh set -eu export LC_ALL=C.UTF-8 -$CMD --mode=root --variant=apt --aptopt="Acquire::Check-Valid-Until false" unstable /tmp/debian-unstable $mirror -echo "Acquire::Check-Valid-Until false;" | cmp /tmp/debian-unstable/etc/apt/apt.conf.d/99mmdebstrap - +echo 'Acquire::Languages "none";' > config +$CMD --mode=root --variant=apt --aptopt='Acquire::Check-Valid-Until "false"' --aptopt=config unstable /tmp/debian-unstable $mirror +printf 'Acquire::Check-Valid-Until "false";\nAcquire::Languages "none";\n' | cmp /tmp/debian-unstable/etc/apt/apt.conf.d/99mmdebstrap - rm /tmp/debian-unstable/etc/apt/apt.conf.d/99mmdebstrap tar -C /tmp/debian-unstable --one-file-system -c . | tar -t | sort > tar2.txt diff -u tar1.txt tar2.txt @@ -437,8 +438,9 @@ cat << END > shared/test.sh #!/bin/sh set -eu export LC_ALL=C.UTF-8 -$CMD --mode=root --variant=apt --dpkgopt="path-exclude=/usr/share/doc/*" unstable /tmp/debian-unstable $mirror -echo "path-exclude=/usr/share/doc/*" | cmp /tmp/debian-unstable/etc/dpkg/dpkg.cfg.d/99mmdebstrap - +echo no-pager > config +$CMD --mode=root --variant=apt --dpkgopt="path-exclude=/usr/share/doc/*" --dpkgopt=config unstable /tmp/debian-unstable $mirror +printf 'path-exclude=/usr/share/doc/*\nno-pager\n' | cmp /tmp/debian-unstable/etc/dpkg/dpkg.cfg.d/99mmdebstrap - rm /tmp/debian-unstable/etc/dpkg/dpkg.cfg.d/99mmdebstrap tar -C /tmp/debian-unstable --one-file-system -c . | tar -t | sort > tar2.txt grep -v '^./usr/share/doc/.' tar1.txt | diff -u - tar2.txt diff --git a/mmdebstrap b/mmdebstrap index 95c0dc0..c396f02 100755 --- a/mmdebstrap +++ b/mmdebstrap @@ -963,6 +963,9 @@ sub setup { open my $fh, '>', "$options->{root}/etc/apt/apt.conf.d/99mmdebstrap" or error "cannot open /etc/apt/apt.conf.d/99mmdebstrap: $!"; foreach my $opt (@{$options->{aptopts}}) { if (-r $opt) { + # flush handle because copy() uses syswrite() which bypasses + # buffered IO + $fh->flush(); copy $opt, $fh or error "cannot copy $opt: $!"; } else { print $fh $opt; @@ -983,6 +986,9 @@ sub setup { open my $fh, '>', "$options->{root}/etc/dpkg/dpkg.cfg.d/99mmdebstrap" or error "cannot open /etc/dpkg/dpkg.cfg.d/99mmdebstrap: $!"; foreach my $opt (@{$options->{dpkgopts}}) { if (-r $opt) { + # flush handle because copy() uses syswrite() which bypasses + # buffered IO + $fh->flush(); copy $opt, $fh or error "cannot copy $opt: $!"; } else { print $fh $opt;