Subject: bug#5710: 23.1; Fatal error in format

From: Chong Yidong <[email-masked]>
Date: Sat, 13 Mar 2010 14:57:18 -0500

> (format "%16.s" "0123456789abcdef")
>
> makes emacs abort.  This reflects the following situation in editfns.c :
>
> total = 5 + 5 + 1 = 11
> field_width = 16
> precision = 0
> thissize = 0
> actual_width = 16
>
> thissize += max(0,16 - 16) = 0
> total += 0 + 4 = 15
>
> I think it is clearly a mistake to substract the width of the
> whole argument-string from the field_width, regardless of how
> much of it will actually end up in the result, depending
> on the precision mod.

Thanks.  I agree with your analysis, and have checked your patch into
the trunk.

Stefan, I think it's worthwhile to include this patch in the release
branch as well, though it's not a regression (it appears to be a
longstanding bug).  Aborts in `format' are not good.  What's your
opinion?