path: root/editors
Commit message (Collapse)AuthorAgeFilesLines
* Hiroshi found another bug. Currently sed's $ triggers at end of every file,Gravatar Rob Landley2004-11-251-28/+46
| | | | | | | | | | | | | | | | | | | | | | | | and with multiple files SuSv3 says it should only trigger at the end of the LAST file. The trivial fix I tried first broke if the last file is empty. Fixing this properly required restructuring things to create a file list (actually a FILE * list), and then processing it all in one go. (There's probably a smaller way to do this, merging with append_list perhaps. But let's get the behavior correct first.) Note that editing files in place (-i) needs the _old_ behavior, with $ triggering at the end of each file. Here's a test of all the things this patch fixed. gnu and busybox seds produce the same results with this patch, and different without it. echo -n -e "1one\n1two\n1three" > ../test1 echo -n > ../test2 echo -e "3one\n3two\n3three" > ../test3 sed -n "$ p" ../test1 ../test2 ../test3 sed -n "$ p" ../test1 ../test2 sed -i -n "$ p" ../test1 ../test2 ../test3
* Hiroshi Ito found some bugs. The 'c' command (cut and paste) was hardwiredGravatar Rob Landley2004-10-301-12/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | to not put a newline at the end (which was backwards, it should have been hardwired _to_ put a newline at the end, whether or not the input line ended with a newline). Test case for that: echo | sed -e '$ctest' And then this would segfault: echo | sed -e 'g' Because pattern_space got freed but the dead pointer was only overwritten in an if statement that didn't trigger if the hold space was empty. Oops. While debugging it, I found out that the hold space is persistent between multiple input files, so I promoted it to a global and added it to the memory cleanup. The relevant test case (to compare with That Other Sed) is: echo -n woo > woo sed -e h -e g woo echo "fish" | sed -e '/woo/h' -e "izap" -e 's/woo/thingy/' -e '/fish/g' woo - And somebody gratuitously stuck in a c99 int8_t type for something that's just a flag, so I grouped the darn ints.
* egor duda writes:Gravatar Eric Andersen2004-10-082-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | Hi! I've created a patch to busybox' build system to allow building it in separate tree in a manner similar to kbuild from kernel version 2.6. That is, one runs command like 'make O=/build/some/where/for/specific/target/and/options' and everything is built in this exact directory, provided that it exists. I understand that applyingc such invasive changes during 'release candidates' stage of development is at best unwise. So, i'm currently asking for comments about this patch, starting from whether such thing is needed at all to whether it coded properly. 'make check' should work now, and one make creates Makefile in build directory, so one can run 'make' in build directory after that. One possible caveat is that if we build in some directory other than source one, the source directory should be 'distclean'ed first. egor
* Patch from Dmitry Zakharov to fix a bug triggered by freeswan's scripts.Gravatar Glenn L McGrath2004-09-241-1/+2
* regularly update the status line displayGravatar Eric Andersen2004-08-191-4/+4
| | | | -Erik
* Simon Poole reports that awk segfaults when environment variablesGravatar Eric Andersen2004-07-301-0/+4
| | | | | | | | | | | with no value exist, i.e. $ export BOB='' % ./busybox awk Segmentation fault This patch teaches awk to not blow chunks on empty env variables. -Erik
* Patch from Dmitry Zakharov to fix a bug discovered via the freeswapGravatar Glenn L McGrath2004-07-231-0/+1
| | | | script.
* Assign 'forced' before the goto to avoid a warningGravatar Eric Andersen2004-07-201-2/+3
* Rob Landley writes:Gravatar Eric Andersen2004-05-261-4/+7
| | | | | | | | | | | add sed -r support. I bumped into a couple of things that want to use extended regular expressions in sed, and it really isn't that hard to add. Can't say I've extensively tested it, but it's small and isn't going to break anything that doesn't use it, so... Rob
* Use int instead of char for return type, in theory avoiding a castGravatar Glenn L McGrath2004-05-161-2/+2
* Fix for debian bug #248106, should use int for returned getopt value.Gravatar Glenn L McGrath2004-05-101-1/+3
* Update my email address, document some of my tasks in the AUTHORS fileGravatar Glenn L McGrath2004-04-252-2/+2
* This sed patch can only be described as "duh". Stat the source file, chmodGravatar Eric Andersen2004-04-211-1/+1
| | | | | | | | | | | the _destination_ file. (Ah hah! That works _much_ better...) I implemented the behavior, I just forgot to test this corner of it. My fault, sorry... No, gnu sed -i doesn't preverve ownership information. I checked. Permissions, yes, ownership info, no. Rob
* So I'm building a linux from scratch system, using a working script to do thisGravatar Eric Andersen2004-04-211-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | that the _only_ change to is that gnu sed has been replaced with busybox sed. And ncurses' install phase hangs. I trace it down, and it's trying to run gawk. (Insert obligatory doubletake, but this is FSF code we're talking about, so...) It turns out gawk shells out to sed, ala "sed -f /tmp/blah file.h". The /tmp/blah file is basically empty (it contains one character, a newline). So basically, gawk is using sed as "cat". With gnu sed, it works like cat, anyway. With busybox sed, it tests if its command list is empty after parsing the command line, and if the list is empty it takes the first file argument as a sed command string, and if that leaves the file list empty it tries to read the data to operate on from stdin. (Hence the hang, since nothing's coming in on stdin...) It _should_ be testing whether there were any instances of -f or -e, not whether it actually got any commands. Using sed as cat may be kind of stupid, but it's valid and gawk relies on this behavior. Here's a patch to fix it, turning a couple of ints into chars in hopes of saving a bit of the space this adds. Comments? Rob
* Larry Doolittle writes:Gravatar Eric Andersen2004-04-143-9/+9
| | | | | | | | | | | | | | | | | | | | | | This is a bulk spelling fix patch against busybox-1.00-pre10. If anyone gets a corrupted copy (and cares), let me know and I will make alternate arrangements. Erik - please apply. Authors - please check that I didn't corrupt any meaning. Package importers - see if any of these changes should be passed to the upstream authors. I glossed over lots of sloppy capitalizations, missing apostrophes, mixed American/British spellings, and German-style compound words. What is "pretect redefined for test" in cmdedit.c? Good luck on the 1.00 release! - Larry
* The last patch broke:Gravatar Rob Landley2004-04-011-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | sed -i "/^boo/a fred" ipsec.conf Which works in gnu sed. (And is _supposed_ to strip all the whitespace before "fred".) It also broke: sed -i -e "/^boo/a \\" -e " fred" ipsec.conf I.E. there can legally be spaces between the a and the backslash at the end of the line. And strangely enough, gnu sed accepts the following syntax as well: sed -i "/^boo/a \\ fred" ipsec.conf Which is a way of having the significant whitespace at the start of the line, all on one line. (But notice that the whitespace BEFORE the slash is still stripped, as is the slash itself. And notice that the naieve placement of "\n" there doesn't work, it puts an n at the start of the appended line. The double slashing is for shell escapes because you could escape the quote, you see. It's turned into a single backslash. But \n there is _not_ turned into a newline by the shell. So there.) This makes all three syntaxes work in my tests. I should probably start writing better documentation at some point. I posted my current sedtests.py file to the list, which needs a lot more tests added as well...
* Junio Hamano, junio at twinsun dot com writes:Gravatar Eric Andersen2004-03-311-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The sed command in busybox 1.0.0-pre8 loses leading whitespace in 'a' command ('i' and 'c' commands are also affected). A patch to fix this is attached at the end of this message. The following is a transcript that reproduces the problem. The first run uses busybox 1.0.0-pre3 as "/bin/sed" command, which gets the expected result. Later in the test, /bin/sed symlink is changed to point at busybox 1.0.0-pre8 and the test script is run again, which shows the failure. === reproduction recipe === * Part 1. Use busybox 1.0.0-pre3 as sed; this works. root# cd /tmp root# cat 1.sh #!/bin/sh cd /tmp rm -f ipsec.conf ipsec.conf+ cat >ipsec.conf <<\EOF version 2.0 config setup klipsdebug=none plutodebug=none plutostderrlog=/dev/null conn %default keyingtries=1 ... EOF sed -e '/^config setup/a\ nat_traversal=yes' ipsec.conf >ipsec.conf+ mv -f ipsec.conf+ ipsec.conf root# sh -x 1.sh + cd /tmp + rm -f ipsec.conf ipsec.conf+ + cat + sed -e /^config setup/a\ nat_traversal=yes ipsec.conf + mv -f ipsec.conf+ ipsec.conf root# cat ipsec.conf version 2.0 config setup nat_traversal=yes klipsdebug=none plutodebug=none plutostderrlog=/dev/null conn %default keyingtries=1 ... root# sed --version sed: invalid option -- - BusyBox v1.00-pre3 (2004.02.26-18:47+0000) multi-call binary Usage: sed [-nef] pattern [files...] * Part 2. Continuing from the above, use busybox 1.0.0-pre8 as sed; this fails. root# ln -s busybox-pre8 /bin/sed-8 root# mv /bin/sed-8 /bin/sed root# sed --version This is not GNU sed version 4.0 root# sed -- BusyBox v1.00-pre8 (2004.03.30-02:44+0000) multi-call binary Usage: sed [-nef] pattern [files...] root# sh -x 1.sh + cd /tmp + rm -f ipsec.conf ipsec.conf+ + cat + sed -e /^config setup/a\ nat_traversal=yes ipsec.conf + mv -f ipsec.conf+ ipsec.conf root# cat ipsec.conf version 2.0 config setup nat_traversal=yes klipsdebug=none plutodebug=none plutostderrlog=/dev/null conn %default keyingtries=1 ... root# === reproduction recipe ends here === This problem was introduced in 1.0.0-pre4. The problem is that the command argument parsing code strips leading whitespaces too aggressively. When running the above example, the piece of code in question gets "\n\tnat_traversal=yes" as its argument in cmdstr variable (shown part in the following patch). What it needs to do at this point is to strip the first newline and nothing else, but it instead strips all the leading whitespaces at the beginning of the string, thus losing the tab character. The following patch fixes this.
* Patch from Thomas Winkler -- vi -R did not workGravatar Eric Andersen2004-03-311-1/+2
* Remove trailing whitespace. Update copyright to include 2004.Gravatar Eric Andersen2004-03-157-54/+54
* Patch from Dmitry Zakharov, this line was missedfrom the last patchGravatar Glenn L McGrath2004-02-221-0/+1
* Add -i option to sed, to edit files in-place.Gravatar Rob Landley2004-02-181-7/+54
* Richard Kojedzinszky writes:Gravatar Eric Andersen2004-02-061-2/+2
| | | | | | | | | Hi All, I aplogoize for the mistake, but i have just recognized that somehow the last patch I sent in was wrong, and a '0' was instead of a '-1'. Because of this, vi does behave the wrong way. So again, it should be the last patch for vi. This is for pre7.
* Richard Kojedzinszky writes:Gravatar Eric Andersen2004-02-041-5/+8
| | | | | | | | | Hi, I've noticed the bug also, and here is another patch for it. I hope it'll not introduce more bugs. Not too nice, but works for me. Here it is for busybox-1.00-pre6
* Rob Landley writes:Gravatar Eric Andersen2004-02-041-0/+17
| | | | | | | | 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...)
* Patch by Richard Kojedzinszky, when using END at end of lines it wasGravatar Glenn L McGrath2004-01-211-3/+5
| | | | skipping to next line, cw command was leaving one char in buffer
* Thinko in s//options. (Whitespace skipping in the wrong place.)Gravatar Rob Landley2004-01-041-2/+3
* Match changes made to cmdeditGravatar Eric Andersen2003-12-231-3/+1
* Patch from Matt Kraai:Gravatar Eric Andersen2003-12-231-2/+4
| | | | | | | | | | | | | | | | | | sed is broken: busybox sed -n '/^a/,/^a/p' >output <<EOF a b a b EOF cmp -s output - <<EOF a b a EOF The attached patch fixes it.
* Patch from Dmitry Zakharov,Gravatar Glenn L McGrath2003-10-301-12/+28
| | | | | | | Fixes two bugs: - END block didn't execute after an exit() call - huge memory consumption and performance degradation on large input (now performance is comparable to gawk)
* Andreas Mohr writes:Gravatar Eric Andersen2003-10-221-1/+1
| | | | | | | | | | | the busybox menuconfig triggered my "inacceptable number of spelling mistakes" upper level, so I decided to make a patch ;-) I also improved some wording to describe some things in a better way. Many thanks for an incredible piece of software! Andreas Mohr, random OSS developer
* Fix some warnings that have crept in recentlyGravatar Eric Andersen2003-10-091-6/+6
* Comaptability with gcc-2.95Gravatar Glenn L McGrath2003-10-091-1/+2
* Patch from Rob Landley;Gravatar Glenn L McGrath2003-10-041-23/+24
| | | | | | | Moving on to building diffutils, busybox sed needs this patch to get past the first problem. (Passing it a multi-line command line argument with -e works, but if you don't use -e it doesn't break up the multiple lines...)
* Patch from Rob Landley to fix backrefsGravatar Glenn L McGrath2003-10-011-1/+1
* Patch by Rob Landley, fix "newline after edit command"Gravatar Glenn L McGrath2003-10-011-2/+3
* Patch by Rob Landley, work in progress update, fixes lots of bugs,Gravatar Glenn L McGrath2003-10-012-802/+678
| | | | introduces a few others (but they are being worked on)
* Fix some typo's, remove some extra free statementsGravatar Glenn L McGrath2003-09-241-4/+2
* Configuration option to define wether to follows GNU sed's behaviour Gravatar Glenn L McGrath2003-09-162-26/+49
| | | | | or the posix standard. Put the cleanup code back the way it was.
* Fix a bug that creapt in recently with substitution subprinting, and addGravatar Glenn L McGrath2003-09-161-3/+2
| | | | a test for it.
* Fix a simple mistake with pattern space, and add a test for itGravatar Glenn L McGrath2003-09-151-2/+2
* Fix some memory allocation problemsGravatar Glenn L McGrath2003-09-151-18/+21
| | | | ----------------------------------------------------------------------
* Be entirely consistant when using ioctl(0, TIOCGWINSZ, &winsize)Gravatar Eric Andersen2003-09-151-27/+9
| | | | | to ensure proper fallback behavior on, i.e. serial consoles. -Erik
* Add a test for the 'P' command and fix current implementation so itGravatar Glenn L McGrath2003-09-151-0/+4
| | | | doesnt permanently modify the pattern space.
* A test and fix for the sed 'n' commandGravatar Glenn L McGrath2003-09-151-0/+8
* Fix for the sed-append-next-line testGravatar Glenn L McGrath2003-09-151-0/+5
* Fix recursion problemGravatar Glenn L McGrath2003-09-151-0/+2
* Memory cleanups and fix for `echo "foo" | sed 's/foo/bar/;H;q'`Gravatar Glenn L McGrath2003-09-141-6/+20
* Cleanup memory usageGravatar Glenn L McGrath2003-09-141-17/+32
* The previous fix for 's/a/1/;s/b/2/;t one;p;:one;p' broke the case ofGravatar Glenn L McGrath2003-09-141-3/+2
| | | | | | | | echo fooba | ./busybox sed -n 's/foo//;s/bar/found/p' I really need to start adding these tests to the testsuite. keep the substituted and altered flags seperate
* Preserve substitution flag value within the current line.Gravatar Glenn L McGrath2003-09-141-1/+1
| | | | | | | | | | | | | | Fixed the following testcase # cat strings |./busybox sed -n -f test3.sed 1 1 2 c c # cat strings a b c