[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: [BusyBox] Fix sed to work around glibc bug.
From: Rob Landley <rob () landley ! net>
Date: 2004-01-31 20:04:18
Message-ID: 200401310145.46573.rob () landley ! net
[Download RAW message or body]
While building glibc with busybox as part of the development environment, I
found a bug in glibc's regexec can throw sed into an endless loop. This
fixes it. Should I put an #ifdef around it or something? (Note, this patch
also contains the "this is not gnu sed 4.0" hack I posted earlier, which is
also needed to build glibc...)
--- ../cvs/busybox/editors/sed.c 2004-01-04 00:42:14.000000000 -0600
+++ busybox/editors/sed.c 2004-01-31 13:20:36.839377256 -0600
@@ -618,6 +618,15 @@
do {
int i;
+ /* Work around bug in glibc regexec, demonstrated by:
+ echo " a.b" | busybox sed 's [^ .]* x g'
+ The match_count check is so not to break
+ echo "hi" | busybox sed 's/^/!/g' */
+ if(!regmatch[0].rm_so && !regmatch[0].rm_eo && match_count) {
+ pipe_putc(*(oldline++));
+ continue;
+ }
+
match_count++;
/* If we aren't interested in this match, output old line to
@@ -1073,6 +1082,14 @@
bb_perror_msg_and_die("atexit");
#endif
+#define LIE_TO_CONFIGURE
+#ifdef LIE_TO_CONFIGURE
+ if(!strcmp(argv[1],"--version")) {
+ printf("This is not GNU sed version 4.0\n");
+ exit(0);
+ }
+#endif
+
/* do normal option parsing */
while ((opt = getopt(argc, argv, "ne:f:")) > 0) {
switch (opt) {
Rob
_______________________________________________
busybox mailing list
busybox@mail.busybox.net
http://codepoet.org/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic