[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[vile] writing an empty file with nonewline
From: |
Brendan O'Dea |
Subject: |
[vile] writing an empty file with nonewline |
Date: |
Mon, 22 May 2006 14:52:55 +1000 |
User-agent: |
Mutt/1.5.11+cvs20060403 |
There seems to be a problem when writing out an empty file when
nonewline is set (see http://bugs.debian.org/368007).
$ vi new-file
:setl nonewline
:wq
[writing...]
Resulting in a file full of newlines. Note you'll probably want to kill
the process.
The problem appears to be in file.c:actually_write(), where the first
iteration of:
while ((rp->r_size + offset) >= line_length(lp)) {
has rp->r_size as -1, but since r_size is unsigned the test succeeds and
will do so until decrementing r_size in the body wraps unsigned long.
Not sure exactly where the root of the problem lies; setup_file_region()
seems to copy that -1 value from bp->b_bytecount, which should similarly
be unsigned.
--bod
- [vile] writing an empty file with nonewline,
Brendan O'Dea <=