Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16154

Re: How can redirection operator aka ">" open output in append instead of ordinary write mode?

From gentoo_eshoes@tutanota.com
Newsgroups gnu.bash.bug
Subject Re: How can redirection operator aka ">" open output in append instead of ordinary write mode?
Date 2020-04-17 22:10 +0200
Message-ID <mailman.538.1587154239.3066.bug-bash@gnu.org> (permalink)
References <M58ktqZ--3-2@tutanota.com>

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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:)

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: How can redirection operator aka ">" open output in append instead of ordinary write mode? gentoo_eshoes@tutanota.com - 2020-04-17 22:10 +0200

csiph-web