less, Powerful Not-So-CLI (:-) Text Viewer and Launcher

Miscellaneous tools
Message
Author
User avatar
tallboy
Posts: 1760
Joined: Tue 21 Sep 2010, 21:56
Location: Drøbak, Norway

#16 Post by tallboy »

musher0 wrote:Just with my focus...
Do you actually try to convince us that you're not an industrial robot?? :lol: :lol: :lol:

tallboy
True freedom is a live Puppy on a multisession CD/DVD.

User avatar
tallboy
Posts: 1760
Joined: Tue 21 Sep 2010, 21:56
Location: Drøbak, Norway

#17 Post by tallboy »

Hi again musher0
I renamed the original /usr/bin/less to less-old, it is a link pointing to /bin/busybox.

I still get a message after running less in a urxvt window:
# less --help
less: Symbol `ospeed' has different size in shared object, consider re-linking
There is no file named ospeed, but when I search with pfind for the standalone word ospeed in text, the search give two results: /bin/busybox and /bin/stty.

Do you know what this is?

tallboy
True freedom is a live Puppy on a multisession CD/DVD.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#18 Post by musher0 »

Hi, bzzt, bzzt, Tallboy.

No idea, bzzt, bzzt. :lol:

musher0

PS. There are mentions here:
http://www.info.com/searchw?qkw=ospeed& ... &qhqn=&KW=
Related to perl or tput ? I am afraid I can be of no help.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
GustavoYz
Posts: 883
Joined: Wed 07 Jul 2010, 05:11
Location: .ar

#19 Post by GustavoYz »

Something is overwriting ncurses ospeed, so less (and probably other programs as well) raise that error.
If you have installed Mono in your system, may have that problem.
Last edited by GustavoYz on Sat 27 Apr 2013, 22:44, edited 1 time in total.

User avatar
tallboy
Posts: 1760
Joined: Tue 21 Sep 2010, 21:56
Location: Drøbak, Norway

#20 Post by tallboy »

Thank you for that info, GustavoYz
I don't find Mono in my system.

Message: Symbol `ospeed' has different size in shared object, consider re-linking

I removed the original less symlink that pointed to busybox, could that be a clue? (the same message came when I just renamed the link)

What does ospeed do?

tallboy
True freedom is a live Puppy on a multisession CD/DVD.

User avatar
GustavoYz
Posts: 883
Joined: Wed 07 Jul 2010, 05:11
Location: .ar

#21 Post by GustavoYz »

I wrote libc previously, my mistake, meant ncurses.
I think the problem is related to different version of ncurses between the compiled and running system (or other libraries that may point to it).
Unlinking the BusyBox's less isnt related, as the worse that could possible happen is that less wont work anymore.
ospeed is one of the routines that queries termcap/terminfo database, and it belongs to ncurses (termcap/terminfo are used to declare terminal features according to $TERM value).
Damn, if Mono-related, would be easier to fix...

User avatar
tallboy
Posts: 1760
Joined: Tue 21 Sep 2010, 21:56
Location: Drøbak, Norway

#22 Post by tallboy »

Found it!

tgetnum(3) - Linux man page

Name
tgetent, tgetflag, tgetnum, tgetstr, tgoto, tputs - direct curses interface to the terminfo capability database

The variable ospeed is set by ncurses in a system-specific coding to reflect the terminal speed.

External variables are provided for support of certain termcap applications. However, termcap applications' use of those variables is poorly documented, e.g., not distinguishing between input and output. In particular, some applications are reported to declare and/or modify ospeed.

I have always used less, so the question is: Should I ignore the message?

tallboy
True freedom is a live Puppy on a multisession CD/DVD.

User avatar
GustavoYz
Posts: 883
Joined: Wed 07 Jul 2010, 05:11
Location: .ar

#23 Post by GustavoYz »

Is less working fine anyway?
What happens if the -d switch is used?

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#24 Post by musher0 »

Hello, all.

This new compile of less 458 seems to have resolved the ospeed issue reported
above by TallBoy. :)

Please note that ncurses programs and libs as well as libtinfo are still needed. However,
I believe they are present in most newer Puppies, such as UpupRaring-3.9.9.2. Let me
know if you need a companion pet package containing those libraries: I'll prepare and
upload one.

