inetd,syslogd: use safe_read instead of open-coded EINTR handling
syslogd: bail out if you see null read from Unix socket
(should never happen, but if it does, spinning forever
and eating 100% CPU is not a good idea)
trylink: explain how to modify link and drastically decrease amount
of padding (unfortunately, needs hand editing ATM).
*: add ALIGN1 / ALIGN2 to global strings and arrays of bytes and shorts
size saving: 0.5k
* the puzzling message on error is replaced with strerror(errno)
so it should be even more detailed and smaller at the same time.
* merged code in edit_file() and code for ':edit <file>' in colon() into
new func init_text_buffer(). Was horribly duplicate. Moved most of
error/sanity checking to file_insert(). Result is that you get a proper
validation (prevent reading /dev/*) and error messages for ':r <file>'
* renamed 'cfn' to 'current_filename' for improved readability
* merged smallint vi_readonly and readonly into bitfields into
readonly_mode to save space.
* added text_size variable to keep track how big the text buffer is.
This is used to fix a buffer overflow. To reproduce bug:
./busybox vi TODO
:r Makefile
vi segfaults due to no buffer checking is done at all. som redesign is
needed here but i added a check in text_hole_make() to aviod the
segfault at least.
* removed isblnk() and use isblank(3) instead.
* fixed compiler warning by displaying the return code for :!<command>
This makes things bigger than needed but since the patch reduces the
overall size... (see below)
* new func next_tabstop(int) merges some duplicate code. There are more
cuplicode here but i couldnt find a good way to merge them.
* Fix *ANNOYING* placement of cursor on '\t' characters. To reproduce:
echo -e "\thello" > file1
./busybox vi file1
Try to insert some text at the beginning of line. Text will be inserted
but cursor is blinking somewhere else. The patch should make busybox vi
behave more like original vi(m). Costs a few bytes but its worth it
imho.
* new_text() is moved into init_text_buffer()
* the previously added update_ro_status() was moved info file_insert due
to duplication removal mentioned above.
function old new delta
init_text_buffer - 245 +245
file_insert 312 420 +108
next_tabstop - 82 +82
text_hole_make 154 171 +17
do_cmd 5093 5100 +7
static.cmd_mode_indicator - 5 +5
refresh 1248 1253 +5
current_filename - 4 +4
yank_delete 161 164 +3
what_reg 96 99 +3
end_cmd_q 78 81 +3
char_insert 440 442 +2
readonly_mode - 1 +1
vi_readonly 1 - -1
setops 154 153 -1
readonly 1 - -1
vi_setops 4 1 -3
string_insert 161 158 -3
cfn 4 - -4
show_status_line 532 514 -18
readit 519 500 -19
move_to_col 161 138 -23
vi_main 495 433 -62
isblnk 75 - -75
.rodata 4751 4655 -96
edit_file 892 787 -105
new_text 125 - -125
update_ro_status 131 - -131
colon 3848 3667 -181
------------------------------------------------------------------------------
(add/remove: 5/6 grow/shrink: 8/10 up/down: 485/-848) Total: -363
bytes
text data bss dec hex filename
34751 873 4260 39884 9bcc busybox_old
34439 877 4260 39576 9a98 busybox_unstripped
awk: some 'lineno' vars were shorts, made them ints (code got smaller)
awk: rename global t to global ttt. still an awful name, but at least
you can grep for it now.
function old new delta
ttt - 28 +28
mysleep 104 120 +16
readit 408 418 +10
lineno 2 4 +2
parse_program 338 339 +1
evaluate 6446 6445 -1
syntax_error 25 23 -2
next_token 917 915 -2
new_node 26 24 -2
tv 16 8 -8
skip_spaces 68 53 -15
t 28 - -28
rfds 128 - -128
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 4/6 up/down: 57/-186) Total: -129 bytes
things like xasprintf() into xfuncs.c, remove xprint_file_by_name() (it only
had one user), clean up lots of #includes... General cleanup pass. What I've
been doing for the last couple days.
And it conflicts! I've removed httpd.c from this checkin due to somebody else
touching that file. It builds for me. I have to catch a bus. (Now you know
why I'm looking forward to Mercurial.)
an xterm it's running in. The vi signal behavior would catch and restarts lots
of signals, like SIGHUP, that should just kill the thing. (Leftover behavior
from when it would segfault all the time.) Filtered out the more obviously
bad ones. If it segfaults, we should find and fix the problem.
SIGIOT is not defined in any standard i can find and it seems to be
useless (alias for SIGABRT) on linux. i put it in #ifdef but it's
probably best just to remove it and cut down the size a bit.
0000474: vi crashes often
problem was that the buffer used for "." command ("last_modifying_cmd")
wasn't being maintined correctly -- the recording code was walking back
over the front of that buffer when a repeatable insert command
included backspacing (e.g. "i\b\b\bfoo"). the fix is to simply
record the backspaces along with the rest of the command.
also, cleaned up start_new_cmd_q() slightly.
correct screen, and bug 215 reports trouble with the status line
on small screens.
with this change a) the status line should always be refreshed
properly, b) the status line is a little shorter than it used to
be ("I" instead of "--INSERT--"), c) the status line will be
truncated if it doesn't fit on the screen, and d) if the screen
is too narrow for an error or transient status message (from
psb() or psbs()), then that message will be followed by a "Hit
Return" prompt. (it wasn't until i did this last bit that the
size grew. with this, these changes add about 150 bytes.)
- pgf
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
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.
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