Re: bin/181153: sscanf doesn't skip whitespace properly

看板FB_bugs作者時間12年前 (2013/08/09 10:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串4/4 (看更多)
The following reply was made to PR kern/181153; it has been noted by GNATS. From: Andrey Chernov <ache@freebsd.org> To: Garrett Cooper <yaneurabeya@gmail.com> Cc: "FreeBSD-gnats-submit@FreeBSD.org" <freebsd-gnats-submit@freebsd.org> Subject: Re: bin/181153: sscanf doesn't skip whitespace properly Date: Fri, 09 Aug 2013 06:15:55 +0400 On 09.08.2013 6:03, Garrett Cooper wrote: >> I doubt this exampe should skip whitespace. POSIX says: >> "A directive that is an ordinary character shall be executed as follows: >> the next byte shall be read from the input and compared with the byte >> that comprises the directive; if the comparison shows that they are not >> equivalent, the directive shall fail, and the differing and subsequent >> bytes shall remain unread." >> %% is the ordinary % character and no isspace(3) skipping mentioned in >> this explanation. > > What about this line [*]? > > " > A directive composed of one or more white-space characters is executed > by reading input until no more valid input can be read, or up to the > first byte which is not a white-space character which remains unread. > " > > I think this is what the NetBSD test developer was shooting for originally. > > FWIW I did print out the value previously and it was (char)0, or '\0'. > > Thanks! > > * http://pubs.opengroup.org/onlinepubs/7908799/xsh/fscanf.html > I see another line here: http://pubs.opengroup.org/onlinepubs/9699919799/functions/sscanf.html (2013 Edition) "A directive that is a conversion specification defines a set of matching input sequences, as described below for each conversion character. A conversion specification shall be executed in the following steps. Input white-space characters (as specified by isspace) shall be skipped, unless the conversion specification includes a [, c, C, or n conversion specifier." Which is clearly not our case because %% is not a conversion, just ordinary character. And don't see there line your mentioned. Probably there still are skipping bugs with other %-modifiers, I don't inspect it carefully, but not with %%. -- http://ache.vniz.net/ bitcoin:1G6ugdNY6e5jx1GVnAU2ntj2NEfmjKG85r _______________________________________________ freebsd-bugs@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to "freebsd-bugs-unsubscribe@freebsd.org"
文章代碼(AID): #1I15IYIR (FB_bugs)
文章代碼(AID): #1I15IYIR (FB_bugs)