diff options
author | Anita Zhang <the.anitazha@gmail.com> | 2019-12-17 01:08:04 -0800 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-12-17 23:14:53 +0900 |
commit | 1209ef94bd09bdc67a7b51f084910a5982f2f010 (patch) | |
tree | 394c941daef8aba42d761cd622ec84a0871208f2 /test/TEST-25-IMPORT | |
parent | 4d92039fceed9645abdd1dc1b4e4d9aa47429b4d (diff) | |
download | systemd-1209ef94bd09bdc67a7b51f084910a5982f2f010.tar.gz |
[import] fix stdin/stdout pipe behavior in import/export tar/raw
The code existed in machinectl to use stdin/stdout if the path for
import/export tar/raw was empty or dash (-) but a check to
`fd_verify_regular` in importd prevented it from working.
Update the check instead to explicitly check for regular file or
pipe/fifo.
Fixes #14346
Diffstat (limited to 'test/TEST-25-IMPORT')
-rwxr-xr-x | test/TEST-25-IMPORT/testsuite.sh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/TEST-25-IMPORT/testsuite.sh b/test/TEST-25-IMPORT/testsuite.sh index 380ba3d82d..d4efd71e06 100755 --- a/test/TEST-25-IMPORT/testsuite.sh +++ b/test/TEST-25-IMPORT/testsuite.sh @@ -119,6 +119,18 @@ machinectl remove scratch4 ! test -f /var/lib/machines/scratch4 ! machinectl image-status scratch4 +# Test import-tar hypen/stdin pipe behavior +cat /var/tmp/scratch.tar.gz | machinectl import-tar - scratch5 +test -d /var/lib/machines/scratch5 +machinectl image-status scratch5 +diff -r /var/tmp/scratch/ /var/lib/machines/scratch5 + +# Test export-tar hypen/stdout pipe behavior +mkdir -p /var/tmp/extract +machinectl export-tar scratch5 - | tar xvf - -C /var/tmp/extract/ +diff -r /var/tmp/scratch/ /var/tmp/extract/ +rm -rf /var/tmp/extract + rm -rf /var/tmp/scratch echo OK > /testok |