From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.6 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id DE8881F8C8 for ; Wed, 22 Sep 2021 18:55:58 +0000 (UTC) Received: from localhost ([::1]:58930 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mT7PR-0003eG-VF for normalperson@yhbt.net; Wed, 22 Sep 2021 14:55:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47464) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mT6xY-0004EF-HD for bug-gnulib@gnu.org; Wed, 22 Sep 2021 14:27:08 -0400 Received: from mta-tor-004.bell.net ([209.71.212.31]:19450 helo=cmx-torrgo002.bell.net) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mT6xW-0004Wy-Pu for bug-gnulib@gnu.org; Wed, 22 Sep 2021 14:27:08 -0400 X-RG-CM-BuS: 0 X-RG-CM-SC: 0 X-RG-CM: Clean X-Originating-IP: [70.52.221.220] X-RG-Env-Sender: dave.anglin@bell.net X-RG-Rigid: 60C8802C05B2FCAE X-CM-Envelope: MS4xfFJip5KAZppf+5NwU4+iQIPNiM89CdORVWLwEYXxrgLATcXxaWQinJcDNZKKBVXl8gy35HV4z/fS4bBicJf1EQOoTE+uf1xKZeQ9eqBM/7Rk3JfyfHPA BztMgqxcPEaBNbmor60fvQpSTcPQjUxfRRhftr0HpXrQkUzQleE+kvlSmZTNgmeclAIC6pHqoVHPCUHoIJuyFE+pRlzJeFTirLCmczHAWj+MYpiQU7Vtyce3 PGa/Vln4e4mOk/ypjUyG1A== X-CM-Analysis: v=2.4 cv=Zd5+iuZA c=1 sm=1 tr=0 ts=614b7579 a=YO5NLpPX/y/Fbmk87HoZTg==:117 a=YO5NLpPX/y/Fbmk87HoZTg==:17 a=IkcTkHD0fZMA:10 a=FBHGMhGWAAAA:8 a=fC2qCOkQrTfId8tGrOIA:9 a=QEXdDO2ut3YA:10 a=9gvnlMMaQFpL9xblJ6ne:22 Received: from [192.168.2.49] (70.52.221.220) by cmx-torrgo002.bell.net (5.8.716.03) (authenticated as dave.anglin@bell.net) id 60C8802C05B2FCAE; Wed, 22 Sep 2021 14:27:05 -0400 To: "bug-gnulib@gnu.org List" From: John David Anglin Subject: snprintf function is not C99 compliant on PA-RISC HP-UX 11.00 through 11.11 Message-ID: <8fef0faa-3a5f-4ae6-bcc2-b4a387379747@bell.net> Date: Wed, 22 Sep 2021 14:27:05 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=209.71.212.31; envelope-from=dave.anglin@bell.net; helo=cmx-torrgo002.bell.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" When I run configure on applications using the gnulib (e.g., bison), I get the following defines in config.h: /* Define if the return value of the snprintf function is the number of of bytes (excluding the terminating NUL) that would have been produced if the buffer had been large enough. */ #define HAVE_SNPRINTF_RETVAL_C99 1 /* Define if the string produced by the snprintf function is always NUL terminated. */ #define HAVE_SNPRINTF_TRUNCATION_C99 1 The HAVE_SNPRINTF_RETVAL define is definitely incorrect for HP-UX 11.11: RETURN VALUE Each function returns the number of bytes transmitted (excluding the \0 in the case of sprintf() or a negative value if an output error was encountered. I would not trust that the string is always null terminated when an error occurs. The behavior on 11.31 may be correct when application is compiled for UNIX 2003 but maybe it's best to assume snprintf is not C99 compliant on all versions of HP-UX. Changing the defines as follows seems to work fine: /* Define if the return value of the snprintf function is the number of of bytes (excluding the terminating NUL) that would have been produced if the buffer had been large enough. */ /* #undef HAVE_SNPRINTF_RETVAL_C99 */ /* Define if the string produced by the snprintf function is always NUL terminated. */ /* #undef HAVE_SNPRINTF_TRUNCATION_C99 */ Haven't had time to find why the configure ouput is wrong. Dave -- John David Anglin dave.anglin@bell.net