| Summary: | /rescue/vi doesn't work without terminal database in /usr | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | Brian Candler <B.Candler> | ||||||||
| Component: | bin | Assignee: | Yar Tikhiy <yar> | ||||||||
| Status: | Closed FIXED | ||||||||||
| Severity: | Affects Only Me | ||||||||||
| Priority: | Normal | ||||||||||
| Version: | 5.4-STABLE | ||||||||||
| Hardware: | Any | ||||||||||
| OS: | Any | ||||||||||
| Attachments: |
|
||||||||||
|
Description
Brian Candler
2005-04-22 17:50:08 UTC
On 2005.04.22 18:44:02 +0200, Brian Candler wrote:
>
> The usefulness of /rescue/vi is severely curtailed by the fact that it needs
> to have /usr mounted before it functions. In that case, you might as well
> just use /usr/bin/vi.
This has been known from when rescue was introduced, see the rescue(7)
manual page:
BUGS
Most of the rescue tools work even in a fairly crippled system. The most
egregious exception is the rescue version of vi(1), which currently
requires that /usr be mounted so that it can access the termcap(5) files.
Hopefully, a failsafe termcap(3) entry will eventually be added into the
ncurses(3) library, so that /rescue/vi can be used even in a system where
/usr cannot immediately be mounted. In the meantime, the rescue version
of the ed(1) editor can be used from /rescue/ed if you need to edit
files, but cannot mount /usr.
--
Simon L. Nielsen
On Sat, Apr 23, 2005 at 04:04:59PM +0200, Simon L. Nielsen wrote:
> This has been known from when rescue was introduced, see the rescue(7)
> manual page:
>
> BUGS
> Most of the rescue tools work even in a fairly crippled system. The most
> egregious exception is the rescue version of vi(1), which currently
> requires that /usr be mounted so that it can access the termcap(5) files.
> Hopefully, a failsafe termcap(3) entry will eventually be added into the
> ncurses(3) library, so that /rescue/vi can be used even in a system where
> /usr cannot immediately be mounted. In the meantime, the rescue version
> of the ed(1) editor can be used from /rescue/ed if you need to edit
> files, but cannot mount /usr.
Thanks, I hadn't come across that man page. I also see why /etc/termcap
didn't work; it's currently just a symlink to /usr/share/misc/termcap
I do note however from ncurses(3X):
If the ncurses library has been configured with termcap support,
ncurses will check for a terminal's description in termcap form if
it is not available in the terminfo database.
This suggests a very simple solution (untested):
--- lib/libncurses/pathnames.h.orig Sat Apr 23 17:17:01 2005
+++ lib/libncurses/pathnames.h Sat Apr 23 17:17:13 2005
@@ -34,5 +34,5 @@
* $FreeBSD: src/lib/libncurses/pathnames.h,v 1.1 1999/08/30 07:57:50 peter Exp $
*/
-#define _PATH_DEF ".termcap /usr/share/misc/termcap"
+#define _PATH_DEF ".termcap /usr/share/misc/termcap /rescue/termcap"
#define _PATH_DEF_SEC "/usr/share/misc/termcap"
and then bundle a few termcap entries in /rescue/termcap. Is there any
reason why that couldn't be done?
Regards,
Brian.
On 2005.04.23 17:19:17 +0200, Brian Candler wrote:
> On Sat, Apr 23, 2005 at 04:04:59PM +0200, Simon L. Nielsen wrote:
> > This has been known from when rescue was introduced, see the rescue(7)
> > manual page:
> >
> > BUGS
> > Most of the rescue tools work even in a fairly crippled system. The most
> > egregious exception is the rescue version of vi(1), which currently
> > requires that /usr be mounted so that it can access the termcap(5) files.
> > Hopefully, a failsafe termcap(3) entry will eventually be added into the
> > ncurses(3) library, so that /rescue/vi can be used even in a system where
> > /usr cannot immediately be mounted. In the meantime, the rescue version
> > of the ed(1) editor can be used from /rescue/ed if you need to edit
> > files, but cannot mount /usr.
>
> Thanks, I hadn't come across that man page. I also see why /etc/termcap
> didn't work; it's currently just a symlink to /usr/share/misc/termcap
>
> I do note however from ncurses(3X):
>
> If the ncurses library has been configured with termcap support,
> ncurses will check for a terminal's description in termcap form if
> it is not available in the terminfo database.
>
> This suggests a very simple solution (untested):
>
> --- lib/libncurses/pathnames.h.orig Sat Apr 23 17:17:01 2005
> +++ lib/libncurses/pathnames.h Sat Apr 23 17:17:13 2005
> @@ -34,5 +34,5 @@
> * $FreeBSD: src/lib/libncurses/pathnames.h,v 1.1 1999/08/30 07:57:50 peter Exp $
> */
>
> -#define _PATH_DEF ".termcap /usr/share/misc/termcap"
> +#define _PATH_DEF ".termcap /usr/share/misc/termcap /rescue/termcap"
> #define _PATH_DEF_SEC "/usr/share/misc/termcap"
>
> and then bundle a few termcap entries in /rescue/termcap. Is there any
> reason why that couldn't be done?
Without knowing how the code in question works, that does sounds like
a simple way to get working vi in a rescue environment.
I have CC'ed Tim Kientzle who did the initial rescue work. Tim, do
you know if the above suggestion would work, and if it does, do you
think we should go that way?
--
Simon L. Nielsen
Simon L. Nielsen wrote: >On 2005.04.23 17:19:17 +0200, Brian Candler wrote: > > >> >>This suggests a very simple solution (untested): >> >>--- lib/libncurses/pathnames.h.orig Sat Apr 23 17:17:01 2005 >>+++ lib/libncurses/pathnames.h Sat Apr 23 17:17:13 2005 >>@@ -34,5 +34,5 @@ >> * $FreeBSD: src/lib/libncurses/pathnames.h,v 1.1 1999/08/30 07:57:50 peter Exp $ >> */ >> >>-#define _PATH_DEF ".termcap /usr/share/misc/termcap" >>+#define _PATH_DEF ".termcap /usr/share/misc/termcap /rescue/termcap" >> #define _PATH_DEF_SEC "/usr/share/misc/termcap" >> >> >> Looks good to me. Test it. If it works, let's commit it. I seem to recall that Warner (imp@) has a compact termcap file that he uses with embedded projects. That might be suitable here. Tim On Sat, 23 Apr 2005, Simon L. Nielsen wrote: > On 2005.04.23 17:19:17 +0200, Brian Candler wrote: > > I do note however from ncurses(3X): > >=20 > > If the ncurses library has been configured with termcap sup= > port, > > ncurses will check for a terminal's description in termcap fo= > rm if > > it is not available in the terminfo database. > >=20 > > This suggests a very simple solution (untested): > >=20 > > --- lib/libncurses/pathnames.h.orig Sat Apr 23 17:17:01 2005 > > +++ lib/libncurses/pathnames.h Sat Apr 23 17:17:13 2005 > > @@ -34,5 +34,5 @@ > > * $FreeBSD: src/lib/libncurses/pathnames.h,v 1.1 1999/08/30 07:57:50 pe= > ter Exp $ > > */ > > =20 > > -#define _PATH_DEF ".termcap /usr/share/misc/termcap" > > +#define _PATH_DEF ".termcap /usr/share/misc/termcap /rescue/termcap" > > #define _PATH_DEF_SEC "/usr/share/misc/termcap" > >=20 > > and then bundle a few termcap entries in /rescue/termcap. Is there any > > reason why that couldn't be done? > > Without knowing how the code in question works, that does sounds like > a simple way to get working vi in a rescue environment. Why not use the normal mechanism? Environment variables exist so that you don't have to hard-code paths into utilities. From environ(7): %%% TERMCAP The string describing the terminal in TERM, or, if it begins with a '/', the name of the termcap file. See TERMPATH below, and termcap(5). TERMPATH A sequence of pathnames of termcap files, separated by colons or spaces, which are searched for terminal descrip- tions in the order listed. Having no TERMPATH is equivalent to a TERMPATH of ``$HOME/.termcap:/etc/termcap''. TERMPATH is ignored if TERMCAP contains a full pathname. %%% Or you can use ".termcap" (maybe using a special $HOME for rescue) without changing ther defaults. There is also some documentation of TERMCAP and TERMPATH in termcap(5). This gives a few less details than the above, and points to termcap(3). termcap(3) used to have a few more details than the above, but has rotted and now doesn't say anything about the environment variables. The details are still in the Attic (libterm/Attic/termcap.3,v). Bruce On Sat, Apr 23, 2005 at 02:39:48PM -0700, Tim Kientzle wrote:
> Looks good to me. Test it. If it works, let's commit it.
Hmm, it doesn't. I will investigate further when I get a few minutes.
On Tue, Apr 26, 2005 at 02:07:12PM +0100, Brian Candler wrote:
> On Sat, Apr 23, 2005 at 02:39:48PM -0700, Tim Kientzle wrote:
> > Looks good to me. Test it. If it works, let's commit it.
>
> Hmm, it doesn't. I will investigate further when I get a few minutes.
Actually, it does; turns out my trimmed /rescue/termcap file was bad. The
xterm-basic entry in /usr/share/misc/termcap has a superfluous trailing
backslash at the end, and if you butt it up to another entry without a blank
line, then that entry is broken.
The /rescue/termcap I'm using is attached. It's under 4K, but no doubt it
could be trimmed further. Do we actually need all the various combinations
of consoles, or is cons25 sufficient? I already stripped out some of the
more unusual ones like KOI8.
Regards,
Brian.
[from freebsd-current]
On Sat, Jun 18, 2005 at 12:48:04AM -0400, Garance A Drosehn wrote:
> >Yes, I'm aware of PR bin/80256, but that appears to stalled in
> >a state of limbo.
>
> I've also been meaning to do something about that idea of a small
> termcap file. I don't remember what the PR says, but someone had a
> good idea of generating the minimal termcap file from the standard
> one, and putting that in /rescue. I have a few ideas of my own so
> the system would automatically pick up that minimal file. Just a
> matter of finding the time to test it all... :-)
I started that PR. Subsequently there was a short discussion off-list where
it turned out that Warner Losh had a compact termcap file which could be
committed - it's attached below. However nothing further happened.
Anybody care to commit it? I guess some rescue/Makefile magic needs updating
to install it in the right place.
Regards,
Brian.
At 1:57 PM +0100 6/18/05, Brian Candler wrote: >[from freebsd-current] >On Sat, Jun 18, 2005 at 12:48:04AM -0400, Garance A Drosehn wrote: >> >Yes, I'm aware of PR bin/80256, but that appears to stalled in >> >a state of limbo. >> >> I've also been meaning to do something about that idea of a small >> termcap file. I don't remember what the PR says, but someone had a >> good idea of generating the minimal termcap file from the standard >> one, and putting that in /rescue. I have a few ideas of my own so >> the system would automatically pick up that minimal file. Just a >> matter of finding the time to test it all... :-) > >I started that PR. Subsequently there was a short discussion off-list >where it turned out that Warner Losh had a compact termcap file >which could be committed - it's attached below. However nothing >further happened. I am aware of Warner's termcap file, and I had talked with him earlier this year about committing something along those lines. I forget if I was going to commit his exact termcap file, or some auto-generated alternative, but I do have the emails around here somewhere. I know that *at the time* I knew what I had planned to do, and that Warner had nodded in general agreement to whatever that was... Right now I am busy finishing off some changes to `env', which will fix some problems introduced by a different change that I made earlier this year. Once I have those changes sorted out, I'll go back and look at my emails on this termcap idea. (Unless, of course, anyone else wants to do it before I get to it!) -- Garance Alistair Drosehn = gad@gilead.netel.rpi.edu Senior Systems Programmer or gad@FreeBSD.org Rensselaer Polytechnic Institute; Troy, NY; USA At 1:57 PM +0100 6/18/05, Brian Candler wrote: >[from freebsd-current] >On Sat, Jun 18, 2005 at 12:48:04AM -0400, Garance A Drosehn wrote: >> >Yes, I'm aware of PR bin/80256, but that appears to stalled in >> >a state of limbo. >> >> I've also been meaning to do something about that idea of a small >> termcap file. I don't remember what the PR says, but someone had a >> good idea of generating the minimal termcap file from the standard >> one, and putting that in /rescue. I have a few ideas of my own so >> the system would automatically pick up that minimal file. Just a >> matter of finding the time to test it all... :-) > >I started that PR. Subsequently there was a short discussion off-list >where it turned out that Warner Losh had a compact termcap file >which could be committed - it's attached below. However nothing >further happened. I am aware of Warner's termcap file, and I had talked with him earlier this year about committing something along those lines. I forget if I was going to commit his exact termcap file, or some auto-generated alternative, but I do have the emails around here somewhere. I know that *at the time* I knew what I had planned to do, and that Warner had nodded in general agreement to whatever that was... Right now I am busy finishing off some changes to `env', which will fix some problems introduced by a different change that I made earlier this year. Once I have those changes sorted out, I'll go back and look at my emails on this termcap idea. (Unless, of course, anyone else wants to do it before I get to it!) -- Garance Alistair Drosehn = gad@gilead.netel.rpi.edu Senior Systems Programmer or gad@FreeBSD.org Rensselaer Polytechnic Institute; Troy, NY; USA _______________________________________________ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org" In message: <p06210211bed9fe36bf2d@[128.113.24.47]>
Garance A Drosehn <gad@freebsd.org> writes:
: At 1:57 PM +0100 6/18/05, Brian Candler wrote:
: >[from freebsd-current]
: >On Sat, Jun 18, 2005 at 12:48:04AM -0400, Garance A Drosehn wrote:
: >> >Yes, I'm aware of PR bin/80256, but that appears to stalled in
: >> >a state of limbo.
: >>
: >> I've also been meaning to do something about that idea of a small
: >> termcap file. I don't remember what the PR says, but someone had a
: >> good idea of generating the minimal termcap file from the standard
: >> one, and putting that in /rescue. I have a few ideas of my own so
: >> the system would automatically pick up that minimal file. Just a
: >> matter of finding the time to test it all... :-)
: >
: >I started that PR. Subsequently there was a short discussion off-list
: >where it turned out that Warner Losh had a compact termcap file
: >which could be committed - it's attached below. However nothing
: >further happened.
:
: I am aware of Warner's termcap file, and I had talked with him earlier
: this year about committing something along those lines. I forget if
: I was going to commit his exact termcap file, or some auto-generated
: alternative, but I do have the emails around here somewhere. I know
: that *at the time* I knew what I had planned to do, and that Warner
: had nodded in general agreement to whatever that was...
See src/etc/termcap.small. Been there a long time.
Warner
On Mon, 20 Jun 2005, M. Warner Losh wrote: > In message: <p06210211bed9fe36bf2d@[128.113.24.47]> > Garance A Drosehn <gad@freebsd.org> writes: > : At 1:57 PM +0100 6/18/05, Brian Candler wrote: > : >[from freebsd-current] > : >On Sat, Jun 18, 2005 at 12:48:04AM -0400, Garance A Drosehn wrote: > : >> >Yes, I'm aware of PR bin/80256, but that appears to stalled in > : >> >a state of limbo. > : >> > : >> I've also been meaning to do something about that idea of a small > : >> termcap file. I don't remember what the PR says, but someone had a > : >> good idea of generating the minimal termcap file from the standard > : >> one, and putting that in /rescue. I have a few ideas of my own so > : >> the system would automatically pick up that minimal file. Just a > : >> matter of finding the time to test it all... :-) > : > > : >I started that PR. Subsequently there was a short discussion off-list > : >where it turned out that Warner Losh had a compact termcap file > : >which could be committed - it's attached below. However nothing > : >further happened. > : > : I am aware of Warner's termcap file, and I had talked with him earlier > : this year about committing something along those lines. I forget if > : I was going to commit his exact termcap file, or some auto-generated > : alternative, but I do have the emails around here somewhere. I know > : that *at the time* I knew what I had planned to do, and that Warner > : had nodded in general agreement to whatever that was... > > See src/etc/termcap.small. Been there a long time. I think this should always be installed in /etc and used via $TERMPATH in minimal environments (always for root?). Bruce On Tue, Jun 21, 2005 at 07:10:20PM +0000, Bruce Evans wrote: > The following reply was made to PR bin/80256; it has been noted by GNATS. > > From: Bruce Evans <bde@zeta.org.au> > To: "M. Warner Losh" <imp@bsdimp.com> > Cc: freebsd-gnats-submit@FreeBSD.org > Subject: Re: bin/80256: /rescue/vi doesn't work without terminal database in > /usr > Date: Wed, 22 Jun 2005 05:03:01 +1000 (EST) > > On Mon, 20 Jun 2005, M. Warner Losh wrote: > > > In message: <p06210211bed9fe36bf2d@[128.113.24.47]> > > Garance A Drosehn <gad@freebsd.org> writes: > > : At 1:57 PM +0100 6/18/05, Brian Candler wrote: > > : >[from freebsd-current] > > : >On Sat, Jun 18, 2005 at 12:48:04AM -0400, Garance A Drosehn wrote: > > : >> >Yes, I'm aware of PR bin/80256, but that appears to stalled in > > : >> >a state of limbo. > > : >> > > : >> I've also been meaning to do something about that idea of a small > > : >> termcap file. I don't remember what the PR says, but someone had a > > : >> good idea of generating the minimal termcap file from the standard > > : >> one, and putting that in /rescue. I have a few ideas of my own so > > : >> the system would automatically pick up that minimal file. Just a > > : >> matter of finding the time to test it all... :-) > > : > > > : >I started that PR. Subsequently there was a short discussion off-list > > : >where it turned out that Warner Losh had a compact termcap file > > : >which could be committed - it's attached below. However nothing > > : >further happened. > > : > > : I am aware of Warner's termcap file, and I had talked with him earlier > > : this year about committing something along those lines. I forget if > > : I was going to commit his exact termcap file, or some auto-generated > > : alternative, but I do have the emails around here somewhere. I know > > : that *at the time* I knew what I had planned to do, and that Warner > > : had nodded in general agreement to whatever that was... > > > > See src/etc/termcap.small. Been there a long time. > > I think this should always be installed in /etc and used via $TERMPATH > in minimal environments (always for root?). > Something like src/release/picobsd/mfs_tree/etc/termcap. Cheers, -- Ruslan Ermilov ru@FreeBSD.org FreeBSD committer export TERMCAP="cons25:cm=\E[%i%d;%dH";export TERM=cons25 -- Adios Responsible Changed From-To: freebsd-bugs->yar I have some ideas how to address this issue. yar 2007-10-17 19:58:50 UTC
FreeBSD src repository
Modified files:
share/termcap termcap.src
Log:
Delete an extra backslash at the end of the xterm-basic entry.
It can be missed easily that the following blank line formally
belongs to the xterm-basic entry due to the unneeded backslash.
PR: bin/80256 (audit trail)
Revision Changes Path
1.149 +1 -1 src/share/termcap/termcap.src
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Note: As soon as this bug is fixed, rescue(8) will need update because it discusses this bug. -- Yar State Changed From-To: open->patched Needs MFC. State Changed From-To: patched->analyzed The commit fixed only a small problem while this PR is about a larger issue. Author: rafan Date: Mon Jun 22 15:00:15 2009 New Revision: 194628 URL: http://svn.freebsd.org/changeset/base/194628 Log: - Fall-back to /etc/termcap.small if there is no /usr/share/misc/termcap (i.e. /etc/termcap). This can be useful when using /rescue/vi while /usr is not (or unable to be) mounted. The termcap.small can be found in src/etc/termcap.small. PR: bin/80256 (audit-trail) Submitted by: Brian Candler <B.Candler at pobox.com>, Alex Kozlov <spam at rm-rf.kiev.ua> MFC after: 1 month Modified: head/lib/ncurses/ncurses/pathnames.h Modified: head/lib/ncurses/ncurses/pathnames.h ============================================================================== --- head/lib/ncurses/ncurses/pathnames.h Mon Jun 22 14:43:48 2009 (r194627) +++ head/lib/ncurses/ncurses/pathnames.h Mon Jun 22 15:00:15 2009 (r194628) @@ -30,5 +30,5 @@ * $FreeBSD$ */ -#define _PATH_DEF ".termcap /usr/share/misc/termcap" +#define _PATH_DEF ".termcap /usr/share/misc/termcap /etc/termcap.small" #define _PATH_DEF_SEC "/usr/share/misc/termcap" _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" /rescue/vi doesn't work yet because it seems /etc/termcap.small doesn't get installed during installworld. -- Bruce Cran State Changed From-To: analyzed->patched With r204820 termcap.small is now installed into /etc. State Changed From-To: patched->closed committed a long time ago |