-dynamic-linker=/libexec/ld.elf_so) if the BINDIR of the program being
built is /bin or /sbin.
The reason we do this is because now all programs *except* those in
/bin and /sbin (i.e. the "special cases") match the default the compiler
uses, which is what is used for things in e.g. xsrc, pkgsrc, and other
random 3rd party programs.
This is done by decoupling where a shlib is installed from how it
is located. Two new variables, SHLIBINSTALLDIR and SHLINKINSTALLDIR,
contain the former information, and key off MKDYNAMICROOT only. SHLIBDIR
and SHLINKDIR contain the latter, and key off MKDYNAMICROOT and BINDIR.
The SHLIBINSTALLDIR, SHLIBDIR, _LIBSODIR, SHLINKINSTALLDIR, and
SHLINKDIR parameters are moved to a new <bsd.shlib.mk>; see bsd.README
for usage details.
- SHLIBDIR Location to install shared libraries if ${USE_SHLIBDIR}
is "yes". Defaults to "/usr/lib".
- USE_SHLIBDIR If "yes", install shared libraries in ${SHLIBDIR}
instead of ${LIBDIR}. Defaults to "no".
Sets ${_LIBSODIR} to the appropriate value.
This may be set by individual Makefiles as well.
- SHLINKDIR Location of shared linker. Defaults to "/usr/libexec".
If != "/usr/libexec", change the dynamic-linker
encoded in shared programs
* Set USE_SHLIBDIR for libraries used by /bin and /sbin:
libc libcrypt libcrypto libedit libipsec libkvm libm libmi387
libtermcap libutil libz
* If ${_LIBSODIR} != ${LIBDIR}, add symlinks from ${LIBDIR}/${LIB}.so*
to ${_LIBSODIR}/${LIB}.so* for compatibility.
* Always install /sbin/init statically (for now)
The net effect of these changes depends on how the variables are set:
1.) If nothing is set or changed, there is no change from the
current behaviour:
- Static /bin, /sbin, and bits of /usr/*
- Dynamic rest
- Shared linker is /usr/libexec/ld*so
2.) If the following make variables are set:
LDSTATIC=
SHLINKDIR=/lib
SHLIBDIR=/lib
Then the behaviour becomes:
- Dynamic tools
- .so libraries used by /bin and /sbin are installed to /lib,
with symlinks from /usr/lib/lib*so to -> /lib/lib*so
where appropriate
- Shared linker is /lib/ld*so
3.) As per 2.), but add the following variable:
USE_SHLIBDIR=yes
This forces all .so's to be instaleld in /lib (with compat
symlinks), not just those tagged by their Makefiles to be.
Again, compat symlinks are installed
Re-write t_agetstr() so that it does not use realloc so userland
programs don't break. We now use an internal buffer to keep track
of the memory we allocate. This changes the api of t_agetstr() to
take 2 fewer arguments, but there are not many programs that use it.
Please note that this does not change binary compatibility with the
previous t_agetstr() since the usage was:
char *area, *p;
*area = NULL;
t_agetstr(ti, "ic", &area, &p);
...
free(area);
Since we don't touch the arguments and free(NULL) is a no-op, nothing
breaks.
Since we don't break binary compatibility there is no reason to bump
the library's major number, but since we change t_agetstr() I'll bump
the minor number for good measure.
until the problem gets addressed properly. The following fix
is a stopgap measure to stop the leaking :-(
I fixed the t_getstr() memory leak problem, but that instantly
revealed a problem in t_agetstr() which is an extremely broken
interface. It realloc's memory, potentially moving the area where
it returned pointers into in previous calls. This function needs
to be removed and or changed. I added a horrible work-around for
now, but I will revisit the problem shortly. In the meantime nobody
should be using the t_agetstr() API, and I'll be fixing the rest
of the programs and or the API when I figure out the best solution...
This is t_agetstr() is used by:
games/hack/hack.termcap.c
games/larn/io.c
games/tetris/screen.c
lib/libterm/termcap.c
lib/libterm/termcap.h
libexec/getty/main.c
usr.bin/top/screen.c
usr.bin/ul/ul.c
- use strlcpy() instead of strncpy() to avoid the off-by-one error
and the three missing '\0' terminations.
- perform bounds checks to make sure we don't turn this into a random
memory writing tool using setenv HOME `perl -e 'print "a"x5000'`
these capabilities and stashes them in "struct tinfo" for t_goto to
use. This makes the t_goto call more efficient and plugs a memory
leak that was present in the original t_goto implementation.
Thanks to Itojun for spotting this one too!
ZZ attribute which indicates the TERMCAP was exported from another
programme and has been truncated. Iff a real termcap entry cannot be
found then TERMCAP with a ZZ in it will be used as a last resort.