[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#710472: nvi :file command gives nonsensical percentages



On Tue, Jun 04, 2013 at 08:49:37PM -0700, Paul Vojta wrote:
> On Sun, Jun 02, 2013 at 04:09:19PM +0200, Frank Lichtenheld wrote:
> > 2013/5/31 Paul Vojta <vojta@math.berkeley.edu>:
> > > Package: nvi
> > > Version: 1.81.6-10
> > > Severity: minor
> > >
> > > Dear Maintainer,
> > >
> > > The :file command (also ^G) often gives nonsensical percentages in its output.
> > >
> > > For example (while editing this bug report):
> > >
> > > /tmp/mutt-xps-1000-8668-306287981309926837: modified: line 8 of 32
> > > [140733193388057%]
> > >
> > > (It sometimes does give the right percentage, though.)
> > 
> > I can confirm that. And it seems to be a regression from the wheezy version.
> > Since I didn't change the source code in any way, I played around with the
> > compiler flags. Disabling _FORTIFY_SOURCE seems to "fix" it, although
> > I have no idea why.
> > 
> > Cheers,
> > --
> > Frank Lichtenheld <djpig@debian.org>
> 
> I think it happens because of what some register has been used for in
> the past.  I haven't succeeded in reproducing it in a smaller program,
> though.
> 
> The bug is that the percentage is being printed with %ld, but is an int.
> What I can't figure out is why it doesn't occur with the other two numbers
> in the message (8 and 32 in the example I gave).  Both lno and last are of
> type db_recno_t, which equates to u_int32_t, unsigned int (db.h line 123).
> 
> Here's a patch that also fixes the problem, and which should be more robust.
> 
> --Paul Vojta, vojta@math.berkeley.edu

I compiled nvi-1.81.6 on my Ubuntu system at the office (gcc 4.6.3), and the
bug does not occur.  So, the problem could possibly be a gcc bug.  However,
using %ld to print an int value is definitely a bug and should be fixed.

--Paul Vojta, vojta@math.berkeley.edu


Reply to: