Project

General

Profile

Actions

Bug #2134

closed

sdiff causes stack overflow

Added by pavalos over 12 years ago. Updated over 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

Description

Try this:
cd /usr/src
sdiff Makefile.inc1 Makefile_upgrade.inc

Results in:
diff: stack overflow

Actions #1

Updated by y0n3t4n1 over 12 years ago

On Wed, Sep 21, 2011 at 04:25:42AM +0000, Peter Avalos (via DragonFly issue tracker) wrote:

New submission from Peter Avalos <>:

Try this:
cd /usr/src
sdiff Makefile.inc1 Makefile_upgrade.inc

Results in:
diff: stack overflow

The backtrace looks to me like wcwidth() (in libdiffutils) is making
infinite recursion until the stack exhausts. Simple workaround is
to remove wcwidth.c from ${SRCS} in the Makefile in libdiffutils.

diff --git a/gnu/usr.bin/diff/libdiffutils/Makefile b/gnu/usr.bin/diff/libdiffutils/Makefile
index 00d8580..82b6532 100644
--- a/gnu/usr.bin/diff/libdiffutils/Makefile
+++ b/gnu/usr.bin/diff/libdiffutils/Makefile
@ -64,7 +64,6 @ SRCS= c-stack.c \
timegm.c \
uinttostr.c \
umaxtostr.c \
- wcwidth.c \
xmalloc.c \
xstrtol.c \
xstrtol-error.c \

We have similar instance in libgreputils, too. However, the function
definitions of wcwidth in lib{diff,grep}utils look like this:

int
wcwidth (wchar_t wc)
#undef wcwidth {
:
/* Otherwise, fall back to the system's wcwidth function. */
#if HAVE_WCWIDTH
return wcwidth (wc);
#else
return wc == 0 ? 0 : iswprint (wc) ? 1 : -1;
#endif
}
}

So, maybe we're suppose to define a macro wcwidth() somewhere in one
of the header files to a different name?

Actions #2

Updated by marino over 12 years ago

This commit allows the example of diff /usr/src/Makefile.inc1 /usr/src/
Makefile_upgrade.inc to work:
d76863bd1dbf9c1e4c04a977e3a7271a23cdb718

I decided to preserve the UTF-8 handling rather than remove the wcwidth.c file
from the source file list.

Actions

Also available in: Atom PDF