Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 37026 - termcap is super obsolete (coreutils-5.0.91-r3)
Summary: termcap is super obsolete (coreutils-5.0.91-r3)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL: file://lib/libtermcap.*
Whiteboard:
Keywords:
: 37064 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-01-02 08:06 UTC by Martin Flugeldufel
Modified: 2004-01-11 14:45 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Flugeldufel 2004-01-02 08:06:36 UTC
Installing coreutils (unstable), it pulls in libtermcap-compat (should be
terminfo). Termcap has been declared obsolete a very long time (>8 years) ago, 
in fact, other distributions only provide a libc5 version to enable REALLY 
ancient binaries to run and explicitely state new packages must NOT link to 
it. On top of that, libtermcap-compat installs libtermcap.so in /lib 
(versionless symlinks to libraries in /lib still belong in /usr/lib), causing
coreutils progs linking to libtermcap.a.

(now coreutils' binaries in /bin sum up to >2.6MB. Is bug #36453 completely
being ignored?)
Comment 1 Seemant Kulleen (RETIRED) gentoo-dev 2004-01-02 12:45:16 UTC
MArtin, no, the other bug is NOT being ignored, but as Azarah stated, if you can get us a list of files which can be moved into /usr/bin without breaking gentoo's init then I'll implement that soonest.

