NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/45881: nvi copy command copies empty lines.



>Number:         45881
>Category:       bin
>Synopsis:       nvi copy command copies empty lines.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 27 14:55:00 +0000 2012
>Originator:     Chavdar Ivanov
>Release:        5.99.60
>Organization:
Delcam Plc
>Environment:
# uname -a
NetBSD support6 5.99.60 NetBSD 5.99.60 (MYDOMU) #0: Tue Jan 24 14:04:01 GMT 
2012  root@support6:/usr/src/sys/arch/amd64/compile/MYDOMU amd64
>Description:
1: new file: line 1
:a
1
2
3
4
5
.
:2,4m$
4
:1,$p
1
5
2
3
4
:1,3co$

:1,$p
1
5
2
3
4



:wq
1: new file: 8 lines, 13 characters
[uksup2] ~ $ cat 1
1
5
2
3
4



[uksup2] ~ $ 

>How-To-Repeat:
Use ex copy command, see the transcript above.
>Fix:
--- dist/nvi/ex/ex_move.c.ORIG       2008-05-18 15:31:16.000000000 +0100
+++ dist/nvi/ex/ex_move.c       2012-01-27 14:34:59.000000000 +0000
@@ -25,6 +25,7 @@
 #include <string.h>
 
 #include "../common/common.h"
+#define ENTIRE_LINE     (size_t)-1
 
 /*
  * ex_copy -- :[line [,line]] co[py] line [flags]
@@ -54,7 +55,7 @@
        memset(&cb, 0, sizeof(cb));
        CIRCLEQ_INIT(&cb.textq);
        for (cnt = fm1.lno; cnt <= fm2.lno; ++cnt)
-               if (cut_line(sp, cnt, 0, 0, &cb)) {
+               if (cut_line(sp, cnt, 0, ENTIRE_LINE, &cb)) {
                        rval = 1;
                        goto err;
                }



Home | Main Index | Thread Index | Old Index