Enjoy! BFN.

musher0
~~~~~~~~~~~~
PS. For the true connoisseurs... This time, I compiled with

Code: Select all

./configure --prefix=/usr --sysconfdir=/etc --with-regex=auto
Attachments
less-458rev.pet
New compile solves bug. ncurses and libtinfo still needed, as in previous versions.
(108.48 KiB) Downloaded 507 times
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#25 Post by musher0 »

Hello again, folks.

The attached pet package provides links and a script to view any true text file in less
by right-click. It also replaces the < defaulttextviewer > file in /usr/local/bin; if you don't
like it, restoration instructions are provided within the new executable.

Enjoy! BFN.

musher0
Attachments
less-458rev_companion.pet
(22.61 KiB) Downloaded 487 times
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
tallboy
Posts: 1760
Joined: Tue 21 Sep 2010, 21:56
Location: Drøbak, Norway

#26 Post by tallboy »

I have been away for some time, so I have not had the opportunity to say: Thank you, musher0!
And I wish you a happy new year!

tallboy
True freedom is a live Puppy on a multisession CD/DVD.

User avatar
tallboy
Posts: 1760
Joined: Tue 21 Sep 2010, 21:56
Location: Drøbak, Norway

#27 Post by tallboy »

It obviously still need libtinfo.so.5, so I just repeat this post...
tallboy wrote:Hi musher0
I downloaded less_458 to my LupuPlus_5.2.8. As you mentioned, the existing /usr/bin/less was a link to busybox.

Less only flashed on the screen for a fraction of a second when I tried it.

Code: Select all

# less my-documents/growisofs.txt 
less: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
tallboy
I have ncurses installed, is this the correct version needed?
Attachments
cursepic.jpg
(33.98 KiB) Downloaded 351 times
True freedom is a live Puppy on a multisession CD/DVD.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#28 Post by musher0 »

Hi, tallboy.

You're welcome, and Happy New Year to you too, and to your family!

Attached is the "ncurses" listing that I have...

Also, when I do

Code: Select all

ldd less
only libtinfo.so.5 seems necessary.

Hm... maybe this Puppy has too many "curses"... ;)

But try the new compile of less if you need it. You'll never know until you try it! :)
The basic "ncurses" library seems to be the same on both our Puppies.

BFN.
Attachments
ncurses-lib.jpg
(46.27 KiB) Downloaded 350 times
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
Keef
Posts: 987
Joined: Thu 20 Dec 2007, 22:12
Location: Staffordshire

#29 Post by Keef »

A little info on the libtinfo thing:
http://www.cyberspice.org.uk/blog/tag/libtinfo/

This is the important bit:

Code: Select all

cd /usr/lib
 ln -s libncurses.so.5 libtinfo.so.5
 ln -s libtinfo.so.5 libtinfo.so
musher0

New version works fine for me, complete with bi-lingual menu entries! This one is a keeper I think.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#30 Post by musher0 »

Keef wrote:A little info on the libtinfo thing:
http://www.cyberspice.org.uk/blog/tag/libtinfo/

This is the important bit:

Code: Select all

cd /usr/lib
 ln -s libncurses.so.5 libtinfo.so.5
 ln -s libtinfo.so.5 libtinfo.so
musher0

New version works fine for me, complete with bi-lingual menu entries! This one is a keeper I think.
Hi, Keef.

My pleasure!

Also, thanks for enlightening us about the possible confusion in this case between
libncurses and libtinfo.

BFN.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
tallboy
Posts: 1760
Joined: Tue 21 Sep 2010, 21:56
Location: Drøbak, Norway

#31 Post by tallboy »

Late (from me) but good: Thank you Keef! :D
There was an interesting comment in response to the link you posted on libtinfo:
Alice Chapman Says:
December 24th, 2009 at 5:11 pm

The lack of libtinfo.so is not so much a specific Ubuntu oddity, some other distributions don’t provide it either. The default behaviour when building NCurses is not to produce a separate libtinfo.so. It is only done when adding the –with-termlib switch to the NCurses configure script when building NCurses.

I do agree that linking libtinfo.so explicitly is broken behaviour, as it will not exist with a default shared library build of NCurses.

