NetBSD Problem Report #55311

From  Thu May 28 10:12:20 2020
Return-Path: <>
Received: from ( [])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "", Issuer " CA" (not verified))
	by (Postfix) with ESMTPS id B75381A9227
	for <>; Thu, 28 May 2020 10:12:20 +0000 (UTC)
Message-Id: <>
Date: Thu, 28 May 2020 10:12:19 +0000 (UTC)
Subject: compilation error (CURRENT, amd64) in /usr/src/external/bsd/ntp/dist/ntpd/ntp_refclock.c, line 1749 : format string is not a string literal
X-Send-Pr-Version: www-1.0

>Number:         55311
>Category:       bin
>Synopsis:       compilation error (CURRENT, amd64) in /usr/src/external/bsd/ntp/dist/ntpd/ntp_refclock.c, line 1749 : format string is not a string literal
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu May 28 10:15:00 +0000 2020
>Originator:     Rares Aioanei
>Release:        CURRENT
Issue is with the fmt argument to vsnprintf, although the warning is totally harmless and the only reason this fails is because we compile with -Werror. 
try to compile today's CURRENT amd64 with clang
I suggest using a pragma locally inside refclock_vformat_lcode(). Not a big fan of pragmas, but in this case it is harmless. So the code would look like this : 

        struct refclockproc *   pp,
        char const *            fmt,
        va_list                 va
        long len;

        #pragma clang diagnostic push
        #pragma clang diagnostic ignored "-Wformat-nonliteral"

        len = vsnprintf(pp->a_lastcode, sizeof(pp->a_lastcode), fmt, va);
        if (len <= 0)
                len = 0;
        else if ((size_t)len >= sizeof(pp->a_lastcode))
                len = sizeof(pp->a_lastcode) - 1;

        pp->lencode = (u_short)len;
        pp->a_lastcode[len] = '\0';
        /* !note! the NUL byte is needed in case vsnprintf() really fails */
        #pragma clang diagnostic pop

The only changes are the #pragma directives, nothing else, which means no functional changes of any kind. 

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD:,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.