From: Alyssa Ross <hi@alyssa.is>
To: Florian Weimer <fw@deneb.enyo.de>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH] stdio: fix vfscanf with matches longer than INT_MAX (bug 27650)
Date: Fri, 26 Mar 2021 12:00:08 +0000 [thread overview]
Message-ID: <87czvm86rb.fsf@alyssa.is> (raw)
In-Reply-To: <87blb7j59p.fsf@mid.deneb.enyo.de>
[-- Attachment #1: Type: text/plain, Size: 1531 bytes --]
Florian Weimer <fw@deneb.enyo.de> writes:
>> Oh, thanks for telling me about fopencookie! I'd never have known about
>> that otherwise. I've started having a go at a test case using it and it
>> seems like it'll work well.
>
> Or you could test sscanf via <support/blob_repeat.h> on 64-bit
> architectures. It would avoid the repeated memcpy calls, at the cost
> of an initial strlen on the entire buffer.
Would that be a problem on 32-bit? We'd only need to map
INT_MAX bytes + 1 page, so the other half of the address space would be
enough for everything else, wouldn't it?
>> One question about the test: fscanf-ing through INT_MAX characters on a
>> trivial memcpy-based fopencookie stream takes 20 seconds on my
>> (admittedly fairly old) machine. How slow is too slow for a test?
>
> Opinions on that vary. Twenty seconds is stretching things as far as
> I'm concerned. I guess it depends what you mean by “fairly old”.
>
> We have a second category of tests, xtests, that only run with “make
> xcheck”. We could put the test there if it takes too long to run
> otherwise.
That machine is a laptop from 2012. On my other laptop, from 2017, it
takes <5 seconds, and the fopencookie and blob_repeat versions aren't
really distinguishable from each other in terms of time taken. I would
like to go with the blob_repeat version if it'll work everywhere,
though, because not having to write a custom stream implementation makes
the test a lot shorter and easier to understand.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2021-03-26 12:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-25 14:01 Alyssa Ross
2021-03-25 17:25 ` Florian Weimer
2021-03-25 20:28 ` Alyssa Ross
2021-03-25 21:24 ` Florian Weimer
2021-03-26 12:00 ` Alyssa Ross [this message]
2021-03-26 12:17 ` Florian Weimer
2021-03-29 12:01 ` Alyssa Ross
2021-03-29 13:34 ` Florian Weimer
2021-03-29 18:06 ` [PATCH 2/2] stdio: add test for scanf " Alyssa Ross
2021-05-09 21:56 ` Alyssa Ross
2021-05-03 8:57 ` [PATCH] stdio: fix vfscanf with " Florian Weimer
2021-05-09 16:32 ` Alyssa Ross
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87czvm86rb.fsf@alyssa.is \
--to=hi@alyssa.is \
--cc=fw@deneb.enyo.de \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).