summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorMark Lumsden <lum@cvs.openbsd.org>2019-06-14 14:27:43 +0000
committerMark Lumsden <lum@cvs.openbsd.org>2019-06-14 14:27:43 +0000
commitb58d97e33912a946005fd53e87508de9ebec9ad0 (patch)
tree2d4e830d906384b34a9b3759f211bbc15d9de50a /usr.bin
parent68f7efc5631cacc8820631000a1bb756d23defd2 (diff)
Note a segv with fprintf if a file with long lines is loaded with
debug code running.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/mg/log.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/usr.bin/mg/log.c b/usr.bin/mg/log.c
index dd9a6568a52..f69b9aae543 100644
--- a/usr.bin/mg/log.c
+++ b/usr.bin/mg/log.c
@@ -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 <sys/queue.h>
@@ -156,6 +170,7 @@ mglog_lines(PF funct)
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) {