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


Groups > gnu.bash.bug > #14634

Re: bash sockets: printf \x0a does TCP fragmentation

Path csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From Ilkka Virta <itvirta@iki.fi>
Newsgroups gnu.bash.bug
Subject Re: bash sockets: printf \x0a does TCP fragmentation
Date Sat, 22 Sep 2018 13:38:06 +0300
Lines 19
Approved bug-bash@gnu.org
Message-ID <mailman.1134.1537612691.1284.bug-bash@gnu.org> (permalink)
References <c6de6616-dda0-570d-de56-419e7676be8a@cbii-hh.de> <69b48113-bc58-e0c8-a551-03a7e72d88d4@case.edu>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace usenet.stanford.edu 1537612692 19123 208.118.235.17 (22 Sep 2018 10:38:12 GMT)
X-Complaints-To action@cs.stanford.edu
Cc dirk+bash@testssl.sh, bug-bash@gnu.org
To chet.ramey@case.edu
Envelope-to bug-bash@gnu.org
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 Thunderbird/52.9.1
In-Reply-To <69b48113-bc58-e0c8-a551-03a7e72d88d4@case.edu>
Content-Language en-US
X-SASI-RCODE 200
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; h=subject:to:references:cc:from:message-id:date:mime-version:in-reply-to:content-type:content-transfer-encoding; s=smtp; bh=oQ/9jH+jf8Jb3omDjSDHAcaxpjiE73tE+WCuHMfgNrQ=; b=DxVzMlCvcbrO2dnqtYYz05/NzFeJQ75k2xa2dqZSiAybbcSg5iHmRFgj/uAImYSYNU3q4W2C19k4TPq51UoH/NYepeTi0YKVI/PKBn+JlqQiva91MRJR+Ck66VV+3jM5NnZKYun5DOrRdgpK4VnSqsR+LxcXqeP2qNCJfL94PGEthUS2PmO92cj5+Kcs/n4MAba+LH+fSuoMDCpjR/TRXb5KIDSbReArtmJWt4Lpxnpn7tJgQPxX5LYb0uM1sDVhXpGigEjv7RDU/iDvk03/iA7uhLPQDQXcmgHiko8qX/ZHo05AnemIANUv5u2GryYxAi7xrvmf/g+iTrR7c71iBA==
X-detected-operating-system by eggs.gnu.org: FreeBSD 8.x
X-Received-From 157.24.2.104
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.21
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 <http://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>
Xref csiph.com gnu.bash.bug:14634

Show key headers only | View raw


On 22.9. 02:34, Chet Ramey wrote:
> Newline? It's probably that stdout is line-buffered and the newline causes
> a flush, which results in a write(2).

Mostly out of curiosity, what kind of buffering logic does Bash (or the 
builtin printf in particular) use? It doesn't seem to be the usual stdio 
logic where you get line-buffering if printing to a terminal and block 
buffering otherwise. I get a distinct write per line even if the stdout 
of Bash itself is redirected to say /dev/null or a pipe:

  $ strace -etrace=write bash -c 'printf "foo\nbar\n"' > /dev/null
  write(1, "foo\n", 4)                    = 4
  write(1, "bar\n", 4)                    = 4
  +++ exited with 0 +++


-- 
Ilkka Virta / itvirta@iki.fi

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


Thread

Re: bash sockets: printf \x0a does TCP fragmentation Ilkka Virta <itvirta@iki.fi> - 2018-09-22 13:38 +0300

csiph-web