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?

Path csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
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 Fri, 17 Apr 2020 22:10:31 +0200 (CEST)
Lines 185
Approved bug-bash@gnu.org
Message-ID <mailman.538.1587154239.3066.bug-bash@gnu.org> (permalink)
References <M58ktqZ--3-2@tutanota.com>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type multipart/mixed; boundary="----=_Part_71243_1918066042.1587154231401"
X-Trace usenet.stanford.edu 1587154239 15377 209.51.188.17 (17 Apr 2020 20:10:39 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1587154231; s=s1; d=tutanota.com; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Cc:Date:Date:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:Sender; bh=cgDIr5R73oFer8U44bvRmq721i6zSLwEuX2gOsc9c8A=; b=F+RPHizSwgQnUX4BI7D1ZSkqT5ss/ghBmOVlfHdlfr571DsDEaK56Q7I9wyvAnVI WaxBGSJAMknn6E4iLEjrYeGPwlCwW7SRJIcghtDUkrTu3xFqiTzkIPKAjJZqSJ/YyDq nDP2SGQjGlbENnln8XPdM+ceQgN92B6m3/PTgtebLYENB1JMBVj3GW1zUnuYi7WfG2H yZ98KEG7/rUZjVuAx0oOts1oZCNIrG5ez6NxK4OwlnIyYWxn8jSQAh8E5ZapEQxQdEy OH301CO86ZOXHQAA9WppgklBxypTp6DkiW8WMxh3fIbigg41a2C7SmsWNQYTRIf7h76 bukdojtayw==
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy]
X-Received-From 81.3.6.162
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <M58ktqZ--3-2@tutanota.com>
Xref csiph.com gnu.bash.bug:16154

Show key headers only | 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