Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: "G. Branden Robinson" Newsgroups: gnu.groff.bug Subject: [bug #58153] input_stack::backtrace() over-suppresses output Date: Fri, 10 Apr 2020 04:10:03 -0400 (EDT) Lines: 93 Approved: bug-groff@gnu.org Message-ID: References: <20200410-081001.sv108747.36720@savannah.gnu.org> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain;charset=UTF-8 X-Trace: usenet.stanford.edu 1586506221 24251 209.51.188.17 (10 Apr 2020 08:10:21 GMT) X-Complaints-To: action@cs.stanford.edu To: "G. Branden Robinson" , bug-groff@gnu.org Envelope-to: bug-groff@gnu.org X-PHP-Originating-Script: 1001:sendmail.php X-Savane-Server: savannah.gnu.org:443 [209.51.188.72] X-Savane-Project: groff X-Savane-Tracker: bugs X-Savane-Item-ID: 58153 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0 X-Apparently-From: 1.144.105.92 (Savane authenticated user gbranden) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.72 X-BeenThere: bug-groff@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Bug reports for the GNU version of nroff, troff et al" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <20200410-081001.sv108747.36720@savannah.gnu.org> Xref: csiph.com gnu.groff.bug:1793 URL: Summary: input_stack::backtrace() over-suppresses output Project: GNU troff Submitted by: gbranden Submitted on: Fri 10 Apr 2020 08:10:01 AM UTC Category: Core Severity: 3 - Normal Item Group: Incorrect behaviour Status: In Progress Privacy: Public Assigned to: gbranden Open/Closed: Open Discussion Lock: Any Planned Release: None _______________________________________________________ Details: The above function in src/roff/troff/input.cpp has the following condition in a for loop with an accompanying comment: // only backtrace down to (not including) the topmost file ... p && !p->get_location(0, &f, &n); However, for reasons I admit I haven't been able to quite figure out, this conditional fails under more cases than intended. Specifically, it seems to fail (ending the loop) when _any_ file_iterator is encountered, halting the backtrace across .so, .nx, or .pso boundaries. This doesn't happen for the .backtrace request--only for backtraces triggered by warnings or errors in input combined with the groff -b flag. Since read files and not just stdin are involved, I'm attaching a reproducing case. Here's what I get with the groff 1.22.4 in my distribution: $ /usr/bin/groff -b -ww -U /tmp/outer >/dev/null troff: printf '\s[10]\n';printf '\s[-20]\n';printf 'foobar':2: warning: \s escape results in non-positive point size; set to 1 And here's groff git HEAD with a patch I'm preparing: $ ./test-groff -U /tmp/outer >/dev/null troff: backtrace: pipe 'printf '\s[10]\n';printf '\s[-20]\n';printf 'foobar'':2 troff: backtrace: file '/tmp/inner':3 troff: backtrace: pipe 'echo .so /tmp/inner':1 troff: backtrace: file '/tmp/outer':1 troff: printf '\s[10]\n';printf '\s[-20]\n';printf 'foobar':2: warning: point-size escape results in non-positive size -10000u; set to 1u This patch does result in one additional line of output when -b is given and an error or (non-ignored) warning happens at the top level. However, I regard this as unobjectionable because (1) a backtrace was in fact explicitly requested; and (2) it seems a poor tradeoff to suppress the backtrace in all complicated and frustrating cases for the sake of less backtrace output in a trivial one. _______________________________________________________ File Attachments: ------------------------------------------------------- Date: Fri 10 Apr 2020 08:10:01 AM UTC Name: outer Size: 25B By: gbranden ------------------------------------------------------- Date: Fri 10 Apr 2020 08:10:01 AM UTC Name: inner Size: 66B By: gbranden _______________________________________________________ Reply to this item at: _______________________________________________ Message sent via Savannah https://savannah.gnu.org/