Page MenuHome GnuPG

GnuPG: Parse Paket prints source file name very verbosely
Open, LowPublic

Description

The debug output in parse_packet repeatedly prints the full path of the source file.

This is unusual and probably something more left over from debugging.

2019-09-13 17:05:12 gpg[788] DBG: parse_packet(iob=7): type=12 length=6 (parse./home/wk/b/gnupg-2.2/dist/PLAY-release/gnupg-w32-2.2.17/g10/keydb.c.1242)

Noticed with version 2.2.17

Details

Version
2.2.17

Event Timeline

Well that is due to "--debug packet" (aka --debug 1). We have this code

  #if DEBUG_PARSE_PACKET
      log_debug ("parse_packet(iob=%d): type=%d length=%lu%s (%s.%s.%d)\n",
		 iobuf_id (inp), pkttype, pktlen, new_ctb ? " (new_ctb)" : "",
		 dbg_w, dbg_f, dbg_l);
  #else
      log_debug ("parse_packet(iob=%d): type=%d length=%lu%s\n",
		 iobuf_id (inp), pkttype, pktlen,
		 new_ctb ? " (new_ctb)" : "");
  #endif

and DEBUG_PARSE_PACKET has always been set. The thing works having the callers pass file and line infor down to the packet parser. We can disable this but this means, less informative debug output and worse, it has not been disabled for 17 year, so the new code paths may introduce unrelated bugs.

I would propose to the replace the use of __FILE__ by __func__ which even makes debugging easier. Meanwhile we require some C99 features and this is no portability problem anymore.