Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Aug 2013 00:15:41 GMT
From:      Garrett Cooper <yaneurabeya@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/181152: %i fails with negative hex numbers with sscanf
Message-ID:  <201308090015.r790Ffau041019@oldred.freebsd.org>
Resent-Message-ID: <201308090020.r790K0Ou019676@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         181152
>Category:       bin
>Synopsis:       %i fails with negative hex numbers with sscanf
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Aug 09 00:20:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Garrett Cooper
>Release:        10-CURRENT
>Organization:
EMC Isilon
>Environment:
FreeBSD fuji-current.local 10.0-CURRENT FreeBSD 10.0-CURRENT #10 c9d2bd6-dirty: Wed Aug  7 18:55:03 PDT 2013     root@fuji-current.local:/usr/obj/usr/src/sys/FUJI-NOCOMPAT  i386
>Description:
Looks like FreeBSD has lib/21691:

    sscanf_neghex: [0.001912s] Failed: /usr/src/lib/libc/tests/stdio/t_scanf.c:50: i == NUM not met

The snippet of test code that exhibits this is:

#define NUM     -0x1234
#define STRNUM  __STRING(NUM)

ATF_TC(sscanf_neghex);
ATF_TC_HEAD(sscanf_neghex, tc)
{
        atf_tc_set_md_var(tc, "descr",
            "PR lib/21691: %%i and %%x fail with negative hex numbers");
}

ATF_TC_BODY(sscanf_neghex, tc)
{
        int i;

        sscanf(STRNUM, "%i", &i);
        ATF_REQUIRE(i == NUM);

        sscanf(STRNUM, "%x", &i);
        ATF_REQUIRE(i == NUM);
}
>How-To-Repeat:

>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308090015.r790Ffau041019>