ports/172745: The port sessreg does not compile in 9.1-PRERELEASE #23
Jason E. Hale
jhale at freebsd.org
Tue Oct 16 04:50:02 UTC 2012
The following reply was made to PR ports/172745; it has been noted by GNATS.
From: "Jason E. Hale" <jhale at freebsd.org>
To: Joao Rocha Braga Filho <goffredo at gmail.com>, bug-followup at freebsd.org
Cc:
Subject: Re: ports/172745: The port sessreg does not compile in 9.1-PRERELEASE #23
Date: Tue, 16 Oct 2012 00:40:23 -0400
On Tuesday, October 16, 2012 01:11:02 Joao Rocha Braga Filho wrote:
> On Tue, Oct 16, 2012 at 12:45 AM, Jason E. Hale <jhale at freebsd.org> wrote:
> > On Tuesday, October 16, 2012 00:12:45 Joao Rocha Braga Filho wrote:
> >>
> >> In my computer:
> >>
> >> "
> >> root:[152] find /usr/obj/ -name 'ttyslot*' -ls
> >> 1183232 4 -rw-r--r-- 1 root wheel
> >> 1344 Oct 13 15:46 /usr/obj/usr/src/lib/libc/ttyslot.o
> >> 1184362 4 -rw-r--r-- 1 root wheel
> >> 1344 Oct 13 15:47 /usr/obj/usr/src/lib/libc/ttyslot.So
> >> 1189387 4 -rw-r--r-- 1 root wheel
> >> 1488 Oct 13 17:15 /usr/obj/usr/src/lib/libc/ttyslot.po
> >> 1508043 4 -rw-r--r-- 1 root wheel
> >>
> >> 810 Oct 13 17:49 /usr/obj/lib32/usr/src/lib/libc/ttyslot.o
> >>
> >> 1509178 4 -rw-r--r-- 1 root wheel
> >>
> >> 892 Oct 13 17:50 /usr/obj/lib32/usr/src/lib/libc/ttyslot.po
> >>
> >> 1510314 4 -rw-r--r-- 1 root wheel
> >>
> >> 810 Oct 13 17:51 /usr/obj/lib32/usr/src/lib/libc/ttyslot.So
> >>
> >> root:[153]
> >> "
> >>
> >> But is more strange:
> >>
> >> "
> >> root:[161] l /usr/lib/libc.*
> >> 3456 -r--r--r-- 1 root wheel 3511792 Oct 13 16:16 /usr/lib/libc.a
> >>
> >> 0 lrwxr-xr-x 1 root wheel 14 Oct 13 16:16 /usr/lib/libc.so
> >>
> >> -> /lib/libc.so.7
> >> root:[162] nm /usr/lib/libc.a | grep ttyslot
> >> ttyslot.o:
> >> 0000000000000000 T __ttyslot
> >> 0000000000000000 T ttyslot at FBSD_1.0
> >> root:[163] nm /lib/libc.so.7 | grep ttyslot
> >> nm: /lib/libc.so.7: no symbols
> >> root:[164] l /lib/libc.so.7
> >> 1344 -r--r--r-- 1 root wheel 1358392 Oct 13 16:16 /lib/libc.so.7
> >> "
> >>
> >> Why didn't compiled?
> >
> > Because the ttyslot() function has been removed.
>
> But sessreg uses.
Only if the system has utmp.h. FreeBSD 9.x has utmpx.h. ttyslot() is only
used in one place and is wrapped by an #ifdef that shouldn't be activated on
FreeBSD 9.x.
Do you still have /usr/include/utmp.h? If so, delete it.
> And is in man page:
>
> "
> TTYNAME(3) FreeBSD Library Functions Manual
> TTYNAME(3)
>
> NAME
> ttyname, ttyname_r, isatty, ttyslot -- get name of associated terminal
> (tty) from file descriptor
>
> LIBRARY
> Standard C Library (libc, -lc)
>
> SYNOPSIS
> #include <unistd.h>
>
> char *
> ttyname(int fd);
>
> int
> ttyname_r(int fd, char *buf, size_t len);
>
> int
> isatty(int fd);
>
> int
> ttyslot(void);
>
> DESCRIPTION
> These functions operate on the system file descriptors for terminal
> type devices. These descriptors are not related to the standard I/O FILE
> typedef, but refer to the special device files found in /dev and for which
> an entry exists in the initialization file /etc/ttys or pseudo-ter- minals.
> (See ttys(5).)
>
> The isatty() function determines if the file descriptor fd refers to a
> valid terminal type device.
>
> The ttyname() function gets the related device name of a file
> descriptor for which isatty() is true.
>
> The ttyname() function returns the name stored in a static buffer which
> will be overwritten on subsequent calls. The ttyname_r() function takes a
> buffer and length as arguments to avoid this problem.
>
> The ttyslot() function fetches the current process' control terminal
> num- ber from the ttys(5) file entry.
> "
>
> At the end says:
>
> "
> HISTORY
> The isatty(), ttyname(), and ttyslot() functions appeared in Version 7
> AT&T UNIX. The ttyname_r() function appeared in FreeBSD 6.0.
>
> FreeBSD 9.1 May 14, 2005 FreeBSD
> 9.1 "
>
> Man page must be updated.
>
It has been. I don't know why yours still has ttyslot in it.
http://svnweb.freebsd.org/base/stable/9/lib/libc/gen/ttyname.3?revision=225736&view=markup
> May happen again, since ttyslot is a 35 old years old function.
>
> (I used Version 7 running in a PDP 11/70.)
>
And now it's gone. :)
> >> "
> >> root:[173] make
> >> ===> Building for sessreg-1.0.7
> >> make all-recursive
> >> Making all in man
> >>
> >> CCLD sessreg
> >>
> >> sessreg.o: In function `main':
> >> sessreg.c:(.text+0xc7a): undefined reference to `ttyslot'
> >> *** [sessreg] Error code 1
> >>
> >> Stop in /usr/ports/x11/sessreg/work/sessreg-1.0.7.
> >> *** [all-recursive] Error code 1
> >>
> >> Stop in /usr/ports/x11/sessreg/work/sessreg-1.0.7.
> >> *** [all] Error code 1
> >>
> >> Stop in /usr/ports/x11/sessreg/work/sessreg-1.0.7.
> >> *** [do-build] Error code 1
> >>
> >> Stop in /usr/ports/x11/sessreg.
> >> "
> >
> > If you upgraded this machine from FreeBSD < 9.0 at any point then you
> > probably have some leftovers that need to be removed which is why I
> > suggested running make delete-old
>
> This system started in FreeBSD 7.x, in 02/2009, and was updated several
> times.
>
> I will do "make delete-old" when FreeBSD 9.1 RELEASE. Thanks.
>
Why wait?
> >> Or:
> >>
> >> "
> >> goffredo:[1019] cc -s -o ttyslot_test3 ttyslot_test.c
> >> /tmp//ccFx55lb.o: In function `main':
> >> ttyslot_test.c:(.text+0xa): undefined reference to `ttyslot'
> >> goffredo:[1020] cat ttyslot_test.c
> >>
> >> #include <stdio.h>
> >> #include <unistd.h>
> >>
> >>
> >> main()
> >> {
> >>
> >> printf( "%d\n",ttyslot() );
> >>
> >> }
> >>
> >> goffredo:[1021] cc -s -o ttyslot_test ttyslot_test.c
> >> /tmp//ccKUda6b.o: In function `main':
> >> ttyslot_test.c:(.text+0xa): undefined reference to `ttyslot'
> >> goffredo:[1022]
> >> "
> >
> > That won't compile since ttyslot is not in stdlib.h anymore in FreeBSD
> > 9.x.
> > All ttyslot() does now is return 0. See:
> > http://svnweb.freebsd.org/base/release/9.0.0/lib/libc/gen/ttyslot.c?view=l
> > og
> I saw the source code. It is a "return(0)" function.
>
>
> And about sessreg? Will be created a patch?
>
It doesn't need a patch. If you get rid of /usr/include/utmp.h it will
probably build for you.
- Jason
More information about the freebsd-ports-bugs
mailing list