DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 5th May 2020
phillbush's Avatar
phillbush phillbush is offline
Port Guard
 
Join Date: Apr 2020
Posts: 15
Default Bug in vis(1)

The following command makes vis(1) go through an infinite loop.

Code:
$ printf 'a\tb' | vis -F8
I discovered it while looking through the code.

I am new to C and I was looking the code in order to learn C. I think I got a solution, I have to test it more, though.

Code:
int
foldit(char *chunk, int col, int max)
{
    char *cp;
    int newcol;

    /*
     * Keep track of column position. Insert hidden newline
     * if this chunk puts us over the limit.
     */
    newcol = 0;
    for (cp = chunk; *cp; cp++) {
        switch(*cp) {
        case '\n':
        case '\r':
            newcol = col = 0;
            break;
        case '\t':
            col = (col + 8) & ~07;
            newcol = (newcol + 8) & ~07;
            break;
        case '\b':
            col = col ? col - 1 : 0;
            newcol = newcol ? newcol - 1 : 0;
            break;
        default:
            col++;
            newcol++;
        }
    }

    if (col > (max - 2)) {
        printf("\\\n");
        col = newcol;
    } 

    return (col);
}
Reply With Quote
  #2   (View Single Post)  
Old 5th May 2020
ibara ibara is offline
OpenBSD language porter
 
Join Date: Jan 2014
Posts: 783
Default

Hello. This should be reported to bugs@openbsd.org with an inline diff generated from
Code:
cvs diff
Reply With Quote
  #3   (View Single Post)  
Old 6th May 2020
CiotBSD CiotBSD is offline
c107:b5d::
 
Join Date: Jun 2019
Location: Under /
Posts: 175
Default

`cvs diff -u` instead, no?!

Please, read the page "report":
https://www.openbsd.org/report.html
__________________
GPG:Fingerprint ed25519 : 072A 4DA2 8AFD 868D 74CF 9EA2 B85E 9ADA C377 5E8E
GPG:Fingerprint rsa4096 : 4E0D 4AF7 77F5 0FAE A35D 5B62 D0FF 7361 59BF 1733
Reply With Quote
  #4   (View Single Post)  
Old 6th May 2020
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,984
Default

It should not be necessary, unless the user running cvs was created prior to release 5.4. Since that release, there is an /etc/skel/.cvsrc file which is added to newly created users' $HOME directory, which currently contains:
Code:
# $OpenBSD: dot.cvsrc,v 1.3 2016/10/31 20:50:11 tb Exp $
#
diff -uNp
update -Pd
checkout -P
rdiff -u

Last edited by jggimi; 6th May 2020 at 12:43 PM. Reason: clarity
Reply With Quote
Reply

Tags
bug, vis


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:32 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick