sabotage icon indicating copy to clipboard operation
sabotage copied to clipboard

bsd-curses versus ncurses

Open bkauler opened this issue 8 years ago • 10 comments

Just a note about an experience with bsd-curses versus ncurses.

I built Sabotage, installed it in a Flash stick. I built 'mp' a nice console text editor, that we have used for ages in Puppy Linux and derivatives. Here is my recipe: https://github.com/bkauler/sabotage/blob/master/pkg/mp

Problem though, it was unusable. Scrolling was haywire. For example, I moved the cursor down to the bottom of the window, and only the bottom line would scroll, not the rest of the window. It was a mess.

I had never encountered this problem before, so suspected bsd-curses.

I have done a complete rebuild using ncurses, this time mp works perfectly. Here is my recipe for ncurses: https://github.com/bkauler/sabotage/blob/master/pkg/qky-ncurses

...I had to jump through a lot of hoops to get all the packages to build with ncurses. Got some help from LFS, plus some creativity of my own.

I am posting this just for the general information of the Sabotage developers. If bsd-curses works for you, you will probably want to stay with it.

bkauler avatar May 22 '16 14:05 bkauler

thanks for the info. we at sabotage generally fix bugs, rather than working around them by using another version or replacement of a package. that said, i'll look at why mp is misbehaving with netbsd-curses.

rofl0r avatar May 22 '16 15:05 rofl0r

i just added a package mp https://github.com/sabotage-linux/sabotage/commit/cba0e0e9d097ec17d093b00e9632cd2abb8a7a6f it's using latest official tarball from upstream, and everything works perfect with curses - there was only a little issue i needed to fix to prevent it segfaulting @ line 17 of the package (apparently mp's author assumed that passing NULL instead of a valid WINDOW* to curses functions makes it automatically use stdscr).

rofl0r avatar May 22 '16 19:05 rofl0r

That's good that it works. I used a very old version of mp, 3.2.13. Latest, that you are using, is 5.2.10.

Just a note: that wasn't the only reason I went over to ncurses. Ncurses is what I have always used, very familiar with, and wanted to do a Sabotage build with it anyway. Except couldn't, had to fix the recipe. Now, it can be used in place of bsd-curses if anyone desires.

bkauler avatar May 22 '16 19:05 bkauler

are you planning to use the latest version or do you have a reason to stick to yours ?

rofl0r avatar May 22 '16 20:05 rofl0r

Oh, I should also reply that another reason I did a build with ncurses was to verify that bsd-curses was indeed the cause of the problem with mp.

There was a reason why I stayed with the older version of mp, back when I was developing for Puppy Linux. Can't remember now. Anyway, the old version works fine, at least with ncurses.

bkauler avatar May 22 '16 20:05 bkauler

just found that the version you're using still lives on the original site http://triptico.com/download/ , so let's test it..

rofl0r avatar May 22 '16 20:05 rofl0r

so far the only issue with it is that it begins scrolling down not in the last line but in the previous-to-last line, but the same happens when linked against ncurses.

rofl0r avatar May 22 '16 20:05 rofl0r

yeah, that's it. i cannot identify any differences when built against curses vs ncurses note that you can easily test yourself:

butch unlink ncurses
butch rebuild curses
# ... build stuff against curses, testing...
butch unlink curses
butch relink ncurses
# ... build stuff against ncurses....

rofl0r avatar May 22 '16 21:05 rofl0r

The old version of mp is working perfectly for me. I wonder if that is because my recipe for ncurses is different: https://github.com/bkauler/sabotage/blob/master/pkg/qky-ncurses

Whatever, mp works fine. I did have a problem before with the borders around mp displaying as characters instead of lines, but that was a matter of setting env. variable TERM=xterm when used with bash.

bkauler avatar May 23 '16 16:05 bkauler

A thought just occurred to me, perhaps the problem with the old mp is not curses, but busybox sh.

In Puppy Linux, I had /bin/sh a symlink to /bin/bash, as there were problems with some scripts. I just remembered one example: ${ABC:(-4)} ...this will extract the last 4 characters of string $ABC. Works with bash, not with busybox sh (or ash).

Anyway, my builds with Sabotage had /bin/sh linked to busybox, until I wanted to use a script with a bash-ism, so I changed /bin/sh to link to bash. Now, I can't remember whether I tested mp with bsd-curses before or after that change.

It will be easy enough to verify. Can't do it right now, but thought I would post this, as it seems quite likely the reason for the problem with the older mp. I'll report back.

bkauler avatar May 24 '16 08:05 bkauler