From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 1200F6DE1069 for ; Sun, 5 May 2019 02:18:21 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.442 X-Spam-Level: X-Spam-Status: No, score=0.442 tagged_above=-999 required=5 tests=[AWL=-0.210, SPF_NEUTRAL=0.652] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yqw7AYtBMCnE for ; Sun, 5 May 2019 02:18:19 -0700 (PDT) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by arlo.cworth.org (Postfix) with ESMTP id 7756A6DE1065 for ; Sun, 5 May 2019 02:18:18 -0700 (PDT) Received: from guru.guru-group.fi (localhost [IPv6:::1]) by guru.guru-group.fi (Postfix) with ESMTP id DE95E1000E3; Sun, 5 May 2019 12:18:13 +0300 (EEST) From: Tomi Ollila To: David Bremner , Rob Browning , notmuch@notmuchmail.org Subject: Re: [PATCH 1/2] test/raw: add some messages likely to be multiples of buffer size In-Reply-To: <20190505001027.28627-2-david@tethera.net> References: <20190428162906.20062-3-david@tethera.net> <20190505001027.28627-1-david@tethera.net> <20190505001027.28627-2-david@tethera.net> User-Agent: Notmuch/0.28.3+84~g41389bb (https://notmuchmail.org) Emacs/25.2.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 May 2019 09:18:21 -0000 On Sat, May 04 2019, David Bremner wrote: > This highlights a bug where zero bytes are read at the end of the > file, and we attempt to write those to stdout, causing spurious write > failures. > --- > test/T210-raw.sh | 35 +++++++++++++++++++++++++++++++++++ > 1 file changed, 35 insertions(+) > > diff --git a/test/T210-raw.sh b/test/T210-raw.sh > index 99fdef72..0d57deb5 100755 > --- a/test/T210-raw.sh > +++ b/test/T210-raw.sh > @@ -30,4 +30,39 @@ Date: GENERATED_DATE > > This is just a test message (#2)" > > +test_python < +from email.message import EmailMessage > +for pow in range(12,21): .......................^ space. i.e. (12, 21) from 4KiB to 1MiB. uh, perhaps I should have kept my fingers crossed. (that said, my range would have been 10, 17 (1024 - 65536)) > + size = 2**pow spaces around '**' > + msg=EmailMessage() spaces around '=' > + msg['Subject'] = 'message with {:07d} bytes'.format(size) > + msg['From'] = 'Notmuch Test Suite ' > + msg['To'] = msg['From'] > + msg['Message-Id'] = 'size-{0:07d}@notmuch-test-suite'.format(size) for consistencty, size-{:07d} (python 2.7+ supported format) ... > + content="" spaces > + msg.set_content("") > + padding = size - len(bytes(msg)) > + lines = [] > + while padding > 0: > + line = '.' * min(padding, 72) > + lines.append(line) > + padding = padding - len(line) - 1 > + content ='\n'.join(lines) > + msg.set_content(content) > + with open('mail/size-{0:07d}'.format(size),'wb') as f: size-{:07d} , space before 'wb' > + f.write(bytes(msg)) > +EOF > + > +notmuch new --quiet > + > +for pow in $(seq 12 20); do {12..20} would do the above seq, w/o 2 forks and one execve :D > + size=$(printf "%07d" $((2**$pow))) printf -v size "%07d" $((2 ** pow)) > + test_begin_subtest "content, message of size $size" > + notmuch show --format=raw subject:$size > OUTPUT > + test_expect_equal_file mail/size-$size OUTPUT > + test_begin_subtest "return value, message of size $size" > + test_subtest_known_broken > + test_expect_success "notmuch show --format=raw subject:$size > /dev/null" > +done > + > test_done > -- > 2.20.1