=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mg/log.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- src/usr.bin/mg/log.c 2019/06/12 18:21:07 1.5 +++ src/usr.bin/mg/log.c 2019/06/14 14:27:42 1.6 @@ -1,4 +1,4 @@ -/* $OpenBSD: log.c,v 1.5 2019/06/12 18:21:07 lum Exp $ */ +/* $OpenBSD: log.c,v 1.6 2019/06/14 14:27:42 lum Exp $ */ /* * This file is in the public domain. @@ -21,6 +21,20 @@ * written in the spirit of debugging (quickly and perhaps not ideal, * but it does what is required well enough). Should debugging become * more formalised within mg, then I would expect that to change. + * + * If you open a file with long lines to run through this debugging + * code, you may run into problems with the 1st fprintf statement in + * in the mglog_lines() function. mg sometimes segvs at a strlen call + * in fprintf - possibly something to do with the format string? + * "%s%p b^%p f.%p %d %d\t%c|%s\n" + * When I get time I will look into it. But since my debugging + * generally revolves around a file like: + * + * abc + * def + * ghk + * + * I don't experience this bug. Just note it for future investigation. */ #include @@ -156,6 +170,7 @@ else tmp = lp->l_text; + /* segv on fprintf below with long lines */ if (fprintf(fd, "%s%p b^%p f.%p %d %d\t%c|%s\n", curline, lp, lp->l_bp, lp->l_fp, lp->l_size, lp->l_used, o, tmp) == -1) {