[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [vile] writing an empty file with nonewline
From: |
Thomas Dickey |
Subject: |
Re: [vile] writing an empty file with nonewline |
Date: |
Mon, 22 May 2006 06:34:23 -0400 |
User-agent: |
Mutt/1.3.27i |
On Mon, May 22, 2006 at 02:52:55PM +1000, Brendan O'Dea wrote:
> 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.
thanks - I ran into a recent problem which I couldn't reproduce that
could be the same as this.
> 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.
It's probably from one of the changes I made last summer for large-file
support. Anyway, knowing a simple way to reproduce it is most of the
information that I need (thanks).
--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
pgpHPi7W7G5OF.pgp
Description: PGP signature