Please note: I'm relying on YOUR input for this, because I haven't the time to test every combination.
Comment 2 Seemant Kulleen (RETIRED) gentoo-dev 2004-01-02 12:47:26 UTC
now, as for terminfo/termcap -- they are both from the same HOMEPAGE (Eric S. Raymond's) which provides the /etc/termcap file.

The termcap compatibility lib is in use by several distros -- Debian, Mandrake at least.  If you can find me a replacement, I'll look into it.  As for the specific issue of the libs, etc I'm fine with replacing it, after you get me a list of coreutils things which can be moved into /usr/bin.
Comment 3 Seemant Kulleen (RETIRED) gentoo-dev 2004-01-02 13:21:24 UTC
Martin,

come to irc.freenode.net #gentoo and talk to me (I'm seemant there)
Comment 4 Seemant Kulleen (RETIRED) gentoo-dev 2004-01-02 13:43:00 UTC
OK, so here's what the situation is.  I've got in my local overlay, ls, dir and vdir linking to -lcurses instead of -ltermcap and things seem to be well.  So I can adjust the patch to do that instead.  However, we still require the terminfo/termcap database, so the libtermcap-compat dependency stands.  I can, however, consider making a separate package just for termcap without the compatibility lib.

But, I'll need Azarah's advice on this.
Comment 5 Martin Flugeldufel 2004-01-02 17:25:28 UTC
I'm not a programmer, but here's how I understand it:

*termcap* (accessed per libtermcap) and *terminfo* (accessed per ncurses) 
are two almost compatible ways to do the same thing, only that 
(a) *termcap* is a bit outdated, 
(b) *terminfo* is more universal and expressive, 
((c) doesn't mean much, but SCO supposedly claims ownership on the termcap file format)

In any way, if ls is linked to -lcurses, it'll use terminfo, not termcap.

If the dependancy is introduced by Mandrake patches, Mandrake does lots of 
wierd unexplained things.

Here's what Debian has to say since the dawn of time (I have emailed someone 
who might have the very first Debian version in his collection to see if they
never used it and/or when the switch was made. First changelog entry is 
May 10, 1996):

[quote="termcap-compat-1.2.3/debian/control"]

Source: termcap-compat
Build-Depends: altgcc, libc5-altdev
Maintainer: Christian Hudon <chrish@debian.org>
Standards-Version: 3.1.1.1
Section: oldlibs
Priority: extra

Package: termcap-compat
Architecture: i386
Depends: ${shlibs:Depends}
Replaces: libtermcap
Conflicts: libtermcap
Description: Compatibility package for old termcap-based programs.
 The termcap-compat package provides the libtermcap.so.2 and /etc/termcap
 files which are required to run non-Debian, binary-only termcap-based
 programs. Since libc6-based programs are hopefully "modern" enough to be 
 linked with ncurses (or slang), this package only provides a libc5-based 
 libtermcap library.
 .
 You do not need to install this package to run Debian-packaged programs
 since Debian GNU/Linux uses terminfo and not termcap. You need this
 package if a program (that you cannot recompile) fails to run with 
 the error message "...: can't load library 'libtermcap.so.2'" or complains 
 about a missing /etc/termcap file.
 .
 The termcap-compat package isn't meant to be used to compile programs
 therefore it doesn't provide all the necessary files for compilation. If you 
 want to compile a program that claims to need termcap, why not try 
 ncurses's termcap emulation instead? It's as simple as linking with ncurses 
 instead of libtermcap (i.e. replace the '-ltermcap' with '-lncurses' in 
 the makefile). Ncurses' termcap emulation routines translate terminfo entries 
 to termcap entries on the fly, so you don't even need an /etc/termcap file.
 .
 This package provides:
  libtermcap.so shared library, version 2.0.8
  termcap database, version 10.2.7

[/quote]

-- 
Comment 6 Martin Flugeldufel 2004-01-02 18:30:34 UTC
Sorry for the two dupes (#37064 & #37065). I have no idea how that happened, 
just responded to #37027.
Comment 7 Seemant Kulleen (RETIRED) gentoo-dev 2004-01-02 20:44:59 UTC
*** Bug 37064 has been marked as a duplicate of this bug. ***
Comment 8 Martin Schlemmer (RETIRED) gentoo-dev 2004-01-05 15:46:20 UTC
In theory if we link to ncurses, we do not need /etc/termcap ... except of
course if the MDK patches does something wierd with it directly?

Comment to termcap - yes it is old, etc.  We do however need it for compat
like you stated.  Most things work if you patch it to -lncurses and not
-ltermcap (except a few like app-editors/vi), so we should not need termcap
in general.  Also, you are right, there needs to be a symlink, but I'd rather
use gen_usr_ldscript() in eutils.eclass ..
Comment 9 Martin Flugeldufel 2004-01-07 07:39:27 UTC
I don't want to sound selfish, but if a user really wants to use 
app-editors/vi (there are smaller + more feature-rich vi clones, + they work 
ok w/ curses), he's not really interested in saving space and won't mind the 
extra couple of 100Kb /etc/termcap uses.
(ironically, on my box app-editors/vi does NOT segfault w/ TERM=linux when
it's linked to curses, + w/ curses it works better in xterms - IFF changing
"termlib" to "ncurses" is all there is to change (???))

But, that's not the real problem, summary says "coreutils" - coreutils is part 
of system so it makes termcap part of system. Plus, why does Mandrake's ls need 
knowledge about its terminal when everyone else does not?

-- 
Comment 10 Martin Schlemmer (RETIRED) gentoo-dev 2004-01-07 13:01:44 UTC
I think I tried to say that we really should not link coreutils to termcap, but
rather ncurses if the need for such support is there.  Think you can try to
do a patch and test?  I do not know if I will get to it until the weekend
(Seemant?).
Comment 11 Seemant Kulleen (RETIRED) gentoo-dev 2004-01-07 13:12:40 UTC
az sorry for late response, I have coreutils -r4 ready to commit (links against ncurses)
Comment 12 Seemant Kulleen (RETIRED) gentoo-dev 2004-01-09 00:24:17 UTC
-r4 in portage.
Comment 13 bartron 2004-01-09 19:12:35 UTC
  Sorry guys, you're forgetting one little thing...ncurses, unlike 
termcap, stores its terminfo database in `/usr/share'... which may not
be available until all file systems are mounted.  The other distro 
that has been mentioned in here solves this by moving entries most 
probably needed in emergency and rescue situations from 
`/usr/share/terminfo' to `/etc/terminfo' (don't worry, good news is 
it's considerably smaller than the whole termcap file... only `dumb', 
`linux', `rxvt', `screen', `sun', `vt{52,100,102,220}' and `xterm' 
would go into /etc, rest is still in `/usr/share.  Bad news is, since 
cfdisk (in /sbin) links to ncurses, this would be necessary anyway for 
100% correctness, whether `ls' needs ncurses or not).

  However... it is not really clear why `ls' needs termcap/terminfo...
In the unpatched sources, `ls' uses colors with `--color=auto' if 
stdout is a tty and $TERM matches a term name listed in DIR_COLORS.
With the Mandrake patch, coreutils (fileutils) change the first 
condition as follows, adding the only two refs to termcap/info:

  /* stdout is a tty */
  isatty(STDOUT_FILENO) &&

  /* there's a termcap entry for $TERM */
  tgetent(NULL, getenv("TERM")) > 0 &&

  /* the next call queries termcap for the esc sequence used to
     turn on bold text...or rather checks if the returned *pointer*
     is > 0 but never uses it for anything... and seems to assume 
     that terminals that can't do bold text can't do colors either 
     and vice versa... (is this always the case?) */
  tgetstr("md", NULL) > 0     
Comment 14 Martin Schlemmer (RETIRED) gentoo-dev 2004-01-10 05:21:55 UTC
Stupid question though - I have not checked the ncurses sources yet, but
I guess we will have to patch it to also look in /etc/terminfo/ if it
cannot open /usr/share/terminfo/ ?  Or is it already doing that?
Comment 15 bartron 2004-01-10 18:16:18 UTC
  There is a configure option, `--with-terminfo-dirs=XXX' (XXX=colon 
separated list of directories, e.g. "/etc/terminfo:/usr/share/terminfo")...
didn't test yet though if this overrides `~/.terminfo', which should 
always be searched first.
Comment 16 Martin Schlemmer (RETIRED) gentoo-dev 2004-01-11 06:46:06 UTC
Ok, have a look at ncurses-5.3-r5 ...
Comment 17 Martin Schlemmer (RETIRED) gentoo-dev 2004-01-11 14:45:19 UTC
Seemant, you can remove the libtermcap-compat dep if you fixed the linking,
also, maybe make it depend on ncurses-5.3-r5?