bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How can redirection operator aka ">" open output in append instead o


From: gentoo_eshoes
Subject: Re: How can redirection operator aka ">" open output in append instead of ordinary write mode?
Date: Fri, 17 Apr 2020 22:10:31 +0200 (CEST)

the only issue I've encountered with this so far is that 'dd' will fail some of 
its tests because it's not using of=  but instead using the redir operator and 
then it assumes it's NOT open in append mode ;)) so then it tries to seek past 
EOF (which doesn't work in append mode) to make holes(of zeroes).

to illustrate:
$ rm /tmp/out;echo abcdefghijklm | dd bs=5 seek=8 oflag=seek_bytes > /tmp/out ; 
stat --format=%s /tmp/out
2+1 records in
2+1 records out
14 bytes copied, 0.0001584 s, 88.4 kB/s
Actually written to disk: '14' bytes (100.00%). 
14

the normal output should be(ie. file size 22 bytes not 14):                     
                          
$ rm /tmp/out;echo abcdefghijklm | dd bs=5 seek=8 oflag=seek_bytes > /tmp/out ; 
stat --format=%s /tmp/out
2+1 records in
2+1 records out
14 bytes copied, 0.000112444 s, 125 kB/s
Actually written to disk: '14' bytes (100.00%). 
22

Not to worry though, I'm "sure" I pulled a Curly in Three Stooges episode 
titled "A Plumbing We Will Go." when I added a kernel patch for this (attached) 
which ensures `cannot seek: Illegal seek` when trying to go beyond EOF in 
O_APPEND mode.

In a completely unrelated note, this cool Exolon theme/music, listening to it 
right now: https://www.youtube.com/watch?v=Gfw-CIEM6Zs
ah memories:)

Attachment: always_append_on_redirection.patch
Description: Text Data

Attachment: deny_lseek_past_EOF_when_O_APPEND.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]