Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Mar 2002 15:55:43 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Alexey Zelkin <phantom@FreeBSD.ORG>
Cc:        <arch@FreeBSD.ORG>
Subject:   Re: rcsid's in libc
Message-ID:  <20020322152800.M16722-100000@gamplex.bde.org>
In-Reply-To: <20020321190801.A25339@gate.sim.ionidea.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 21 Mar 2002, Alexey Zelkin wrote:

> We have a mess of definitions to include RCS IDs into object files
> while building libc. Currently we're using following defitions
> in libc's sources: SYSLIBC_RCS, LIBC_RCS, LIBC_SCCS. Actually only
> first two defines are enabled by default in libc/Makefile. First
> one is used to include RCS ID in syscalls object files (asm), second
> in all others (c). LIBC_SCCS is used in lots of files, but never
> defined in Makefiles.

I recently reenabled them all.  About 20 files failed to compile due
to bitrot in the ifdefed code (e.g., `static chat rcsid[] ...').
Rev.1.8 of libc/Makefile was more than 7 years premature/incomplete
in switching from sccsids to rcsids.  The sccsids must still be enabled
to get an id in the object file in about 80% of the files.

> I'd like to remove LIBC_RCS and LIBC_SCCS usages and switch them
> to __FBSDID() macro. Also as part of this cleanup I'd like to move
> all "#if 0"'ed CSRG/Sun/etc SCCS strings to comments area (bottom
> of copyright as done in many places of our source tree).

I strongly object to moving the vendor ids.  Moving them mainly creates
work to move them and creates future work to resolve conflicts for any
future merges from the vendor branch.

> I've made a small patch against libc/Makefile, libc/sys/*.c and
> libc/xdr/*.c to show way that I prefer and receive feedback/objections
> against this cleanup. If no objections will be received I'll hack out
> other files and commit it.

Here are patches for my current version of the Makefile.  I don't really
like them.  The *LIBC*CS defines should go away _after_ __FBSDID() has
been added to all files (included generated ones).

%%%
Index: Makefile
===================================================================
RCS file: /home/ncvs/src/lib/libc/Makefile,v
retrieving revision 1.31
diff -u -2 -r1.31 Makefile
--- Makefile	13 Aug 2001 21:48:43 -0000	1.31
+++ Makefile	21 Mar 2002 13:12:28 -0000
@@ -4,12 +4,20 @@
 # All library objects contain rcsid strings by default; they may be
 # excluded as a space-saving measure.  To produce a library that does
-# not contain these strings, delete -DLIBC_RCS and -DSYSLIBC_RCS
-# from CFLAGS below.  To remove these strings from just the system call
-# stubs, remove just -DSYSLIBC_RCS from CFLAGS.
+# not contain these strings, delete -DLIBC_RCS, -DLIBC_SCCS, -DSYSLIBC_SCCS
+# and -DSYSLIBC_RCS from CFLAGS below, and add -DSTRIP_FBSDID to CFLAGS
+# (see <sys/cdefs.h>).  To remove these strings from just the system call
+# stubs, remove just -DSYSLIBC_RCS and -DSYSLIBC_RCS from CFLAGS.
+#
+# XXX NOT all library objects contain rcsid strings by default.  Most
+# contain only sccsids.  Most didn't even contain those until *LIBC_SCCS
+# was reenabled recently.  There are no ids for syscall stubs whose sources
+# are generated.  Did I miss anything?
 LIB=c
 SHLIB_MAJOR= 5
 SHLIB_MINOR= 0
-CFLAGS+=-DLIBC_RCS -DSYSLIBC_RCS -I${.CURDIR}/include -I${.CURDIR}/../../include
-CFLAGS+=-DLIBC_MAJOR=${SHLIB_MAJOR}
+CFLAGS+=-DLIBC_RCS -DSYSLIBC_RCS
+#CFLAGS+=-DLIBC_SCCS -DSYSLIBC_SCCS
+CFLAGS+=-DLIBC_MAJOR=${SHLIB_MAJOR}	# XXX temporary until SHLIB_MAJOR is 6.
+CFLAGS+=-I${.CURDIR}/include
 AINC=	-I${.CURDIR}/${MACHINE_ARCH}
 CLEANFILES+=tags
%%%

> I already tried to show up this question for few times before, but
> due to different reasons it was postponed. But now (since __FBSDID()
> macro is introduced and things settled up) I see no reasons to not
> to do it.

I still have minor disagreements with obrien about how vendor ids should
be ifdefed, and don't want to see __FBSDID() added in lots of wrong
places.

> Index: Makefile
> ===================================================================
> RCS file: /cvs/freebsd/src/lib/libc/Makefile,v
> retrieving revision 1.31
> diff -u -u -r1.31 Makefile
> --- Makefile	13 Aug 2001 21:48:43 -0000	1.31
> +++ Makefile	21 Mar 2002 16:57:20 -0000
> @@ -3,18 +3,23 @@
>  #
>  # All library objects contain rcsid strings by default; they may be
>  # excluded as a space-saving measure.  To produce a library that does
> -# not contain these strings, delete -DLIBC_RCS and -DSYSLIBC_RCS
> -# from CFLAGS below.  To remove these strings from just the system call
> -# stubs, remove just -DSYSLIBC_RCS from CFLAGS.
> +# not contain these strings use -DNO_LIBCRCS make's option to build.
> +
>  LIB=c
>  SHLIB_MAJOR= 5
>  SHLIB_MINOR= 0
> -CFLAGS+=-DLIBC_RCS -DSYSLIBC_RCS -I${.CURDIR}/include -I${.CURDIR}/../../include
> +CFLAGS+=-I${.CURDIR}/include -I${.CURDIR}/../../include
>  CFLAGS+=-DLIBC_MAJOR=${SHLIB_MAJOR}
>  AINC=	-I${.CURDIR}/${MACHINE_ARCH}
>  CLEANFILES+=tags
>  INSTALL_PIC_ARCHIVE=	yes
>  PRECIOUSLIB=	yes
> +
> +.if defined(NO_LIBCRCS)

Should be NO_LIB_IDS and apply to all libraries.

> +CFLAGS+=-DSTRIP_FBSDID
> +.else
> +CFLAGS+=-DSYSLIBC_RCS
> +.endif

An ifdef for this is better than [rotted] instructions about what to
comment out.

> Index: sys/__error.c
> ===================================================================
> RCS file: /cvs/freebsd/src/lib/libc/sys/__error.c,v
> retrieving revision 1.3
> diff -u -u -r1.3 __error.c
> --- sys/__error.c	10 Apr 2001 04:11:50 -0000	1.3
> +++ sys/__error.c	21 Mar 2002 16:32:10 -0000
> @@ -29,10 +29,10 @@
>   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
>   * SUCH DAMAGE.
>   *
> - * $FreeBSD: src/lib/libc/sys/__error.c,v 1.3 2001/04/10 04:11:50 deischen Exp $
>   */

Style bug: not removing the empty line that gave a new paragraph for
$FreeBSD

> Index: sys/ftruncate.c
> ===================================================================
> RCS file: /cvs/freebsd/src/lib/libc/sys/ftruncate.c,v
> retrieving revision 1.4
> diff -u -u -r1.4 ftruncate.c
> --- sys/ftruncate.c	24 Jan 2001 13:01:07 -0000	1.4
> +++ sys/ftruncate.c	21 Mar 2002 16:33:58 -0000
> @@ -30,12 +30,11 @@
>   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
>   * SUCH DAMAGE.
>   *
> - * $FreeBSD: src/lib/libc/sys/ftruncate.c,v 1.4 2001/01/24 13:01:07 deischen Exp $
> + *	@(#)ftruncate.c 8.1 (Berkeley) 6/17/93
>   */

I strongly object to moving vendor ids like this.

> ....
> Index: xdr/xdr.c
> ===================================================================
> RCS file: /cvs/freebsd/src/lib/libc/xdr/xdr.c,v
> retrieving revision 1.11
> diff -u -u -r1.11 xdr.c
> --- xdr/xdr.c	19 Mar 2001 12:49:57 -0000	1.11
> +++ xdr/xdr.c	21 Mar 2002 16:39:16 -0000
> @@ -27,14 +27,13 @@
>   * Sun Microsystems, Inc.
>   * 2550 Garcia Avenue
>   * Mountain View, California  94043
> + *
> + *	from: @(#)xdr.c 1.35 87/08/12
> + *	from: @(#)xdr.c 2.1 88/07/29 4.0 RPCSRC
>   */
>
>  #include <sys/cdefs.h>
> -#if defined(LIBC_SCCS) && !defined(lint)
> -/*static char *sccsid = "from: @(#)xdr.c 1.35 87/08/12";*/
> -/*static char *sccsid = "from: @(#)xdr.c	2.1 88/07/29 4.0 RPCSRC";*/
> -static char *rcsid = "$FreeBSD: src/lib/libc/xdr/xdr.c,v 1.11 2001/03/19 12:49:57 alfred Exp $";
> -#endif
> +__FBSDID("$FreeBSD$");

This demonstrates several layers of how not to handle [vendor] ids.  In
rev.1.1, there were the 2 commented out sccsids, and an rcsid with and Paul
(Vixie?)'s $Id$.  Not too bad.  The $Id$ was corrupted to a FreeBSD $Id$
in rev.1.2.  Rev.1.5 changed $Id$ to $FreeBSD$; rev.1.6 changed $FreeBSD$
to $Id$; rev.1.9 changed $Id$ to $FreeBSD$.  The vendor $Id$ is still
wrong.

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020322152800.M16722-100000>