[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: "null format string" warnings on trunk - what to do?

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Fri, 04 Apr 2008 11:17:58 +0100

Stefan Sperling wrote:
> Hi,
> I'm getting these warnings compiling current trunk:
> subversion/svn/util.c: In function 'svn_cl__merge_file_externally':
> subversion/svn/util.c:245: warning: null format string
> subversion/svnadmin/main.c: In function 'subcommand_setuuid':
> subversion/svnadmin/main.c:1059: warning: null format string
> subversion/libsvn_ra_svn/cyrus_auth.c: In function 'svn_ra_svn__get_addresses':
> subversion/libsvn_ra_svn/cyrus_auth.c:694: warning: null format string
> subversion/libsvn_ra_svn/cyrus_auth.c:698: warning: null format string
> subversion/libsvn_ra_svn/cyrus_auth.c:702: warning: null format string
> subversion/libsvn_ra_svn/cyrus_auth.c:706: warning: null format string
> In all these cases, the argument supplied to the functions in
> question is indeed simply NULL.
> I don't know whether we should ignore these warnings or not.

The second one is wrong because svn_error_createf() isn't specified as allowing
NULL for its format argument. In fact it's demonstrably wrong:

$ svnadmin setuuid a b c
Segmentation fault

(It's not a big deal because the bug is in the "svnadmin" program in an
erroneous usage situation (too many arguments), and not in a library function.)

Fixed in r30256.

The rest are harmless but could be improved. svn_error_wrap_apr() is defined as
accepting a null format string:

/** Wrap a @a status from an APR function. If @a fmt is NULL, this is
  * equivalent to svn_error_create(status,NULL,NULL). Otherwise,
  * [...]
svn_error_t *svn_error_wrap_apr(apr_status_t status, const char *fmt, ...)
        __attribute__((format(printf, 2, 3)));

The "__attribute__" tells the compiler otherwise. We could change something
here... and/or just stop calling it with NULL and use
svn_error_create(status,NULL,NULL) instead.

- Julian

To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-04-04 12:18:16 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.