The same issue can arise with libtic.so, which can also be built as a separate library from libncurses.so by use of the –with-ticlib switch.
musher0, it may be something to remember if ncurses is used in later versions of puppy, a recompile will solve the problem(s). I have run into the problem before, but I cannot recall which program that refused to open.
Keef wrote:This is the important bit:
Code:
cd /usr/lib
ln -s libncurses.so.5 libtinfo.so.5
ln -s libtinfo.so.5 libtinfo.so
When browsing my /lib and /usr/lib in my LupuPlus 5.2.8_005-1., I discovered something very odd.

In my /lib:
libncurses.so.5 -> libncurses.so.5.7

In my /usr/lib:
libncurses.so -> /lib/libncurses.so.5
libncurses.so.5 -> libtermcap.so What the h...??
and then
libtermcap.so -> libncurses.so More what the h...??
So I made symlinks in /lib and /usr/lib:

Code: Select all

cd /lib
ln -s libncurses.so.5.7 libtinfo.so.5
cd /usr/lib
ln -s /lib/libncurses.so.5.7 libtinfo.so.5
It works! Now I have to find out what the mysterious libtermcap.so link is intended for! I have installed lynx, xpdf and pdftk, and I suspect one of them needed that link.

Finally my old $LESS:

Code: Select all

export LESS='-Ij20Wsz-5M'
You have to check out the option list for that one! :D

EDIT: If you install the companion .pet, right-clicking on a bin-file let you choose view-with-less.sh, which open the text in a urxvt window. The problem is that you get the question: This file seem to be a bin file, open anyway? If yes, lots of unreadable code! If you open a terminal instead and write less /bin/somefile, it open as a normal readable file would do. Something is wrong here, musher0.

tallboy
True freedom is a live Puppy on a multisession CD/DVD.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#32 Post by musher0 »

Hello, Tallboy.

I don't have the problem you mention viewing executables. For ex. I have attached a
picture of less "viewing" the wmx executable, with a search for the word "menu".

When less loaded it, there was a line at top saying "==append to filename" and some
other words, and then less picked up the ASCII characters (but not the machine code)
in the file and displayed them. I don't think there is anything wrong. I use that feature
sometimes to see if there are some undocumented commands in an executable.

The only other executable "viewer" I know in Linux is joe ("joe's own editor"), which has
a hex mode. (But I don't have lots of experience with hex editors.)

There is also a hook for less to see "odt" files, and there you will see "garbage" mixed in
with other information, such as word count or paragraph count. Yeah it's not pretty to
look at, but it does not bite ! :)

Again, I find this helpful when I want to refresh my memory about word count and such.
Using less is instantaneous, no need to wait for OpenOffice to load. You type "/" and the
word "count", and you soon know !

As to the extra libraries, I had similar surprises as you had, but I'll have to back-track
what I did. Keef's short message was extremely helpful in this.

If I remember correctly, I cleaned up the libs. I believe I had ncurses-blabla-
so-version in /lib and /usr/lib, which is unnecessary. Only one copy is necessary, of
course.

BFN

musher0
Attachments
less-viewing-exec.jpg
(56.86 KiB) Downloaded 700 times
Inside-an-odt-file.jpg
(80.13 KiB) Downloaded 785 times
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#33 Post by musher0 »

Hi, Puppyists.

I believe this could be another interesting tool in the less toolbox:
http://murga-linux.com/puppy/viewtopic. ... ost#815375
It's for viewing pdf files in plain text format. It uses pdftotext and less. Might be useful
for taking a quick glance at what a pdf is about. I find it a little faster than epdfview, if
I may say so.

BFN.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#34 Post by musher0 »

The new less-470 has been out for a few months now, so here you go! :) Enjoy! :)
Attachments
less-470.pet
Should be a drop-in replacement for any of the earlier versions above. The &quot;view-with-less&quot;
script works fine with it, at least on this Slacko-6.0b Puppy.
(106.09 KiB) Downloaded 488 times
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#35 Post by musher0 »

Hello, people!

I've uploaded a new less script to follow errors while developing scripts or configuring at:
http://murga-linux.com/puppy/viewtopic. ... ost#821855

Enjoy!

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

Post Reply