Very rare failure to expand Foreach-Variable

Alan DeKok aland at
Wed Feb 20 17:03:31 CET 2019

> On Feb 20, 2019, at 10:46 AM, Graham Clinch <g.clinch at> wrote:
> My observations of failures caught so far, based on 3.0.x rev 3e6e385:
> - The breakage happens before xlat_map() gets called.
> - (we have correct_escapes=yes in the configuration) main/xlat.c:xlat_aprint() calls lib/value.c:value_data_from_str() which returns -1 - causing xlat_aprint to return NULL before it's got to calling node->xlat->func().

  How is the input string wrong?  That's weird.

> So I want to investigate why lib/value.c:value_data_from_str() is very occasionally returning -1, but I'm hitting a wall as DEBUG statements added to lib/value.c don't seem to cause any visible output - is there a way to debug messages from inside the library?

  call fr_strerror_printf() to create a message.  Then from the calling function, call DEBUG("it failed; %s", fr_strerror().

  TBH, in these cases I also use this a lot:

	fprintf(stderr, "HERE %d\n", __LINE__);

  fprintf(stderr, ...) is better  than printf().  Because the output to stderr is flushed immediately.  The output to stdout is buffered, and therefore might not show up for a while.

  Alan DeKok.

More information about the Freeradius-Users mailing list