cli/dd: Write an O_APPEND stdout in order #130
@@ -308,6 +308,8 @@ resume_2:
|
||||
else
|
||||
{
|
||||
ofd = 1;
|
||||
// positional writes to an O_APPEND stdout (shell >>) still go to its end
|
||||
out_append = out_append || (fcntl(ofd, F_GETFL) & O_APPEND);
|
||||
}
|
||||
out_seekable = false;
|
||||
if (!out_append && lseek(ofd, 1, SEEK_SET) == (off_t)1)
|
||||
|
||||
@@ -94,6 +94,11 @@ if [[ -c /dev/net/tun && -r /dev/net/tun ]]; then
|
||||
else
|
||||
echo "SKIP: dd conv=noerror with a failing stream - /dev/net/tun is missing or not readable here"
|
||||
fi
|
||||
# stdout opened with O_APPEND (>>) is written in order, also with iodepth > 1
|
||||
cp ./testdata/over ./testdata/testfile1
|
||||
$VITASTOR_CLI dd iimg=testimg bs=64k iodepth=16 count=160 >> ./testdata/testfile1
|
||||
(cat ./testdata/over; head -c 10M ./testdata/testfile) | cmp - ./testdata/testfile1 || format_error "dd to an O_APPEND stdout misplaced the blocks"
|
||||
rm ./testdata/testfile1
|
||||
|
||||
# pipe in without count - copy to the end of input
|
||||
$VITASTOR_CLI dd iimg=testimg iodepth=4 | $VITASTOR_CLI dd of=./testdata/testfile1 iodepth=4
|
||||
|
||||
Reference in New Issue
Block a user