From owner-freebsd-audit Sun Jul 1 2: 6: 3 2001 Delivered-To: freebsd-audit@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id D68E637B401 for ; Sun, 1 Jul 2001 02:05:59 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id TAA08607; Sun, 1 Jul 2001 19:05:38 +1000 Date: Sun, 1 Jul 2001 19:03:40 +1000 (EST) From: Bruce Evans X-Sender: bde@besplex.bde.org To: Mike Barcroft Cc: audit@FreeBSD.ORG Subject: Re: src/bin/ed patch In-Reply-To: <200106290428.f5T4S0C97998@coffee.q9media.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Fri, 29 Jun 2001, Mike Barcroft wrote: > ed.20010628.patch > > o Since the rcsids are generating warnings, switch to __RCSID(). Please don't. obrien and I are trying to decide whether ids (initially in libc) should be changed to use __RCSID() when they are cleaned up. I think we are unlikely to use it. One problem is that it is also used in other BSDs, so it can't be used to hide messy ifdefs to control the visibility of the id string in a system-dependent way. > Index: ed/buf.c > =================================================================== > RCS file: /home/ncvs/src/bin/ed/buf.c,v > retrieving revision 1.17 > diff -u -r1.17 buf.c > --- ed/buf.c 1999/08/27 23:14:12 1.17 > +++ ed/buf.c 2001/06/29 04:05:43 > @@ -24,15 +24,13 @@ > * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > * SUCH DAMAGE. > + * > + * @(#)buf.c,v 1.4 1994/02/01 00:34:35 alm Exp > */ This is a regression to approximately rev.1.10 (rev.1.11 moved the id from here to the rcsid). > #ifndef lint > -#if 0 > -static char * const rcsid = "@(#)buf.c,v 1.4 1994/02/01 00:34:35 alm Exp"; This is just a corrupted vendor id (1.4 is for FreeBSD rev.1.4), except it is more corrupt than most (it misspells "sccsid", declares rcsid as a pointer instead of an array, and uses an insufficient number of "const"s to compensate for rcsid being a pointer. The id in rev.1.1 was: #ifndef lint static char sccsid[] = "@(#)buf.c 5.5 (Berkeley) 3/28/93"; #endif /* not lint */ but I'm not sure if this file ever had anything to do with CSRG (it is not in Lite2). I would just remove this id (don't move it even further from where a vendor should have put it). > -#else > -static char * const rcsid = > - "$FreeBSD: src/bin/ed/buf.c,v 1.17 1999/08/27 23:14:12 peter Exp $"; The correct fix is to declare rcsid normally: static const char rcsid[] = > -#endif > +#include > +__RCSID("$FreeBSD: src/bin/ed/buf.c,v 1.17 1999/08/27 23:14:12 peter Exp $"); > #endif /* not lint */ Similarly in the other files, except for the history of the id breakage. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sun Jul 1 7:52:51 2001 Delivered-To: freebsd-audit@freebsd.org Received: from coffee.q9media.com (coffee.q9media.com [216.94.229.19]) by hub.freebsd.org (Postfix) with ESMTP id 8EBF237B401 for ; Sun, 1 Jul 2001 07:52:35 -0700 (PDT) (envelope-from mike@coffee.q9media.com) Received: (from mike@localhost) by coffee.q9media.com (8.11.2/8.11.2) id f61F6P904227; Sun, 1 Jul 2001 11:06:25 -0400 (EDT) (envelope-from mike) Date: Sun, 1 Jul 2001 11:06:25 -0400 (EDT) Message-Id: <200107011506.f61F6P904227@coffee.q9media.com> To: Bruce Evans From: Mike Barcroft Cc: audit@FreeBSD.org Subject: Re: src/bin/ed patch Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Bruce Evans writes: > On Fri, 29 Jun 2001, Mike Barcroft wrote: > > o Since the rcsids are generating warnings, switch to __RCSID(). > > Please don't. obrien and I are trying to decide whether ids (initially > in libc) should be changed to use __RCSID() when they are cleaned up. > I think we are unlikely to use it. One problem is that it is also used > in other BSDs, so it can't be used to hide messy ifdefs to control the > visibility of the id string in a system-dependent way. Why not just add a switch in /etc/{defaults/,}make.conf to allow one to control the visibility of RCSIDs? What concern is it of ours if the other BSDs embed RCSIDs unconditionally? In any event, __RCSID() doesn't appear ready for general use. An updated version of my patch is available at the end of this message and also at: http://testbed.q9media.net/freebsd/ed.20010701.patch This patch will need to be tested on an Alpha before committing. Best regards, Mike Barcroft ----------------------------------------------------------------------- ed.20010701.patch o Correctly define rcsid [requested by bde]. o Add consts where appropriate. o Rename some variables that are shadowing global declarations. o Set WARNS?=2 Index: ed/Makefile =================================================================== RCS file: /home/ncvs/src/bin/ed/Makefile,v retrieving revision 1.18 diff -u -r1.18 Makefile --- ed/Makefile 2000/02/29 11:39:24 1.18 +++ ed/Makefile 2001/07/01 14:29:05 @@ -1,6 +1,7 @@ # $FreeBSD: src/bin/ed/Makefile,v 1.18 2000/02/29 11:39:24 markm Exp $ PROG= ed +WARNS?= 2 SRCS= buf.c cbc.c glbl.c io.c main.c re.c sub.c undo.c LINKS= ${BINDIR}/ed ${BINDIR}/red MLINKS= ed.1 red.1 Index: ed/buf.c =================================================================== RCS file: /home/ncvs/src/bin/ed/buf.c,v retrieving revision 1.17 diff -u -r1.17 buf.c --- ed/buf.c 1999/08/27 23:14:12 1.17 +++ ed/buf.c 2001/07/01 14:29:05 @@ -27,12 +27,8 @@ */ #ifndef lint -#if 0 -static char * const rcsid = "@(#)buf.c,v 1.4 1994/02/01 00:34:35 alm Exp"; -#else -static char * const rcsid = +static const char rcsid[] = "$FreeBSD: src/bin/ed/buf.c,v 1.17 1999/08/27 23:14:12 peter Exp $"; -#endif #endif /* not lint */ #include Index: ed/cbc.c =================================================================== RCS file: /home/ncvs/src/bin/ed/cbc.c,v retrieving revision 1.13 diff -u -r1.13 cbc.c --- ed/cbc.c 2001/03/05 02:15:37 1.13 +++ ed/cbc.c 2001/07/01 14:29:05 @@ -33,17 +33,11 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * from: @(#)bdes.c 5.5 (Berkeley) 6/27/91 */ #ifndef lint -#if 0 -static char * const rcsid = "@(#)cbc.c,v 1.2 1994/02/01 00:34:36 alm Exp"; -#else -static char * const rcsid = +static const char rcsid[] = "$FreeBSD: src/bin/ed/cbc.c,v 1.13 2001/03/05 02:15:37 kris Exp $"; -#endif #endif /* not lint */ #include @@ -209,7 +203,7 @@ */ void des_error(s) - char *s; /* the message */ + const char *s; /* the message */ { (void)sprintf(errmsg, "%s", s ? s : strerror(errno)); } @@ -250,9 +244,9 @@ * convert the key to a bit pattern */ void -expand_des_key(obuf, ibuf) +expand_des_key(obuf, kbuf) char *obuf; /* bit pattern */ - char *ibuf; /* the key itself */ + char *kbuf; /* the key itself */ { register int i, j; /* counter in a for loop */ int nbuf[64]; /* used for hex/key translation */ @@ -260,13 +254,13 @@ /* * leading '0x' or '0X' == hex key */ - if (ibuf[0] == '0' && (ibuf[1] == 'x' || ibuf[1] == 'X')) { - ibuf = &ibuf[2]; + if (kbuf[0] == '0' && (kbuf[1] == 'x' || kbuf[1] == 'X')) { + kbuf = &kbuf[2]; /* * now translate it, bombing on any illegal hex digit */ - for (i = 0; ibuf[i] && i < 16; i++) - if ((nbuf[i] = hex_to_binary((int) ibuf[i], 16)) == -1) + for (i = 0; kbuf[i] && i < 16; i++) + if ((nbuf[i] = hex_to_binary((int) kbuf[i], 16)) == -1) des_error("bad hex digit in key"); while (i < 16) nbuf[i++] = 0; @@ -280,13 +274,13 @@ /* * leading '0b' or '0B' == binary key */ - if (ibuf[0] == '0' && (ibuf[1] == 'b' || ibuf[1] == 'B')) { - ibuf = &ibuf[2]; + if (kbuf[0] == '0' && (kbuf[1] == 'b' || kbuf[1] == 'B')) { + kbuf = &kbuf[2]; /* * now translate it, bombing on any illegal binary digit */ - for (i = 0; ibuf[i] && i < 16; i++) - if ((nbuf[i] = hex_to_binary((int) ibuf[i], 2)) == -1) + for (i = 0; kbuf[i] && i < 16; i++) + if ((nbuf[i] = hex_to_binary((int) kbuf[i], 2)) == -1) des_error("bad binary digit in key"); while (i < 64) nbuf[i++] = 0; @@ -300,7 +294,7 @@ /* * no special leader -- ASCII */ - (void)strncpy(obuf, ibuf, 8); + (void)strncpy(obuf, kbuf, 8); } /***************** @@ -391,7 +385,7 @@ char *msgbuf; /* I/O buffer */ FILE *fp; /* input file descriptor */ { - Desbuf ibuf; /* temp buffer for initialization vector */ + Desbuf tbuf; /* temp buffer for initialization vector */ register int n; /* number of bytes actually read */ register int c; /* used to test for EOF */ int inverse = 1; /* 0 to encrypt, 1 to decrypt */ @@ -400,11 +394,11 @@ /* * do the transformation */ - MEMCPY(BUFFER(ibuf), BUFFER(msgbuf), 8); + MEMCPY(BUFFER(tbuf), BUFFER(msgbuf), 8); DES_XFORM(UBUFFER(msgbuf)); for (c = 0; c < 8; c++) UCHAR(msgbuf, c) ^= UCHAR(ivec, c); - MEMCPY(BUFFER(ivec), BUFFER(ibuf), 8); + MEMCPY(BUFFER(ivec), BUFFER(tbuf), 8); /* * if the last one, handle it specially */ Index: ed/ed.h =================================================================== RCS file: /home/ncvs/src/bin/ed/ed.h,v retrieving revision 1.14 diff -u -r1.14 ed.h --- ed/ed.h 2001/05/29 18:03:13 1.14 +++ ed/ed.h 2001/07/01 14:29:06 @@ -200,7 +200,7 @@ int close_sbuf __P((void)); int copy_lines __P((long)); int delete_lines __P((long, long)); -void des_error __P((char *)); +void des_error __P((const char *)); int display_lines __P((long, long, int)); line_t *dup_line_node __P((line_t *)); int exec_command __P((void)); @@ -236,7 +236,7 @@ int join_lines __P((long, long)); int mark_line_node __P((line_t *, int)); int move_lines __P((long)); -line_t *next_active_node __P(()); +line_t *next_active_node __P((void)); long next_addr __P((void)); int open_sbuf __P((void)); char *parse_char_class __P((char *)); @@ -259,7 +259,7 @@ char *translit_text __P((char *, int, int, int)); void unmark_line_node __P((line_t *)); void unset_active_nodes __P((line_t *, line_t *)); -long write_file __P((char *, char *, long, long)); +long write_file __P((char *, const char *, long, long)); long write_stream __P((FILE *, long, long)); /* global buffers */ Index: ed/glbl.c =================================================================== RCS file: /home/ncvs/src/bin/ed/glbl.c,v retrieving revision 1.10 diff -u -r1.10 glbl.c --- ed/glbl.c 2000/10/16 07:06:35 1.10 +++ ed/glbl.c 2001/07/01 14:29:06 @@ -27,12 +27,8 @@ */ #ifndef lint -#if 0 -static char * const rcsid = "@(#)glob.c,v 1.1 1994/02/01 00:34:40 alm Exp"; -#else -static char * const rcsid = +static const char rcsid[] = "$FreeBSD: src/bin/ed/glbl.c,v 1.10 2000/10/16 07:06:35 brian Exp $"; -#endif #endif /* not lint */ #include @@ -210,7 +206,7 @@ /* next_active_node: return the next global-active line node */ line_t * -next_active_node() +next_active_node(void) { while (active_ptr < active_last && active_list[active_ptr] == NULL) active_ptr++; Index: ed/io.c =================================================================== RCS file: /home/ncvs/src/bin/ed/io.c,v retrieving revision 1.10 diff -u -r1.10 io.c --- ed/io.c 1999/08/27 23:14:14 1.10 +++ ed/io.c 2001/07/01 14:29:06 @@ -26,12 +26,8 @@ */ #ifndef lint -#if 0 -static char * const rcsid = "@(#)io.c,v 1.1 1994/02/01 00:34:41 alm Exp"; -#else -static char * const rcsid = +static const char rcsid[] = "$FreeBSD: src/bin/ed/io.c,v 1.10 1999/08/27 23:14:14 peter Exp $"; -#endif #endif /* not lint */ #include "ed.h" @@ -157,7 +153,7 @@ long write_file(fn, mode, n, m) char *fn; - char *mode; + const char *mode; long n; long m; { Index: ed/main.c =================================================================== RCS file: /home/ncvs/src/bin/ed/main.c,v retrieving revision 1.20 diff -u -r1.20 main.c --- ed/main.c 2001/06/28 22:06:27 1.20 +++ ed/main.c 2001/07/01 14:29:06 @@ -27,18 +27,10 @@ */ #ifndef lint -static char * const copyright = -"@(#) Copyright (c) 1993 Andrew Moore, Talke Studio. \n\ - All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint -#if 0 -static char * const rcsid = "@(#)main.c,v 1.1 1994/02/01 00:34:42 alm Exp"; -#else -static char * const rcsid = +static const char copyright[] = + "@(#) Copyright (c) 1993 Andrew Moore, Talke Studio. All rights reserved."; +static const char rcsid[] = "$FreeBSD: src/bin/ed/main.c,v 1.20 2001/06/28 22:06:27 dd Exp $"; -#endif #endif /* not lint */ /* @@ -100,8 +92,8 @@ long current_addr; /* current address in editor buffer */ long addr_last; /* last address in editor buffer */ int lineno; /* script line number */ -char *prompt; /* command-line prompt */ -char *dps = "*"; /* default command-line prompt */ +const char *prompt; /* command-line prompt */ +const char *dps = "*"; /* default command-line prompt */ const char usage[] = "usage: %s [-] [-sx] [-p string] [name]\n"; @@ -1385,12 +1377,13 @@ { char *hup = NULL; /* hup filename */ char *s; + char ed_hup[] = "ed.hup"; int n; if (!sigactive) quit(1); sigflags &= ~(1 << (signo - 1)); - if (addr_last && write_file("ed.hup", "w", 1, addr_last) < 0 && + if (addr_last && write_file(ed_hup, "w", 1, addr_last) < 0 && (s = getenv("HOME")) != NULL && (n = strlen(s)) + 8 <= PATH_MAX && /* "ed.hup" + '/' */ (hup = (char *) malloc(n + 10)) != NULL) { Index: ed/re.c =================================================================== RCS file: /home/ncvs/src/bin/ed/re.c,v retrieving revision 1.16 diff -u -r1.16 re.c --- ed/re.c 2001/05/29 18:03:14 1.16 +++ ed/re.c 2001/07/01 14:29:06 @@ -27,12 +27,8 @@ */ #ifndef lint -#if 0 -static char * const rcsid = "@(#)re.c,v 1.6 1994/02/01 00:34:43 alm Exp"; -#else -static char * const rcsid = +static const char rcsid[] = "$FreeBSD: src/bin/ed/re.c,v 1.16 2001/05/29 18:03:14 imp Exp $"; -#endif #endif /* not lint */ #include "ed.h" Index: ed/sub.c =================================================================== RCS file: /home/ncvs/src/bin/ed/sub.c,v retrieving revision 1.12 diff -u -r1.12 sub.c --- ed/sub.c 1999/08/27 23:14:15 1.12 +++ ed/sub.c 2001/07/01 14:29:06 @@ -27,12 +27,8 @@ */ #ifndef lint -#if 0 -static char * const rcsid = "@(#)sub.c,v 1.1 1994/02/01 00:34:44 alm Exp"; -#else -static char * const rcsid = +static const char rcsid[] = "$FreeBSD: src/bin/ed/sub.c,v 1.12 1999/08/27 23:14:15 peter Exp $"; -#endif #endif /* not lint */ #include "ed.h" Index: ed/undo.c =================================================================== RCS file: /home/ncvs/src/bin/ed/undo.c,v retrieving revision 1.9 diff -u -r1.9 undo.c --- ed/undo.c 1999/08/27 23:14:15 1.9 +++ ed/undo.c 2001/07/01 14:29:06 @@ -26,12 +26,8 @@ */ #ifndef lint -#if 0 -static char * const rcsid = "@(#)undo.c,v 1.1 1994/02/01 00:34:44 alm Exp"; -#else -static char * const rcsid = +static const char rcsid[] = "$FreeBSD: src/bin/ed/undo.c,v 1.9 1999/08/27 23:14:15 peter Exp $"; -#endif #endif /* not lint */ #include "ed.h" To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sun Jul 1 11:43:58 2001 Delivered-To: freebsd-audit@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id C152737B403 for ; Sun, 1 Jul 2001 11:43:54 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id EAA31664; Mon, 2 Jul 2001 04:43:45 +1000 Date: Mon, 2 Jul 2001 04:41:47 +1000 (EST) From: Bruce Evans X-Sender: bde@besplex.bde.org To: Mike Barcroft Cc: audit@FreeBSD.org Subject: Re: src/bin/ed patch In-Reply-To: <200107011506.f61F6P904227@coffee.q9media.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sun, 1 Jul 2001, Mike Barcroft wrote: > Bruce Evans writes: > > On Fri, 29 Jun 2001, Mike Barcroft wrote: > > > o Since the rcsids are generating warnings, switch to __RCSID(). > > > > Please don't. obrien and I are trying to decide whether ids (initially > > in libc) should be changed to use __RCSID() when they are cleaned up. > > I think we are unlikely to use it. One problem is that it is also used > > in other BSDs, so it can't be used to hide messy ifdefs to control the > > visibility of the id string in a system-dependent way. > > Why not just add a switch in /etc/{defaults/,}make.conf to allow one > to control the visibility of RCSIDs? What concern is it of ours if the > other BSDs embed RCSIDs unconditionally? It would be silly to have a switch to fully control FreeBSD rcsids if OtherBSD rcsids get embedded (in object files) unconditionally. > In any event, __RCSID() doesn't appear ready for general use. An > updated version of my patch is available at the end of this message > and also at: http://testbed.q9media.net/freebsd/ed.20010701.patch Thanks. I like most of this version. > Index: ed/main.c > =================================================================== > RCS file: /home/ncvs/src/bin/ed/main.c,v > retrieving revision 1.20 > diff -u -r1.20 main.c > --- ed/main.c 2001/06/28 22:06:27 1.20 > +++ ed/main.c 2001/07/01 14:29:06 > @@ -27,18 +27,10 @@ > */ > > #ifndef lint > -static char * const copyright = > -"@(#) Copyright (c) 1993 Andrew Moore, Talke Studio. \n\ > - All rights reserved.\n"; > -#endif /* not lint */ > - > -#ifndef lint > -#if 0 > -static char * const rcsid = "@(#)main.c,v 1.1 1994/02/01 00:34:42 alm Exp"; > -#else > -static char * const rcsid = > +static const char copyright[] = > + "@(#) Copyright (c) 1993 Andrew Moore, Talke Studio. All rights reserved."; > +static const char rcsid[] = > "$FreeBSD: src/bin/ed/main.c,v 1.20 2001/06/28 22:06:27 dd Exp $"; > -#endif > #endif /* not lint */ > > /* Why change the original copyright string (source and oupput format)? The copyright normally goes in a separate "#ifdef lint". > ... > @@ -1385,12 +1377,13 @@ > { > char *hup = NULL; /* hup filename */ > char *s; > + char ed_hup[] = "ed.hup"; > int n; > > if (!sigactive) > quit(1); > sigflags &= ~(1 << (signo - 1)); > - if (addr_last && write_file("ed.hup", "w", 1, addr_last) < 0 && > + if (addr_last && write_file(ed_hup, "w", 1, addr_last) < 0 && > (s = getenv("HOME")) != NULL && > (n = strlen(s)) + 8 <= PATH_MAX && /* "ed.hup" + '/' */ > (hup = (char *) malloc(n + 10)) != NULL) { The correct fix is to declare write_file()'s first arg as const. BTW, I think we're only seeing the tip of the iceberg for constant poisoning of function args. -Wwrite-strings triggers a few warnings for "char *" args, but there are zillions of interfaces that take pointers to data that is not changed by the interface yet not declared const. Change a top-level interface to declare things as const and the poison will spread to lower levels. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sun Jul 1 16:40:36 2001 Delivered-To: freebsd-audit@freebsd.org Received: from obsecurity.dyndns.org (adsl-64-169-104-161.dsl.lsan03.pacbell.net [64.169.104.161]) by hub.freebsd.org (Postfix) with ESMTP id 4CBA637B435 for ; Sun, 1 Jul 2001 16:40:28 -0700 (PDT) (envelope-from kris@obsecurity.org) Received: by obsecurity.dyndns.org (Postfix, from userid 1000) id 773ED678A8; Sun, 1 Jul 2001 16:40:26 -0700 (PDT) Date: Sun, 1 Jul 2001 16:40:24 -0700 From: Kris Kennaway To: audit@FreeBSD.org Subject: Committing patches submitted here Message-ID: <20010701164023.A25820@xor.obsecurity.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="M9NhX3UHpAaciwkO" Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --M9NhX3UHpAaciwkO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi all, It would be useful when someone commits a patch here to follow up the original message with a note stating as such, otherwise it's hard to tell whether the patch is outstanding. Most of the recent patches by Mike Barcroft seem to be in this category. Are there any outstanding? Kris --M9NhX3UHpAaciwkO Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) Comment: For info see http://www.gnupg.org iD8DBQE7P7TkWry0BWjoQKURAiCOAKCsK27uOyV5P/vCPE0dGfWlVE6bPACg9PBA hANrRcPj0/fx9+9FfvB1l3g= =4Jj+ -----END PGP SIGNATURE----- --M9NhX3UHpAaciwkO-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sun Jul 1 17: 8:12 2001 Delivered-To: freebsd-audit@freebsd.org Received: from bazooka.unixfreak.org (bazooka.unixfreak.org [63.198.170.138]) by hub.freebsd.org (Postfix) with ESMTP id 2259437B401 for ; Sun, 1 Jul 2001 17:08:11 -0700 (PDT) (envelope-from dima@unixfreak.org) Received: from hornet.unixfreak.org (hornet [63.198.170.140]) by bazooka.unixfreak.org (Postfix) with ESMTP id B0FF33E28; Sun, 1 Jul 2001 17:08:10 -0700 (PDT) To: Kris Kennaway Cc: audit@FreeBSD.org Subject: Re: Committing patches submitted here In-Reply-To: <20010701164023.A25820@xor.obsecurity.org>; from kris@obsecurity.org on "Sun, 1 Jul 2001 16:40:24 -0700" Date: Sun, 01 Jul 2001 17:08:10 -0700 From: Dima Dorfman Message-Id: <20010702000810.B0FF33E28@bazooka.unixfreak.org> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Kris Kennaway writes: > It would be useful when someone commits a patch here to follow up the > original message with a note stating as such, otherwise it's hard to > tell whether the patch is outstanding. Most of the recent patches by > Mike Barcroft seem to be in this category. Are there any outstanding? I guess this is mostly to me. AFAIK at least these haven't been committed (pasted out of my mailbox). 16 06/28 Mike Barcroft src/bin/chio patch<; Sun, 1 Jul 2001 17:12:47 -0700 (PDT) (envelope-from imp@harmony.village.org) Received: from harmony.village.org (localhost.village.org [127.0.0.1]) by harmony.village.org (8.11.3/8.11.1) with ESMTP id f620C8U29632; Sun, 1 Jul 2001 18:12:13 -0600 (MDT) (envelope-from imp@harmony.village.org) Message-Id: <200107020012.f620C8U29632@harmony.village.org> To: Dima Dorfman Subject: Re: Committing patches submitted here Cc: Kris Kennaway , audit@FreeBSD.ORG In-reply-to: Your message of "Sun, 01 Jul 2001 17:08:10 PDT." <20010702000810.B0FF33E28@bazooka.unixfreak.org> References: <20010702000810.B0FF33E28@bazooka.unixfreak.org> Date: Sun, 01 Jul 2001 18:12:08 -0600 From: Warner Losh Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I like Kris' idea of posting here when non-committers send in patches and they are committd. In message <20010702000810.B0FF33E28@bazooka.unixfreak.org> Dima Dorfman writes: : I guess this is mostly to me. AFAIK at least these haven't been : committed (pasted out of my mailbox). Excellent record keeping Dima Warner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sun Jul 1 19:40:57 2001 Delivered-To: freebsd-audit@freebsd.org Received: from snipe.mail.pas.earthlink.net (snipe.mail.pas.earthlink.net [207.217.120.62]) by hub.freebsd.org (Postfix) with ESMTP id 1C44C37B407; Sun, 1 Jul 2001 19:40:54 -0700 (PDT) (envelope-from cjc@earthlink.net) Received: from blossom.cjclark.org (dialup-209.245.135.39.Dial1.SanJose1.Level3.net [209.245.135.39]) by snipe.mail.pas.earthlink.net (EL-8_9_3_3/8.9.3) with ESMTP id TAA15280; Sun, 1 Jul 2001 19:40:51 -0700 (PDT) Received: (from cjc@localhost) by blossom.cjclark.org (8.11.4/8.11.3) id f622enZ11653; Sun, 1 Jul 2001 19:40:49 -0700 (PDT) (envelope-from cjc) Date: Sun, 1 Jul 2001 19:40:49 -0700 From: "Crist J. Clark" To: freebsd-audit@freebsd.org Cc: ru@freebsd.org Subject: src/sys/netinet/ip_fw.c Patch Message-ID: <20010701194049.J296@blossom.cjclark.org> Reply-To: cjclark@alum.mit.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Since this is a patch to a security-critical area, I thought I would make sure to send this here first. Presently, logging of IP fragmentation is broken (see PR kern/23446). It was suggested that instead of just fixing the bug, I go ahead and do it _all_ right. This code prints fragment information tcpdump(8)-style. For example, here is the ipfw log and tcpdump output of a 5000-byte ping, Jul 1 19:38:45 bubbles /boot/kernel/kernel: ipfw: 1000 Accept ICMP:8.0 192.168.64.60 192.168.64.20 in via ep0 (frag 53113:1480@0+) Jul 1 19:38:45 bubbles /boot/kernel/kernel: ipfw: 1000 Accept ICMP 192.168.64.60 192.168.64.20 in via ep0 (frag 53113:1480@1480+) Jul 1 19:38:45 bubbles /boot/kernel/kernel: ipfw: 1000 Accept ICMP 192.168.64.60 192.168.64.20 in via ep0 (frag 53113:1480@2960+) Jul 1 19:38:45 bubbles /boot/kernel/kernel: ipfw: 1000 Accept ICMP 192.168.64.60 192.168.64.20 in via ep0 (frag 53113:568@4440) 19:38:45.075886 192.168.64.60 > 192.168.64.20: icmp: echo request (frag 53113:1480@0+) (ttl 255) 19:38:45.075896 192.168.64.60 > 192.168.64.20: (frag 53113:1480@1480+) (ttl 255) 19:38:45.075911 192.168.64.60 > 192.168.64.20: (frag 53113:1480@2960+) (ttl 255) 19:38:45.075917 192.168.64.60 > 192.168.64.20: (frag 53113:568@4440) (ttl 255) Index: ip_fw.c =================================================================== RCS file: /home/ncvs/src/sys/netinet/ip_fw.c,v retrieving revision 1.164 diff -u -r1.164 ip_fw.c --- ip_fw.c 2001/04/06 06:52:25 1.164 +++ ip_fw.c 2001/07/02 02:23:12 @@ -206,7 +206,8 @@ static int tcpflg_match __P((struct tcphdr *tcp, struct ip_fw *f)); static int icmptype_match __P((struct icmp * icmp, struct ip_fw * f)); static void ipfw_report __P((struct ip_fw *f, struct ip *ip, int offset, - struct ifnet *rif, struct ifnet *oif)); + int ip_len, struct ifnet *rif, + struct ifnet *oif)); static void flush_rule_ptrs(void); @@ -492,7 +493,7 @@ } static void -ipfw_report(struct ip_fw *f, struct ip *ip, int offset, +ipfw_report(struct ip_fw *f, struct ip *ip, int offset, int ip_len, struct ifnet *rif, struct ifnet *oif) { struct tcphdr *const tcp = (struct tcphdr *) ((u_int32_t *) ip+ ip->ip_hl); @@ -500,7 +501,7 @@ struct icmp *const icmp = (struct icmp *) ((u_int32_t *) ip + ip->ip_hl); u_int64_t count; char *action; - char action2[32], proto[47], name[18], fragment[17]; + char action2[32], proto[47], name[18], fragment[27]; int len; count = f ? f->fw_pcnt : ++counter; @@ -619,9 +620,11 @@ break; } - if (offset != 0) - snprintf(SNPARGS(fragment, 0), " Fragment = %d", - offset); + if (ip->ip_off & (IP_MF|IP_OFFMASK)) + snprintf(SNPARGS(fragment, 0), " (frag %d:%d@%d%s)", + ntohs(ip->ip_id), ip_len - (ip->ip_hl << 2), + offset << 3, + (ip->ip_off&IP_MF) ? "+" : ""); else fragment[0] = '\0'; if (oif) @@ -1326,7 +1329,7 @@ bogusfrag: if (fw_verbose && ip != NULL) - ipfw_report(NULL, ip, offset, rif, oif); + ipfw_report(NULL, ip, offset, ip_len, rif, oif); goto dropit; } @@ -1349,7 +1352,7 @@ /* Log to console if desired */ if ((f->fw_flg & IP_FW_F_PRN) && fw_verbose) - ipfw_report(f, ip, offset, rif, oif); + ipfw_report(f, ip, offset, ip_len, rif, oif); /* Take appropriate action */ switch (f->fw_flg & IP_FW_F_COMMAND) { -- Crist J. Clark cjclark@alum.mit.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sun Jul 1 22: 7: 6 2001 Delivered-To: freebsd-audit@freebsd.org Received: from cage.simianscience.com (cage.simianscience.com [64.7.134.1]) by hub.freebsd.org (Postfix) with ESMTP id 3C6F037B401; Sun, 1 Jul 2001 22:07:03 -0700 (PDT) (envelope-from mike@sentex.net) Received: (from root@localhost) by cage.simianscience.com (8.11.4/8.11.2) id f62572I47204; Mon, 2 Jul 2001 01:07:02 -0400 (EDT) (envelope-from mike@sentex.net) Received: from chimp (fcage [192.168.0.2]) by cage.simianscience.com (8.11.4/8.11.2av) with ESMTP id f6256tA47192; Mon, 2 Jul 2001 01:06:55 -0400 (EDT) (envelope-from mike@sentex.net) Message-Id: <4.2.2.20010702010415.02f78ff8@192.168.0.12> X-Sender: mdtancsa@192.168.0.12 X-Mailer: QUALCOMM Windows Eudora Pro Version 4.2.2 Date: Mon, 02 Jul 2001 01:06:54 -0400 To: Kris Kennaway , audit@freebsd.org From: Mike Tancsa Subject: Re: Committing patches submitted here Cc: markm@freebsd.org In-Reply-To: <20010701164023.A25820@xor.obsecurity.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Virus-Scanned: by AMaViS perl-10 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Any chance on the patches for the broken PAM expire check ? PR 28311. ---Mike At 04:40 PM 7/1/2001 -0700, Kris Kennaway wrote: >Hi all, > >It would be useful when someone commits a patch here to follow up the >original message with a note stating as such, otherwise it's hard to >tell whether the patch is outstanding. Most of the recent patches by >Mike Barcroft seem to be in this category. Are there any outstanding? > >Kris > -------------------------------------------------------------------- Mike Tancsa, tel +1 519 651 3400 Network Administration, mike@sentex.net Sentex Communications www.sentex.net Cambridge, Ontario Canada www.sentex.net/mike To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon Jul 2 0:52:23 2001 Delivered-To: freebsd-audit@freebsd.org Received: from arb.arb.za.net (arb.arb.za.net [196.7.148.4]) by hub.freebsd.org (Postfix) with ESMTP id 9766237B403; Mon, 2 Jul 2001 00:52:17 -0700 (PDT) (envelope-from mark@grondar.za) Received: from grondar.za (root@graft.grondar.za [196.7.18.141]) by arb.arb.za.net (8.11.4/8.11.4) with ESMTP id f627pqW42276; Mon, 2 Jul 2001 09:51:54 +0200 (SAST) (envelope-from mark@grondar.za) Message-Id: <200107020751.f627pqW42276@arb.arb.za.net> To: Mike Tancsa Cc: Kris Kennaway , audit@freebsd.org, markm@freebsd.org Subject: Re: Committing patches submitted here References: <4.2.2.20010702010415.02f78ff8@192.168.0.12> In-Reply-To: <4.2.2.20010702010415.02f78ff8@192.168.0.12> ; from Mike Tancsa "Mon, 02 Jul 2001 01:06:54 -0400." Date: Mon, 02 Jul 2001 09:54:47 +0200 From: Mark Murray Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > Any chance on the patches for the broken PAM expire check ? PR 28311. OK - I have these. M > ---Mike > > > > At 04:40 PM 7/1/2001 -0700, Kris Kennaway wrote: > >Hi all, > > > >It would be useful when someone commits a patch here to follow up the > >original message with a note stating as such, otherwise it's hard to > >tell whether the patch is outstanding. Most of the recent patches by > >Mike Barcroft seem to be in this category. Are there any outstanding? > > > >Kris > > > > -------------------------------------------------------------------- > Mike Tancsa, tel +1 519 651 3400 > Network Administration, mike@sentex.net > Sentex Communications www.sentex.net > Cambridge, Ontario Canada www.sentex.net/mike > -- Mark Murray Warning: this .sig is umop ap!sdn To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon Jul 2 7:59:31 2001 Delivered-To: freebsd-audit@freebsd.org Received: from peorth.iteration.net (peorth.iteration.net [208.190.180.178]) by hub.freebsd.org (Postfix) with ESMTP id 01CE337B405; Mon, 2 Jul 2001 07:59:17 -0700 (PDT) (envelope-from keichii@iteration.net) Received: by peorth.iteration.net (Postfix, from userid 1001) id 469BD59229; Mon, 2 Jul 2001 09:59:15 -0500 (CDT) Date: Mon, 2 Jul 2001 09:59:15 -0500 From: "Michael C . Wu" To: Mitsuru IWASAKI Cc: dfr@nlsystems.com, arch@freebsd.org, audit@freebsd.org, athlete@kta.att.ne.jp Subject: Re: CFR: Crusoe LongRun Support Message-ID: <20010702095913.A98201@peorth.iteration.net> Reply-To: "Michael C . Wu" References: <20010630041951I.iwasaki@jp.FreeBSD.org> <20010701031447S.iwasaki@jp.FreeBSD.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="OXfL5xGRrasGEqWY" Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010701031447S.iwasaki@jp.FreeBSD.org>; from iwasaki@jp.FreeBSD.org on Sun, Jul 01, 2001 at 03:14:47AM +0900 X-PGP-Fingerprint: 5025 F691 F943 8128 48A8 5025 77CE 29C5 8FA1 2E20 X-PGP-Key-ID: 0x8FA12E20 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --OXfL5xGRrasGEqWY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, Jul 01, 2001 at 03:14:47AM +0900, Mitsuru IWASAKI scribbled: | > I would like to see something like longrun(4) which described the sysctls | > and indicated what each longrun level actually means. | | OK, understood. I've written longrun(4) manpage. As always my English | is poor, any feedback is welcome :-) Here is your original file and the diff I made. Hope you will like this better. :) Just a friendly reminder, do you mind using attachments next time? It is quite a hassle to save the email and then edit it. -- +-----------------------------------------------------------+ | keichii@iteration.net | keichii@freebsd.org | | http://iteration.net/~keichii | Yes, BSD is a conspiracy. | +-----------------------------------------------------------+ --OXfL5xGRrasGEqWY Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="longrun.4" .\" Copyright (c) 2001 Tamotsu HATTORI .\" Copyright (c) 2001 Mitsuru IWASAKI .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" $FreeBSD$ .Dd Jun 30, 2001 .Dt LONGRUN 4 i386 .Os .Sh NAME .Nm longrun .Nd Transmeta(TM) Crusoe(TM) LongRun(TM) support .Sh SYNOPSIS The following .Xr sysctl 8 MIBs are available: .Bl -tag -width "hw.crusoe.percentage integer no " -compact .It Sy "Name Type Changeable Description .It "hw.crusoe.longrun integer yes LongRun mode. .Bl -tag -width "0: minimum frequency mode" -compact .It "0: minimum frequency mode .It "1: power-saving mode .It "2: performance mode .It "3: maximum frequency mode .El .It "hw.crusoe.frequency integer no Current frequency (MHz). .It "hw.crusoe.voltage integer no Current voltage (mV). .It "hw.crusoe.percentage integer no Processing performance (%). .El .Pp .Sh EXAMPLES To get current status: .Bd -literal -offset indent % sysctl hw.crusoe .Ed .Pp To set LongRun mode to performance oriented variable frequency mode: .Bd -literal -offset indent # sysctl -w hw.crusoe.longrun=2 .Ed .Pp .Sh AUTHORS .An -nosplit LongRun support and this manual page were written by .An Tamotsu HATTORI Aq athlete@kta.att.ne.jp and .An Mitsuru IWASAKI Aq iwasaki@FreeBSD.org . .Sh HISTORY Transmeta(TM) Crusoe(TM) LongRun(TM) support first appeared in .Fx 5.0 . To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message --OXfL5xGRrasGEqWY Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="longrun.4.diff" --- longrun.4 Mon Jul 2 09:50:37 2001 +++ longrun.4.new Mon Jul 2 09:56:10 2001 @@ -31,9 +31,11 @@ .Nm longrun .Nd Transmeta(TM) Crusoe(TM) LongRun(TM) support .Sh SYNOPSIS +The LongRun(TM) support is a collection of power saving mode +for the Transmeta(TM) Crusoe(TM), similiar to Intel(TM)'s SpeedStep(TM). The following .Xr sysctl 8 -MIBs are available: +MIBs set the different modes that the CPU runs in: .Bl -tag -width "hw.crusoe.percentage integer no " -compact .It Sy "Name Type Changeable Description .It "hw.crusoe.longrun integer yes LongRun mode. @@ -49,12 +51,12 @@ .El .Pp .Sh EXAMPLES -To get current status: +Print the current status: .Bd -literal -offset indent % sysctl hw.crusoe .Ed .Pp -To set LongRun mode to performance oriented variable frequency mode: +To set the LongRun mode to performance oriented variable frequency mode (no power saving): .Bd -literal -offset indent # sysctl -w hw.crusoe.longrun=2 .Ed @@ -66,9 +68,6 @@ and .An Mitsuru IWASAKI Aq iwasaki@FreeBSD.org . .Sh HISTORY -Transmeta(TM) Crusoe(TM) LongRun(TM) support first appeared in +The Transmeta(TM) Crusoe(TM) LongRun(TM) support first appeared in .Fx 5.0 . - -To Unsubscribe: send mail to majordomo@FreeBSD.org -with "unsubscribe freebsd-arch" in the body of the message --OXfL5xGRrasGEqWY-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon Jul 2 11: 6:30 2001 Delivered-To: freebsd-audit@freebsd.org Received: from kta.att.ne.jp (kta.att.ne.jp [165.76.242.5]) by hub.freebsd.org (Postfix) with SMTP id C59C937B409 for ; Mon, 2 Jul 2001 11:06:25 -0700 (PDT) (envelope-from athlete@kta.att.ne.jp) Received: (qmail 22404 invoked from network); 2 Jul 2001 18:06:17 -0000 Received: from unknown (HELO krishna.kta.att.ne.jp) (165.76.242.122) by kta.att.ne.jp with SMTP; 2 Jul 2001 18:06:17 -0000 X-My-Real-Login-Name: athlete; kta.att.ne.jp MIME-Version: 1.0 X-Mailer: Denshin 8 Go V32.1.3.0 025 Date: Tue, 03 Jul 2001 03:06:09 +0900 From: Tamotsu HATTORI To: "Michael C . Wu" Cc: dfr@nlsystems.com, arch@freebsd.org, audit@freebsd.org, iwasaki@jp.freebsd.org In-Reply-To: Your message of "Mon, 2 Jul 2001 09:59:15 -0500" <20010702095913.A98201@peorth.iteration.net> References: <20010702095913.A98201@peorth.iteration.net> Subject: Re: CFR: Crusoe LongRun Support Message-Id: <20010702180625.C59C937B409@hub.freebsd.org> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi. Mon, 2 Jul 2001 09:59:15 -0500 "Michael C . Wu" wrote: Michael> On Sun, Jul 01, 2001 at 03:14:47AM +0900, Mitsuru IWASAKI scribbled: Michael> | > I would like to see something like longrun(4) which described the sysctls Michael> | > and indicated what each longrun level actually means. Michael> | Michael> | OK, understood. I've written longrun(4) manpage. As always my English Michael> | is poor, any feedback is welcome :-) Michael> Michael> Here is your original file and the diff I made. Hope you will like Michael> this better. :) Michael> I think we had better remove the expression of "no power saving" from the following line: To set the LongRun mode to performance oriented variable frequency mode (no power saving). Because processor will spend many time with lower frequency when it works in variable frequency mode, power dissipation will be reduced. How do you think? --------------------------------------------------------- Tamotsu Hattori URL: http://home.att.ne.jp/delta/athlete/index.html e-mail: athlete@kta.att.ne.jp --------------------------------------------------------- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon Jul 2 16:20:49 2001 Delivered-To: freebsd-audit@freebsd.org Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66]) by hub.freebsd.org (Postfix) with ESMTP id 4D36737B401; Mon, 2 Jul 2001 16:20:43 -0700 (PDT) (envelope-from imp@harmony.village.org) Received: from harmony.village.org (localhost.village.org [127.0.0.1]) by harmony.village.org (8.11.3/8.11.4) with ESMTP id f62NJhK38382; Mon, 2 Jul 2001 17:19:43 -0600 (MDT) (envelope-from imp@harmony.village.org) Message-Id: <200107022319.f62NJhK38382@harmony.village.org> To: "Michael C . Wu" Subject: Re: CFR: Crusoe LongRun Support Cc: Mitsuru IWASAKI , dfr@nlsystems.com, arch@FreeBSD.ORG, audit@FreeBSD.ORG, athlete@kta.att.ne.jp In-reply-to: Your message of "Mon, 02 Jul 2001 09:59:15 CDT." <20010702095913.A98201@peorth.iteration.net> References: <20010702095913.A98201@peorth.iteration.net> <20010630041951I.iwasaki@jp.FreeBSD.org> <20010701031447S.iwasaki@jp.FreeBSD.org> Date: Mon, 02 Jul 2001 17:19:43 -0600 From: Warner Losh Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In message <20010702095913.A98201@peorth.iteration.net> "Michael C . Wu" writes: : .Sh SYNOPSIS : +The LongRun(TM) support is a collection of power saving mode : +for the Transmeta(TM) Crusoe(TM), similiar to Intel(TM)'s SpeedStep(TM). I'd say this as LongRun support is a collection of power saving modes for the Transmeta Crusoe chips, similar in scope to Intel's SpeedStep. : The following : .Xr sysctl 8 : -MIBs are available: : +MIBs set the different modes that the CPU runs in: MIBs control the different CPU modes: : -To set LongRun mode to performance oriented variable frequency mode: : +To set the LongRun mode to performance oriented variable frequency mode (no power saving): To set LongRun mode to performance oriented variable frequency mode (less power savings): Warner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon Jul 2 16:24:33 2001 Delivered-To: freebsd-audit@freebsd.org Received: from mass.dis.org (dhcp44-21.dis.org [216.240.44.21]) by hub.freebsd.org (Postfix) with ESMTP id 0110A37B403; Mon, 2 Jul 2001 16:24:27 -0700 (PDT) (envelope-from msmith@mass.dis.org) Received: from mass.dis.org (localhost [127.0.0.1]) by mass.dis.org (8.11.4/8.11.3) with ESMTP id f62NZCU02939; Mon, 2 Jul 2001 16:35:13 -0700 (PDT) (envelope-from msmith@mass.dis.org) Message-Id: <200107022335.f62NZCU02939@mass.dis.org> X-Mailer: exmh version 2.1.1 10/15/1999 To: Warner Losh Cc: "Michael C . Wu" , Mitsuru IWASAKI , dfr@nlsystems.com, arch@FreeBSD.ORG, audit@FreeBSD.ORG, athlete@kta.att.ne.jp Subject: Re: CFR: Crusoe LongRun Support In-reply-to: Your message of "Mon, 02 Jul 2001 17:19:43 MDT." <200107022319.f62NJhK38382@harmony.village.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 02 Jul 2001 16:35:12 -0700 From: Mike Smith Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I would *very* much like to see an ACPI dump from one of these systems. > In message <20010702095913.A98201@peorth.iteration.net> "Michael C . Wu" writ > es: > : .Sh SYNOPSIS > : +The LongRun(TM) support is a collection of power saving mode > : +for the Transmeta(TM) Crusoe(TM), similiar to Intel(TM)'s SpeedStep(TM). > > I'd say this as > > LongRun support is a collection of power saving modes for the > Transmeta Crusoe chips, similar in scope to Intel's SpeedStep. > > : The following > : .Xr sysctl 8 > : -MIBs are available: > : +MIBs set the different modes that the CPU runs in: > > MIBs control the different CPU modes: > > : -To set LongRun mode to performance oriented variable frequency mode: > : +To set the LongRun mode to performance oriented variable frequency mode (n > o power saving): > > To set LongRun mode to performance oriented variable frequency mode > (less power savings): > > Warner > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-arch" in the body of the message -- ... every activity meets with opposition, everyone who acts has his rivals and unfortunately opponents also. But not because people want to be opponents, rather because the tasks and relationships force people to take different points of view. [Dr. Fritz Todt] V I C T O R Y N O T V E N G E A N C E To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon Jul 2 19: 3:59 2001 Delivered-To: freebsd-audit@freebsd.org Received: from coffee.q9media.com (coffee.q9media.com [216.94.229.19]) by hub.freebsd.org (Postfix) with ESMTP id 59EAC37B403 for ; Mon, 2 Jul 2001 19:03:18 -0700 (PDT) (envelope-from mike@coffee.q9media.com) Received: (from mike@localhost) by coffee.q9media.com (8.11.2/8.11.2) id f632HOT06228; Mon, 2 Jul 2001 22:17:24 -0400 (EDT) (envelope-from mike) Date: Mon, 2 Jul 2001 22:17:24 -0400 (EDT) Message-Id: <200107030217.f632HOT06228@coffee.q9media.com> To: Bruce Evans From: Mike Barcroft Cc: audit@FreeBSD.org Subject: Re: src/bin/ed patch Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Bruce Evans writes: > > Why not just add a switch in /etc/{defaults/,}make.conf to allow one > > to control the visibility of RCSIDs? What concern is it of ours if the > > other BSDs embed RCSIDs unconditionally? > > It would be silly to have a switch to fully control FreeBSD rcsids if > OtherBSD rcsids get embedded (in object files) unconditionally. Maybe it's not a simple as I think it is. Would we not just wrap the __RCSID macros in with #ifndef NO_RCSIDS ? Are there other requirements I'm not aware of? If this is all that's required we should be able to patch our tree and send diffs off to OtherBSD. > Why change the original copyright string (source and oupput format)? > The copyright normally goes in a separate "#ifdef lint". Fixed. Fixed. > > ... > > @@ -1385,12 +1377,13 @@ > > { > > char *hup = NULL; /* hup filename */ > > char *s; > > + char ed_hup[] = "ed.hup"; > > int n; > > > > if (!sigactive) > > quit(1); > > sigflags &= ~(1 << (signo - 1)); > > - if (addr_last && write_file("ed.hup", "w", 1, addr_last) < 0 && > > + if (addr_last && write_file(ed_hup, "w", 1, addr_last) < 0 && > > (s = getenv("HOME")) != NULL && > > (n = strlen(s)) + 8 <= PATH_MAX && /* "ed.hup" + '/' */ > > (hup = (char *) malloc(n + 10)) != NULL) { > > The correct fix is to declare write_file()'s first arg as const. The write_file() routine calls strip_escapes(), which needs to modify the filename before fopen()ing it. I'm not sure how it worked originally as a const. Probably because it doesn't have any escapes that it needs to strip. > BTW, I think we're only seeing the tip of the iceberg for constant > poisoning of function args. -Wwrite-strings triggers a few warnings > for "char *" args, but there are zillions of interfaces that take > pointers to data that is not changed by the interface yet not declared > const. Change a top-level interface to declare things as const and > the poison will spread to lower levels. I did a little investigation and the code is a nightmare. It makes all kinds of assumptions that don't work in a const-capable world. I added a few more consts where it was possible without re-writing all the callers. While I was there, I corrected some other small things that were bugging my eyes (specificly: sprintf and register). An updated version of my patch is available at the end of this message and also at: http://testbed.q9media.net/freebsd/ed.20010702.patch Best regards, Mike Barcroft ----------------------------------------------------------------------- ed.20010702.patch o Correctly define rcsid [requested by bde]. o Add consts where appropriate. o Rename some variables that are shadowing global declarations. o Remove register storage-classes. o sprintf -> snprintf o Set WARNS?=2 Index: ed/Makefile =================================================================== RCS file: /home/ncvs/src/bin/ed/Makefile,v retrieving revision 1.18 diff -u -r1.18 Makefile --- ed/Makefile 2000/02/29 11:39:24 1.18 +++ ed/Makefile 2001/07/03 01:32:26 @@ -1,6 +1,7 @@ # $FreeBSD: src/bin/ed/Makefile,v 1.18 2000/02/29 11:39:24 markm Exp $ PROG= ed +WARNS?= 2 SRCS= buf.c cbc.c glbl.c io.c main.c re.c sub.c undo.c LINKS= ${BINDIR}/ed ${BINDIR}/red MLINKS= ed.1 red.1 Index: ed/buf.c =================================================================== RCS file: /home/ncvs/src/bin/ed/buf.c,v retrieving revision 1.17 diff -u -r1.17 buf.c --- ed/buf.c 1999/08/27 23:14:12 1.17 +++ ed/buf.c 2001/07/03 01:32:26 @@ -27,12 +27,8 @@ */ #ifndef lint -#if 0 -static char * const rcsid = "@(#)buf.c,v 1.4 1994/02/01 00:34:35 alm Exp"; -#else -static char * const rcsid = +static const char rcsid[] = "$FreeBSD: src/bin/ed/buf.c,v 1.17 1999/08/27 23:14:12 peter Exp $"; -#endif #endif /* not lint */ #include @@ -65,7 +61,8 @@ sfseek = lp->seek; if (fseek(sfp, sfseek, SEEK_SET) < 0) { fprintf(stderr, "%s\n", strerror(errno)); - sprintf(errmsg, "cannot seek temp file"); + snprintf(errmsg, sizeof(errmsg), + "cannot seek temp file"); return NULL; } } @@ -73,7 +70,7 @@ REALLOC(sfbuf, sfbufsz, len + 1, NULL); if ((ct = fread(sfbuf, sizeof(char), len, sfp)) < 0 || ct != len) { fprintf(stderr, "%s\n", strerror(errno)); - sprintf(errmsg, "cannot read temp file"); + snprintf(errmsg, sizeof(errmsg), "cannot read temp file"); return NULL; } sfseek += len; /* update file position */ @@ -84,24 +81,24 @@ /* put_sbuf_line: write a line of text to the scratch file and add a line node to the editor buffer; return a pointer to the end of the text */ -char * +const char * put_sbuf_line(cs) - char *cs; + const char *cs; { line_t *lp; int len, ct; - char *s; + const char *s; if ((lp = (line_t *) malloc(sizeof(line_t))) == NULL) { fprintf(stderr, "%s\n", strerror(errno)); - sprintf(errmsg, "out of memory"); + snprintf(errmsg, sizeof(errmsg), "out of memory"); return NULL; } /* assert: cs is '\n' terminated */ for (s = cs; *s != '\n'; s++) ; if (s - cs >= LINECHARS) { - sprintf(errmsg, "line too long"); + snprintf(errmsg, sizeof(errmsg), "line too long"); return NULL; } len = s - cs; @@ -109,7 +106,8 @@ if (seek_write) { if (fseek(sfp, 0L, SEEK_END) < 0) { fprintf(stderr, "%s\n", strerror(errno)); - sprintf(errmsg, "cannot seek temp file"); + snprintf(errmsg, sizeof(errmsg), + "cannot seek temp file"); return NULL; } sfseek = ftell(sfp); @@ -119,7 +117,7 @@ if ((ct = fwrite(cs, sizeof(char), len, sfp)) < 0 || ct != len) { sfseek = -1; fprintf(stderr, "%s\n", strerror(errno)); - sprintf(errmsg, "cannot write temp file"); + snprintf(errmsg, sizeof(errmsg), "cannot write temp file"); return NULL; } lp->len = len; @@ -155,7 +153,7 @@ while (cp != lp && (cp = cp->q_forw) != &buffer_head) n++; if (n && cp == &buffer_head) { - sprintf(errmsg, "invalid address"); + snprintf(errmsg, sizeof(errmsg), "invalid address"); return ERR; } return n; @@ -229,7 +227,8 @@ if (sfp) { if (fclose(sfp) < 0) { fprintf(stderr, "%s: %s\n", sfn, strerror(errno)); - sprintf(errmsg, "cannot close temp file"); + snprintf(errmsg, sizeof(errmsg), + "cannot close temp file"); return ERR; } sfp = NULL; Index: ed/cbc.c =================================================================== RCS file: /home/ncvs/src/bin/ed/cbc.c,v retrieving revision 1.13 diff -u -r1.13 cbc.c --- ed/cbc.c 2001/03/05 02:15:37 1.13 +++ ed/cbc.c 2001/07/03 01:32:26 @@ -33,17 +33,11 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * from: @(#)bdes.c 5.5 (Berkeley) 6/27/91 */ #ifndef lint -#if 0 -static char * const rcsid = "@(#)cbc.c,v 1.2 1994/02/01 00:34:36 alm Exp"; -#else -static char * const rcsid = +static const char rcsid[] = "$FreeBSD: src/bin/ed/cbc.c,v 1.13 2001/03/05 02:15:37 kris Exp $"; -#endif #endif /* not lint */ #include @@ -183,7 +177,7 @@ int get_keyword() { - register char *p; /* used to obtain the key */ + char *p; /* used to obtain the key */ Desbuf msgbuf; /* I/O buffer */ /* @@ -209,9 +203,9 @@ */ void des_error(s) - char *s; /* the message */ + const char *s; /* the message */ { - (void)sprintf(errmsg, "%s", s ? s : strerror(errno)); + (void)snprintf(errmsg, sizeof(errmsg), "%s", s ? s : strerror(errno)); } /* @@ -250,23 +244,23 @@ * convert the key to a bit pattern */ void -expand_des_key(obuf, ibuf) +expand_des_key(obuf, kbuf) char *obuf; /* bit pattern */ - char *ibuf; /* the key itself */ + char *kbuf; /* the key itself */ { - register int i, j; /* counter in a for loop */ + int i, j; /* counter in a for loop */ int nbuf[64]; /* used for hex/key translation */ /* * leading '0x' or '0X' == hex key */ - if (ibuf[0] == '0' && (ibuf[1] == 'x' || ibuf[1] == 'X')) { - ibuf = &ibuf[2]; + if (kbuf[0] == '0' && (kbuf[1] == 'x' || kbuf[1] == 'X')) { + kbuf = &kbuf[2]; /* * now translate it, bombing on any illegal hex digit */ - for (i = 0; ibuf[i] && i < 16; i++) - if ((nbuf[i] = hex_to_binary((int) ibuf[i], 16)) == -1) + for (i = 0; kbuf[i] && i < 16; i++) + if ((nbuf[i] = hex_to_binary((int) kbuf[i], 16)) == -1) des_error("bad hex digit in key"); while (i < 16) nbuf[i++] = 0; @@ -280,13 +274,13 @@ /* * leading '0b' or '0B' == binary key */ - if (ibuf[0] == '0' && (ibuf[1] == 'b' || ibuf[1] == 'B')) { - ibuf = &ibuf[2]; + if (kbuf[0] == '0' && (kbuf[1] == 'b' || kbuf[1] == 'B')) { + kbuf = &kbuf[2]; /* * now translate it, bombing on any illegal binary digit */ - for (i = 0; ibuf[i] && i < 16; i++) - if ((nbuf[i] = hex_to_binary((int) ibuf[i], 2)) == -1) + for (i = 0; kbuf[i] && i < 16; i++) + if ((nbuf[i] = hex_to_binary((int) kbuf[i], 2)) == -1) des_error("bad binary digit in key"); while (i < 64) nbuf[i++] = 0; @@ -300,7 +294,7 @@ /* * no special leader -- ASCII */ - (void)strncpy(obuf, ibuf, 8); + (void)strncpy(obuf, kbuf, 8); } /***************** @@ -321,8 +315,8 @@ set_des_key(buf) Desbuf buf; /* key block */ { - register int i, j; /* counter in a for loop */ - register int par; /* parity counter */ + int i, j; /* counter in a for loop */ + int par; /* parity counter */ /* * if the parity is not preserved, flip it @@ -391,20 +385,20 @@ char *msgbuf; /* I/O buffer */ FILE *fp; /* input file descriptor */ { - Desbuf ibuf; /* temp buffer for initialization vector */ - register int n; /* number of bytes actually read */ - register int c; /* used to test for EOF */ + Desbuf tbuf; /* temp buffer for initialization vector */ + int n; /* number of bytes actually read */ + int c; /* used to test for EOF */ int inverse = 1; /* 0 to encrypt, 1 to decrypt */ if ((n = READ(BUFFER(msgbuf), 8, fp)) == 8) { /* * do the transformation */ - MEMCPY(BUFFER(ibuf), BUFFER(msgbuf), 8); + MEMCPY(BUFFER(tbuf), BUFFER(msgbuf), 8); DES_XFORM(UBUFFER(msgbuf)); for (c = 0; c < 8; c++) UCHAR(msgbuf, c) ^= UCHAR(ivec, c); - MEMCPY(BUFFER(ivec), BUFFER(ibuf), 8); + MEMCPY(BUFFER(ivec), BUFFER(tbuf), 8); /* * if the last one, handle it specially */ Index: ed/ed.h =================================================================== RCS file: /home/ncvs/src/bin/ed/ed.h,v retrieving revision 1.14 diff -u -r1.14 ed.h --- ed/ed.h 2001/05/29 18:03:13 1.14 +++ ed/ed.h 2001/07/03 01:32:27 @@ -105,7 +105,7 @@ #define STRTOL(i, p) { \ if (((i = strtol(p, &p, 10)) == LONG_MIN || i == LONG_MAX) && \ errno == ERANGE) { \ - sprintf(errmsg, "number out of range"); \ + snprintf(errmsg, sizeof(errmsg), "number out of range"); \ i = 0; \ return ERR; \ } \ @@ -121,14 +121,14 @@ if ((b) != NULL) { \ if ((ts = (char *) realloc((b), ti += max((i), MINBUFSZ))) == NULL) { \ fprintf(stderr, "%s\n", strerror(errno)); \ - sprintf(errmsg, "out of memory"); \ + snprintf(errmsg, sizeof(errmsg), "out of memory"); \ SPL0(); \ return err; \ } \ } else { \ if ((ts = (char *) malloc(ti += max((i), MINBUFSZ))) == NULL) { \ fprintf(stderr, "%s\n", strerror(errno)); \ - sprintf(errmsg, "out of memory"); \ + snprintf(errmsg, sizeof(errmsg), "out of memory"); \ SPL0(); \ return err; \ } \ @@ -146,7 +146,7 @@ SPL1(); \ if ((ts = (char *) realloc((b), ti += max((i), MINBUFSZ))) == NULL) { \ fprintf(stderr, "%s\n", strerror(errno)); \ - sprintf(errmsg, "out of memory"); \ + snprintf(errmsg, sizeof(errmsg), "out of memory"); \ SPL0(); \ return err; \ } \ @@ -190,7 +190,7 @@ /* Local Function Declarations */ void add_line_node __P((line_t *)); int append_lines __P((long)); -int apply_subst_template __P((char *, regmatch_t *, int, int)); +int apply_subst_template __P((const char *, regmatch_t *, int, int)); int build_active_list __P((int)); int cbc_decode __P((char *, FILE *)); int cbc_encode __P((char *, int, FILE *)); @@ -200,7 +200,7 @@ int close_sbuf __P((void)); int copy_lines __P((long)); int delete_lines __P((long, long)); -void des_error __P((char *)); +void des_error __P((const char *)); int display_lines __P((long, long, int)); line_t *dup_line_node __P((line_t *)); int exec_command __P((void)); @@ -236,16 +236,16 @@ int join_lines __P((long, long)); int mark_line_node __P((line_t *, int)); int move_lines __P((long)); -line_t *next_active_node __P(()); +line_t *next_active_node __P((void)); long next_addr __P((void)); int open_sbuf __P((void)); char *parse_char_class __P((char *)); int pop_undo_stack __P((void)); undo_t *push_undo_stack __P((int, long, long)); int put_des_char __P((int, FILE *)); -char *put_sbuf_line __P((char *)); -int put_stream_line __P((FILE *, char *, int)); -int put_tty_line __P((char *, int, long, int)); +const char *put_sbuf_line __P((const char *)); +int put_stream_line __P((FILE *, const char *, int)); +int put_tty_line __P((const char *, int, long, int)); void quit __P((int)); long read_file __P((char *, long)); long read_stream __P((FILE *, long)); @@ -259,7 +259,7 @@ char *translit_text __P((char *, int, int, int)); void unmark_line_node __P((line_t *)); void unset_active_nodes __P((line_t *, line_t *)); -long write_file __P((char *, char *, long, long)); +long write_file __P((char *, const char *, long, long)); long write_stream __P((FILE *, long, long)); /* global buffers */ @@ -278,7 +278,7 @@ /* global vars */ extern long addr_last; extern long current_addr; -extern char errmsg[]; +extern char errmsg[PATH_MAX + 40]; extern long first_addr; extern int lineno; extern long second_addr; Index: ed/glbl.c =================================================================== RCS file: /home/ncvs/src/bin/ed/glbl.c,v retrieving revision 1.10 diff -u -r1.10 glbl.c --- ed/glbl.c 2000/10/16 07:06:35 1.10 +++ ed/glbl.c 2001/07/03 01:32:27 @@ -27,12 +27,8 @@ */ #ifndef lint -#if 0 -static char * const rcsid = "@(#)glob.c,v 1.1 1994/02/01 00:34:40 alm Exp"; -#else -static char * const rcsid = +static const char rcsid[] = "$FreeBSD: src/bin/ed/glbl.c,v 1.10 2000/10/16 07:06:35 brian Exp $"; -#endif #endif /* not lint */ #include @@ -55,7 +51,7 @@ char delimiter; if ((delimiter = *ibufp) == ' ' || delimiter == '\n') { - sprintf(errmsg, "invalid pattern delimiter"); + snprintf(errmsg, sizeof(errmsg), "invalid pattern delimiter"); return ERR; } else if ((pat = get_compiled_pattern()) == NULL) return ERR; @@ -115,13 +111,15 @@ if (n < 0) return ERR; else if (n == 0) { - sprintf(errmsg, "unexpected end-of-file"); + snprintf(errmsg, sizeof(errmsg), + "unexpected end-of-file"); return ERR; } else if (n == 1 && !strcmp(ibuf, "\n")) continue; else if (n == 2 && !strcmp(ibuf, "&\n")) { if (cmd == NULL) { - sprintf(errmsg, "no previous command"); + snprintf(errmsg, sizeof(errmsg), + "no previous command"); return ERR; } else cmd = ocmd; } else if ((cmd = get_extended_line(&n, 0)) == NULL) @@ -166,7 +164,8 @@ if ((ts = (line_t **) realloc(active_list, (ti += MINBUFSZ) * sizeof(line_t **))) == NULL) { fprintf(stderr, "%s\n", strerror(errno)); - sprintf(errmsg, "out of memory"); + snprintf(errmsg, sizeof(errmsg), + "out of memory"); SPL0(); return ERR; } @@ -175,7 +174,8 @@ if ((ts = (line_t **) malloc((ti += MINBUFSZ) * sizeof(line_t **))) == NULL) { fprintf(stderr, "%s\n", strerror(errno)); - sprintf(errmsg, "out of memory"); + snprintf(errmsg, sizeof(errmsg), + "out of memory"); SPL0(); return ERR; } Index: ed/io.c =================================================================== RCS file: /home/ncvs/src/bin/ed/io.c,v retrieving revision 1.10 diff -u -r1.10 io.c --- ed/io.c 1999/08/27 23:14:14 1.10 +++ ed/io.c 2001/07/03 01:32:27 @@ -26,12 +26,8 @@ */ #ifndef lint -#if 0 -static char * const rcsid = "@(#)io.c,v 1.1 1994/02/01 00:34:41 alm Exp"; -#else -static char * const rcsid = +static const char rcsid[] = "$FreeBSD: src/bin/ed/io.c,v 1.10 1999/08/27 23:14:14 peter Exp $"; -#endif #endif /* not lint */ #include "ed.h" @@ -52,13 +48,13 @@ fp = (*fn == '!') ? popen(fn + 1, "r") : fopen(strip_escapes(fn), "r"); if (fp == NULL) { fprintf(stderr, "%s: %s\n", fn, strerror(errno)); - sprintf(errmsg, "cannot open input file"); + snprintf(errmsg, sizeof(errmsg), "cannot open input file"); return ERR; } else if ((size = read_stream(fp, n)) < 0) return ERR; else if (((*fn == '!') ? pclose(fp) : fclose(fp)) < 0) { fprintf(stderr, "%s: %s\n", fn, strerror(errno)); - sprintf(errmsg, "cannot close input file"); + snprintf(errmsg, sizeof(errmsg), "cannot close input file"); return ERR; } fprintf(stdout, !scripted ? "%lu\n" : "", size); @@ -128,8 +124,8 @@ get_stream_line(fp) FILE *fp; { - register int c; - register int i = 0; + int c; + int i = 0; while (((c = des ? get_des_char(fp) : getc(fp)) != EOF || (!feof(fp) && !ferror(fp))) && c != '\n') { @@ -142,7 +138,7 @@ sbuf[i++] = c; else if (ferror(fp)) { fprintf(stderr, "%s\n", strerror(errno)); - sprintf(errmsg, "cannot read input file"); + snprintf(errmsg, sizeof(errmsg), "cannot read input file"); return ERR; } else if (i) { sbuf[i++] = '\n'; @@ -157,7 +153,7 @@ long write_file(fn, mode, n, m) char *fn; - char *mode; + const char *mode; long n; long m; { @@ -167,13 +163,13 @@ fp = (*fn == '!') ? popen(fn+1, "w") : fopen(strip_escapes(fn), mode); if (fp == NULL) { fprintf(stderr, "%s: %s\n", fn, strerror(errno)); - sprintf(errmsg, "cannot open output file"); + snprintf(errmsg, sizeof(errmsg), "cannot open output file"); return ERR; } else if ((size = write_stream(fp, n, m)) < 0) return ERR; else if (((*fn == '!') ? pclose(fp) : fclose(fp)) < 0) { fprintf(stderr, "%s: %s\n", fn, strerror(errno)); - sprintf(errmsg, "cannot close output file"); + snprintf(errmsg, sizeof(errmsg), "cannot close output file"); return ERR; } fprintf(stdout, !scripted ? "%lu\n" : "", size); @@ -217,13 +213,13 @@ int put_stream_line(fp, s, len) FILE *fp; - char *s; + const char *s; int len; { while (len--) if ((des ? put_des_char(*s++, fp) : fputc(*s++, fp)) < 0) { fprintf(stderr, "%s\n", strerror(errno)); - sprintf(errmsg, "cannot write file"); + snprintf(errmsg, sizeof(errmsg), "cannot write file"); return ERR; } return 0; @@ -256,7 +252,8 @@ if ((n = get_tty_line()) < 0) return NULL; else if (n == 0 || ibuf[n - 1] != '\n') { - sprintf(errmsg, "unexpected end-of-file"); + snprintf(errmsg, sizeof(errmsg), + "unexpected end-of-file"); return NULL; } REALLOC(cvbuf, cvbufsz, l + n, NULL); @@ -278,8 +275,8 @@ int get_tty_line() { - register int oi = 0; - register int i = 0; + int oi = 0; + int i = 0; int c; for (;;) @@ -297,7 +294,8 @@ case EOF: if (ferror(stdin)) { fprintf(stderr, "stdin: %s\n", strerror(errno)); - sprintf(errmsg, "cannot read stdin"); + snprintf(errmsg, sizeof(errmsg), + "cannot read stdin"); clearerr(stdin); ibufp = NULL; return ERR; @@ -325,7 +323,7 @@ /* put_tty_line: print text to stdout */ int put_tty_line(s, l, n, gflag) - char *s; + const char *s; int l; long n; int gflag; Index: ed/main.c =================================================================== RCS file: /home/ncvs/src/bin/ed/main.c,v retrieving revision 1.20 diff -u -r1.20 main.c --- ed/main.c 2001/06/28 22:06:27 1.20 +++ ed/main.c 2001/07/03 01:32:27 @@ -27,18 +27,14 @@ */ #ifndef lint -static char * const copyright = +static const char copyright[] = "@(#) Copyright (c) 1993 Andrew Moore, Talke Studio. \n\ All rights reserved.\n"; #endif /* not lint */ #ifndef lint -#if 0 -static char * const rcsid = "@(#)main.c,v 1.1 1994/02/01 00:34:42 alm Exp"; -#else -static char * const rcsid = +static const char rcsid[] = "$FreeBSD: src/bin/ed/main.c,v 1.20 2001/06/28 22:06:27 dd Exp $"; -#endif #endif /* not lint */ /* @@ -100,8 +96,8 @@ long current_addr; /* current address in editor buffer */ long addr_last; /* last address in editor buffer */ int lineno; /* script line number */ -char *prompt; /* command-line prompt */ -char *dps = "*"; /* default command-line prompt */ +const char *prompt; /* command-line prompt */ +const char *dps = "*"; /* default command-line prompt */ const char usage[] = "usage: %s [-] [-sx] [-p string] [name]\n"; @@ -169,7 +165,7 @@ #endif { fputs("\n?\n", stderr); - sprintf(errmsg, "interrupt"); + snprintf(errmsg, sizeof(errmsg), "interrupt"); } else { init_buffers(); sigactive = 1; /* enable signal handlers */ @@ -183,7 +179,8 @@ } else if (argc) { fputs("?\n", stderr); if (**argv == '\0') - sprintf(errmsg, "invalid filename"); + snprintf(errmsg, sizeof(errmsg), + "invalid filename"); if (!isatty(0)) quit(2); } @@ -201,7 +198,8 @@ } else if (n == 0) { if (modified && !scripted) { fputs("?\n", stderr); - sprintf(errmsg, "warning: file modified"); + snprintf(errmsg, sizeof(errmsg), + "warning: file modified"); if (!isatty(0)) { fprintf(stderr, garrulous ? "script, line %d: %s\n" : @@ -216,7 +214,8 @@ quit(0); } else if (ibuf[n - 1] != '\n') { /* discard line */ - sprintf(errmsg, "unexpected end-of-file"); + snprintf(errmsg, sizeof(errmsg), + "unexpected end-of-file"); clearerr(stdin); status = ERR; continue; @@ -234,7 +233,8 @@ case EMOD: modified = 0; fputs("?\n", stderr); /* give warning */ - sprintf(errmsg, "warning: file modified"); + snprintf(errmsg, sizeof(errmsg), + "warning: file modified"); if (!isatty(0)) { fprintf(stderr, garrulous ? "script, line %d: %s\n" : @@ -293,14 +293,16 @@ #define SKIP_BLANKS() while (isspace((unsigned char)*ibufp) && *ibufp != '\n') ibufp++ -#define MUST_BE_FIRST() \ - if (!first) { sprintf(errmsg, "invalid address"); return ERR; } +#define MUST_BE_FIRST() if (!first) { \ + snprintf(errmsg, sizeof(errmsg), "invalid address"); \ + return ERR; \ +} /* next_addr: return the next line address in the command buffer */ long next_addr() { - char *hd; + const char *hd; long addr = current_addr; long n; int first = 1; @@ -364,7 +366,8 @@ if (ibufp == hd) return EOF; else if (addr < 0 || addr_last < addr) { - sprintf(errmsg, "invalid address"); + snprintf(errmsg, sizeof(errmsg), + "invalid address"); return ERR; } else return addr; @@ -383,10 +386,10 @@ if (extract_addr_range() < 0) \ return ERR; \ else if (addr_cnt == 0) { \ - sprintf(errmsg, "destination expected"); \ + snprintf(errmsg, sizeof(errmsg), "destination expected"); \ return ERR; \ } else if (second_addr < 0 || addr_last < second_addr) { \ - sprintf(errmsg, "invalid address"); \ + snprintf(errmsg, sizeof(errmsg), "invalid address"); \ return ERR; \ } \ addr = second_addr; \ @@ -402,7 +405,7 @@ if (extract_addr_range() < 0) \ return ERR; \ if (second_addr < 0 || addr_last < second_addr) { \ - sprintf(errmsg, "invalid address"); \ + snprintf(errmsg, sizeof(errmsg), "invalid address"); \ return ERR; \ } \ addr = second_addr; \ @@ -430,7 +433,7 @@ } \ } while (!done); \ if (*ibufp++ != '\n') { \ - sprintf(errmsg, "invalid command suffix"); \ + snprintf(errmsg, sizeof(errmsg), "invalid command suffix"); \ return ERR; \ } \ } @@ -499,10 +502,11 @@ /* fall through */ case 'E': if (addr_cnt > 0) { - sprintf(errmsg, "unexpected address"); + snprintf(errmsg, sizeof(errmsg), "unexpected address"); return ERR; } else if (!isspace((unsigned char)*ibufp)) { - sprintf(errmsg, "unexpected command suffix"); + snprintf(errmsg, sizeof(errmsg), + "unexpected command suffix"); return ERR; } else if ((fnp = get_filename()) == NULL) return ERR; @@ -517,7 +521,7 @@ if (*fnp && *fnp != '!') strcpy(old_filename, fnp); #ifdef BACKWARDS if (*fnp == '\0' && *old_filename == '\0') { - sprintf(errmsg, "no current filename"); + snprintf(errmsg, sizeof(errmsg), "no current filename"); return ERR; } #endif @@ -529,15 +533,16 @@ break; case 'f': if (addr_cnt > 0) { - sprintf(errmsg, "unexpected address"); + snprintf(errmsg, sizeof(errmsg), "unexpected address"); return ERR; } else if (!isspace((unsigned char)*ibufp)) { - sprintf(errmsg, "unexpected command suffix"); + snprintf(errmsg, sizeof(errmsg), + "unexpected command suffix"); return ERR; } else if ((fnp = get_filename()) == NULL) return ERR; else if (*fnp == '!') { - sprintf(errmsg, "invalid redirection"); + snprintf(errmsg, sizeof(errmsg), "invalid redirection"); return ERR; } GET_COMMAND_SUFFIX(); @@ -549,7 +554,8 @@ case 'G': case 'V': if (isglobal) { - sprintf(errmsg, "cannot nest global commands"); + snprintf(errmsg, sizeof(errmsg), + "cannot nest global commands"); return ERR; } else if (check_addr_range(1, addr_last) < 0) return ERR; @@ -563,7 +569,8 @@ break; case 'h': if (addr_cnt > 0) { - sprintf(errmsg, "unexpected address"); + snprintf(errmsg, sizeof(errmsg), + "unexpected address"); return ERR; } GET_COMMAND_SUFFIX(); @@ -571,7 +578,8 @@ break; case 'H': if (addr_cnt > 0) { - sprintf(errmsg, "unexpected address"); + snprintf(errmsg, sizeof(errmsg), + "unexpected address"); return ERR; } GET_COMMAND_SUFFIX(); @@ -580,7 +588,7 @@ break; case 'i': if (second_addr == 0) { - sprintf(errmsg, "invalid address"); + snprintf(errmsg, sizeof(errmsg), "invalid address"); return ERR; } GET_COMMAND_SUFFIX(); @@ -600,7 +608,7 @@ case 'k': c = *ibufp++; if (second_addr == 0) { - sprintf(errmsg, "invalid address"); + snprintf(errmsg, sizeof(errmsg), "invalid address"); return ERR; } GET_COMMAND_SUFFIX(); @@ -620,7 +628,7 @@ return ERR; GET_THIRD_ADDR(addr); if (first_addr <= addr && addr < second_addr) { - sprintf(errmsg, "invalid destination"); + snprintf(errmsg, sizeof(errmsg), "invalid destination"); return ERR; } GET_COMMAND_SUFFIX(); @@ -646,7 +654,7 @@ break; case 'P': if (addr_cnt > 0) { - sprintf(errmsg, "unexpected address"); + snprintf(errmsg, sizeof(errmsg), "unexpected address"); return ERR; } GET_COMMAND_SUFFIX(); @@ -655,7 +663,7 @@ case 'q': case 'Q': if (addr_cnt > 0) { - sprintf(errmsg, "unexpected address"); + snprintf(errmsg, sizeof(errmsg), "unexpected address"); return ERR; } GET_COMMAND_SUFFIX(); @@ -663,7 +671,8 @@ break; case 'r': if (!isspace((unsigned char)*ibufp)) { - sprintf(errmsg, "unexpected command suffix"); + snprintf(errmsg, sizeof(errmsg), + "unexpected command suffix"); return ERR; } else if (addr_cnt == 0) second_addr = addr_last; @@ -675,7 +684,7 @@ strcpy(old_filename, fnp); #ifdef BACKWARDS if (*fnp == '\0' && *old_filename == '\0') { - sprintf(errmsg, "no current filename"); + snprintf(errmsg, sizeof(errmsg), "no current filename"); return ERR; } #endif @@ -710,18 +719,21 @@ break; default: if (sflags) { - sprintf(errmsg, "invalid command suffix"); + snprintf(errmsg, sizeof(errmsg), + "invalid command suffix"); return ERR; } } } while (sflags && *ibufp != '\n'); if (sflags && !pat) { - sprintf(errmsg, "no previous substitution"); + snprintf(errmsg, sizeof(errmsg), + "no previous substitution"); return ERR; } else if (sflags & SGG) sgnum = 0; /* override numeric arg */ if (*ibufp != '\n' && *(ibufp + 1) == '\n') { - sprintf(errmsg, "invalid pattern delimiter"); + snprintf(errmsg, sizeof(errmsg), + "invalid pattern delimiter"); return ERR; } tpat = pat; @@ -782,7 +794,7 @@ break; case 'u': if (addr_cnt > 0) { - sprintf(errmsg, "unexpected address"); + snprintf(errmsg, sizeof(errmsg), "unexpected address"); return ERR; } GET_COMMAND_SUFFIX(); @@ -796,7 +808,8 @@ ibufp++; } if (!isspace((unsigned char)*ibufp)) { - sprintf(errmsg, "unexpected command suffix"); + snprintf(errmsg, sizeof(errmsg), + "unexpected command suffix"); return ERR; } else if ((fnp = get_filename()) == NULL) return ERR; @@ -809,7 +822,7 @@ strcpy(old_filename, fnp); #ifdef BACKWARDS if (*fnp == '\0' && *old_filename == '\0') { - sprintf(errmsg, "no current filename"); + snprintf(errmsg, sizeof(errmsg), "no current filename"); return ERR; } #endif @@ -823,14 +836,14 @@ break; case 'x': if (addr_cnt > 0) { - sprintf(errmsg, "unexpected address"); + snprintf(errmsg, sizeof(errmsg), "unexpected address"); return ERR; } GET_COMMAND_SUFFIX(); #ifdef DES des = get_keyword(); #else - sprintf(errmsg, "crypt unavailable"); + snprintf(errmsg, sizeof(errmsg), "crypt unavailable"); return ERR; #endif break; @@ -855,7 +868,7 @@ break; case '!': if (addr_cnt > 0) { - sprintf(errmsg, "unexpected address"); + snprintf(errmsg, sizeof(errmsg), "unexpected address"); return ERR; } else if ((sflags = get_shell_command()) < 0) return ERR; @@ -874,7 +887,7 @@ return ERR; break; default: - sprintf(errmsg, "unknown command"); + snprintf(errmsg, sizeof(errmsg), "unknown command"); return ERR; } return gflag; @@ -892,7 +905,7 @@ } if (first_addr > second_addr || 1 > first_addr || second_addr > addr_last) { - sprintf(errmsg, "invalid address"); + snprintf(errmsg, sizeof(errmsg), "invalid address"); return ERR; } return 0; @@ -923,7 +936,7 @@ return n; } } while (n != current_addr); - sprintf(errmsg, "no match"); + snprintf(errmsg, sizeof(errmsg), "no match"); return ERR; } @@ -940,7 +953,7 @@ if (*ibufp != '\n') { SKIP_BLANKS(); if (*ibufp == '\n') { - sprintf(errmsg, "invalid filename"); + snprintf(errmsg, sizeof(errmsg), "invalid filename"); return NULL; } else if ((ibufp = get_extended_line(&n, 1)) == NULL) return NULL; @@ -952,13 +965,13 @@ printf("%s\n", shcmd + 1); return shcmd; } else if (n > PATH_MAX - 1) { - sprintf(errmsg, "filename too long"); + snprintf(errmsg, sizeof(errmsg), "filename too long"); return NULL; } } #ifndef BACKWARDS else if (*old_filename == '\0') { - sprintf(errmsg, "no current filename"); + snprintf(errmsg, sizeof(errmsg), "no current filename"); return NULL; } #endif @@ -983,7 +996,7 @@ int j = 0; if (red) { - sprintf(errmsg, "shell access restricted"); + snprintf(errmsg, sizeof(errmsg), "shell access restricted"); return ERR; } else if ((s = ibufp = get_extended_line(&j, 1)) == NULL) return ERR; @@ -1008,7 +1021,8 @@ else if (shcmd == NULL) #endif { - sprintf(errmsg, "no previous command"); + snprintf(errmsg, sizeof(errmsg), + "no previous command"); return ERR; } else { REALLOC(buf, n, i + shcmdi, ERR); @@ -1019,7 +1033,8 @@ break; case '%': if (*old_filename == '\0') { - sprintf(errmsg, "no current filename"); + snprintf(errmsg, sizeof(errmsg), + "no current filename"); return ERR; } j = strlen(s = strip_escapes(old_filename)); @@ -1043,8 +1058,8 @@ long n; { int l; - char *lp = ibuf; - char *eot; + const char *lp = ibuf; + const char *eot; undo_t *up = NULL; for (current_addr = n;;) { @@ -1246,7 +1261,7 @@ char *s; if (!from) { - sprintf(errmsg, "invalid address"); + snprintf(errmsg, sizeof(errmsg), "invalid address"); return ERR; } ep = get_addressed_line_node(INC_MOD(to, addr_last)); @@ -1273,7 +1288,7 @@ int n; { if (!islower((unsigned char)n)) { - sprintf(errmsg, "invalid mark character"); + snprintf(errmsg, sizeof(errmsg), "invalid mark character"); return ERR; } else if (mark[n - 'a'] == NULL) markno++; @@ -1288,7 +1303,7 @@ int n; { if (!islower((unsigned char)n)) { - sprintf(errmsg, "invalid mark character"); + snprintf(errmsg, sizeof(errmsg), "invalid mark character"); return ERR; } return get_line_node_addr(mark[n - 'a']); @@ -1319,7 +1334,7 @@ if ((np = (line_t *) malloc(sizeof(line_t))) == NULL) { fprintf(stderr, "%s\n", strerror(errno)); - sprintf(errmsg, "out of memory"); + snprintf(errmsg, sizeof(errmsg), "out of memory"); return NULL; } np->seek = lp->seek; @@ -1385,12 +1400,13 @@ { char *hup = NULL; /* hup filename */ char *s; + char ed_hup[] = "ed.hup"; int n; if (!sigactive) quit(1); sigflags &= ~(1 << (signo - 1)); - if (addr_last && write_file("ed.hup", "w", 1, addr_last) < 0 && + if (addr_last && write_file(ed_hup, "w", 1, addr_last) < 0 && (s = getenv("HOME")) != NULL && (n = strlen(s)) + 8 <= PATH_MAX && /* "ed.hup" + '/' */ (hup = (char *) malloc(n + 10)) != NULL) { @@ -1444,7 +1460,7 @@ char *s; { if (red && (*s == '!' || !strcmp(s, "..") || strchr(s, '/'))) { - sprintf(errmsg, "shell access restricted"); + snprintf(errmsg, sizeof(errmsg), "shell access restricted"); return 0; } return 1; Index: ed/re.c =================================================================== RCS file: /home/ncvs/src/bin/ed/re.c,v retrieving revision 1.16 diff -u -r1.16 re.c --- ed/re.c 2001/05/29 18:03:14 1.16 +++ ed/re.c 2001/07/03 01:32:27 @@ -27,12 +27,8 @@ */ #ifndef lint -#if 0 -static char * const rcsid = "@(#)re.c,v 1.6 1994/02/01 00:34:43 alm Exp"; -#else -static char * const rcsid = +static const char rcsid[] = "$FreeBSD: src/bin/ed/re.c,v 1.16 2001/05/29 18:03:14 imp Exp $"; -#endif #endif /* not lint */ #include "ed.h" @@ -54,10 +50,11 @@ int n; if ((delimiter = *ibufp) == ' ') { - sprintf(errmsg, "invalid pattern delimiter"); + snprintf(errmsg, sizeof(errmsg), "invalid pattern delimiter"); return NULL; } else if (delimiter == '\n' || *++ibufp == '\n' || *ibufp == delimiter) { - if (!exp) sprintf(errmsg, "no previous pattern"); + if (!exp) + snprintf(errmsg, sizeof(errmsg), "no previous pattern"); return exp; } else if ((exps = extract_pattern(delimiter)) == NULL) return NULL; @@ -66,7 +63,7 @@ regfree(exp); else if ((exp = (pattern_t *) malloc(sizeof(pattern_t))) == NULL) { fprintf(stderr, "%s\n", strerror(errno)); - sprintf(errmsg, "out of memory"); + snprintf(errmsg, sizeof(errmsg), "out of memory"); return NULL; } patlock = 0; @@ -97,13 +94,15 @@ break; case '[': if ((nd = parse_char_class(++nd)) == NULL) { - sprintf(errmsg, "unbalanced brackets ([])"); + snprintf(errmsg, sizeof(errmsg), + "unbalanced brackets ([])"); return NULL; } break; case '\\': if (*++nd == '\n') { - sprintf(errmsg, "trailing backslash (\\)"); + snprintf(errmsg, sizeof(errmsg), + "trailing backslash (\\)"); return NULL; } break; Index: ed/sub.c =================================================================== RCS file: /home/ncvs/src/bin/ed/sub.c,v retrieving revision 1.12 diff -u -r1.12 sub.c --- ed/sub.c 1999/08/27 23:14:15 1.12 +++ ed/sub.c 2001/07/03 01:32:27 @@ -27,12 +27,8 @@ */ #ifndef lint -#if 0 -static char * const rcsid = "@(#)sub.c,v 1.1 1994/02/01 00:34:44 alm Exp"; -#else -static char * const rcsid = +static const char rcsid[] = "$FreeBSD: src/bin/ed/sub.c,v 1.12 1999/08/27 23:14:15 peter Exp $"; -#endif #endif /* not lint */ #include "ed.h" @@ -86,7 +82,9 @@ if (*ibufp == '%' && *(ibufp + 1) == delimiter) { ibufp++; - if (!rhbuf) sprintf(errmsg, "no previous substitution"); + if (!rhbuf) + snprintf(errmsg, sizeof(errmsg), + "no previous substitution"); return rhbuf; } while (*ibufp != delimiter) { @@ -124,8 +122,8 @@ int kth; { undo_t *up; - char *txt; - char *eot; + const char *txt; + const char *eot; long lc; long xa = current_addr; int nsubs = 0; @@ -163,7 +161,7 @@ } current_addr = xa; if (nsubs == 0 && !(gflag & GLB)) { - sprintf(errmsg, "no match"); + snprintf(errmsg, sizeof(errmsg), "no match"); return ERR; } else if ((gflag & (GPR | GLS | GNP)) && display_lines(current_addr, current_addr, gflag) < 0) @@ -222,7 +220,8 @@ i = eot - txt; REALLOC(rbuf, rbufsz, off + i + 2, ERR); if (i > 0 && !rm[0].rm_eo && (gflag & GSG)) { - sprintf(errmsg, "infinite substitution loop"); + snprintf(errmsg, sizeof(errmsg), + "infinite substitution loop"); return ERR; } if (isbinary) @@ -238,7 +237,7 @@ return offset to end of modified text */ int apply_subst_template(boln, rm, off, re_nsub) - char *boln; + const char *boln; regmatch_t *rm; int off; int re_nsub; Index: ed/undo.c =================================================================== RCS file: /home/ncvs/src/bin/ed/undo.c,v retrieving revision 1.9 diff -u -r1.9 undo.c --- ed/undo.c 1999/08/27 23:14:15 1.9 +++ ed/undo.c 2001/07/03 01:32:27 @@ -26,12 +26,8 @@ */ #ifndef lint -#if 0 -static char * const rcsid = "@(#)undo.c,v 1.1 1994/02/01 00:34:44 alm Exp"; -#else -static char * const rcsid = +static const char rcsid[] = "$FreeBSD: src/bin/ed/undo.c,v 1.9 1999/08/27 23:14:15 peter Exp $"; -#endif #endif /* not lint */ #include "ed.h" @@ -55,7 +51,7 @@ if (ustack == NULL && (ustack = (undo_t *) malloc((usize = USIZE) * sizeof(undo_t))) == NULL) { fprintf(stderr, "%s\n", strerror(errno)); - sprintf(errmsg, "out of memory"); + snprintf(errmsg, sizeof(errmsg), "out of memory"); return NULL; } #endif @@ -70,7 +66,7 @@ } /* out of memory - release undo stack */ fprintf(stderr, "%s\n", strerror(errno)); - sprintf(errmsg, "out of memory"); + snprintf(errmsg, sizeof(errmsg), "out of memory"); clear_undo_stack(); free(ustack); ustack = NULL; @@ -98,7 +94,7 @@ long o_addr_last = addr_last; if (u_current_addr == -1 || u_addr_last == -1) { - sprintf(errmsg, "nothing to undo"); + snprintf(errmsg, sizeof(errmsg), "nothing to undo"); return ERR; } else if (u_p) modified = 1; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon Jul 2 19:17:53 2001 Delivered-To: freebsd-audit@freebsd.org Received: from coffee.q9media.com (coffee.q9media.com [216.94.229.19]) by hub.freebsd.org (Postfix) with ESMTP id 1496D37B405 for ; Mon, 2 Jul 2001 19:17:51 -0700 (PDT) (envelope-from mike@coffee.q9media.com) Received: (from mike@localhost) by coffee.q9media.com (8.11.2/8.11.2) id f632Vgu06246; Mon, 2 Jul 2001 22:31:43 -0400 (EDT) (envelope-from mike) Date: Mon, 2 Jul 2001 22:31:43 -0400 (EDT) Message-Id: <200107030231.f632Vgu06246@coffee.q9media.com> To: Kris Kennaway From: Mike Barcroft Cc: Dima Dorfman , Warner Losh , audit@FreeBSD.org Subject: Re: Committing patches submitted here Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Kris Kennaway writes: > Hi all, > > It would be useful when someone commits a patch here to follow up the > original message with a note stating as such, otherwise it's hard to > tell whether the patch is outstanding. Most of the recent patches by > Mike Barcroft seem to be in this category. Are there any outstanding? > > Kris It's also sort of a problem for me, as I have to go through cvs logs to see when my stuff was committed. I keep all my uncommitted patches available at: http://testbed.q9media.net/freebsd/ Dig this idea. Have CVS read the 'Submitted by:' line and send the submitter a copy of the commit log message sent to -cvs-all. Since someone sending a patch will likely have some idea what CVS is, they won't be too confused by receiving a commit log. Best regards, Mike Barcroft To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon Jul 2 20:23: 6 2001 Delivered-To: freebsd-audit@freebsd.org Received: from coffee.q9media.com (coffee.q9media.com [216.94.229.19]) by hub.freebsd.org (Postfix) with ESMTP id 44BCF37B407 for ; Mon, 2 Jul 2001 20:22:54 -0700 (PDT) (envelope-from mike@coffee.q9media.com) Received: (from mike@localhost) by coffee.q9media.com (8.11.2/8.11.2) id f633b5u06329; Mon, 2 Jul 2001 23:37:05 -0400 (EDT) (envelope-from mike) Date: Mon, 2 Jul 2001 23:37:05 -0400 (EDT) Message-Id: <200107030337.f633b5u06329@coffee.q9media.com> To: audit@FreeBSD.org From: Mike Barcroft Cc: Dima Dorfman Subject: src/lib warns patch Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I would appreciate it if someone would review and commit the patch at the end of this message. Also available at: http://testbed.q9media.net/freebsd/lib.20010702.patch This patch needs to be tested on an Alpha before committing. This patch has also been tested with -fno-builtin. Best regards, Mike Barcroft ----------------------------------------------------------------------- lib.20010702.patch o Set WARNS?=2 on Makefiles that should have it. o Tested on i386; alpha might have additional warnings. Index: libcalendar/Makefile =================================================================== RCS file: /home/ncvs/src/lib/libcalendar/Makefile,v retrieving revision 1.5 diff -u -r1.5 Makefile --- libcalendar/Makefile 2001/03/27 17:26:57 1.5 +++ libcalendar/Makefile 2001/07/03 03:15:03 @@ -1,6 +1,7 @@ # $FreeBSD: src/lib/libcalendar/Makefile,v 1.5 2001/03/27 17:26:57 ru Exp $ LIB= calendar +WARNS?= 2 SRCS= calendar.c easter.c INCS= calendar.h @@ -12,6 +13,6 @@ calendar.3 ndaysg.3 calendar.3 ndaysj.3 \ calendar.3 week.3 calendar.3 weekday.3 -CFLAGS+=-I. -I${.CURDIR} -Wall +CFLAGS+=-I. -I${.CURDIR} .include Index: libcom_err/Makefile =================================================================== RCS file: /home/ncvs/src/lib/libcom_err/Makefile,v retrieving revision 1.12 diff -u -r1.12 Makefile --- libcom_err/Makefile 2001/03/27 17:26:58 1.12 +++ libcom_err/Makefile 2001/07/03 03:15:03 @@ -1,6 +1,7 @@ # $FreeBSD: src/lib/libcom_err/Makefile,v 1.12 2001/03/27 17:26:58 ru Exp $ LIB= com_err +WARNS?= 2 SRCS= com_err.c error.c INCS= ${COM_ERRDIR}/com_err.h ${COM_ERRDIR}/com_right.h MAN= com_err.3 Index: libgnumalloc/Makefile =================================================================== RCS file: /home/ncvs/src/lib/libgnumalloc/Makefile,v retrieving revision 1.14 diff -u -r1.14 Makefile --- libgnumalloc/Makefile 1999/08/28 00:04:41 1.14 +++ libgnumalloc/Makefile 2001/07/03 03:15:03 @@ -1,6 +1,7 @@ # $FreeBSD: src/lib/libgnumalloc/Makefile,v 1.14 1999/08/28 00:04:41 peter Exp $ LIB= gnumalloc +WARNS?= 2 INTERNALLIB= yes # Do not build or install ${LIB}*.a SHLIB_MAJOR= 2 SHLIB_MINOR= 0 Index: libnetgraph/Makefile =================================================================== RCS file: /home/ncvs/src/lib/libnetgraph/Makefile,v retrieving revision 1.6 diff -u -r1.6 Makefile --- libnetgraph/Makefile 2001/03/27 17:27:09 1.6 +++ libnetgraph/Makefile 2001/07/03 03:15:03 @@ -2,6 +2,7 @@ # $Whistle: Makefile,v 1.4 1999/01/17 03:41:02 julian Exp $ LIB= netgraph +WARNS?= 2 MAN= netgraph.3 SHLIB_MAJOR= 1 @@ -9,8 +10,6 @@ SRCS= sock.c msg.c debug.c INCS= netgraph.h - -CFLAGS+= -Wall MLINKS+= netgraph.3 NgMkSockNode.3 MLINKS+= netgraph.3 NgNameNode.3 Index: libresolv/Makefile =================================================================== RCS file: /home/ncvs/src/lib/libresolv/Makefile,v retrieving revision 1.10 diff -u -r1.10 Makefile --- libresolv/Makefile 1998/10/11 04:21:56 1.10 +++ libresolv/Makefile 2001/07/03 03:15:03 @@ -1,6 +1,7 @@ # @(#)Makefile 8.1 (Berkeley) 6/4/93 LIB= resolv +WARNS?= 2 INTERNALLIB= yes # Do not build or install ${LIB}*.a SHLIB_MAJOR= 2 SHLIB_MINOR= 0 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon Jul 2 20:23:34 2001 Delivered-To: freebsd-audit@freebsd.org Received: from iatl0x01.coxmail.com (iatl1x01.coxmail.com [206.157.231.23]) by hub.freebsd.org (Postfix) with ESMTP id 545E737B401 for ; Mon, 2 Jul 2001 20:23:31 -0700 (PDT) (envelope-from mheffner@novacoxmail.com) Received: from enterprise.muriel.penguinpowered.com ([208.138.198.178]) by iatl0x01.coxmail.com (InterMail vK.4.03.02.00 201-232-124 license 85f4f10023be2bd3bce00b3a38363ea2) with ESMTP id <20010703032330.RLFH1034.iatl0x01@enterprise.muriel.penguinpowered.com>; Mon, 2 Jul 2001 23:23:30 -0400 Message-ID: X-Mailer: XFMail 1.5.0 on FreeBSD X-Priority: 3 (Normal) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="_=XFMail.1.5.0.FreeBSD:20010702232229:393=_"; micalg=pgp-md5; protocol="application/pgp-signature" In-Reply-To: <200106290358.f5T3wSt97957@coffee.q9media.com> Date: Mon, 02 Jul 2001 23:22:29 -0400 (EDT) Reply-To: Mike Heffner From: Mike Heffner To: Mike Barcroft Subject: RE: src/bin/chio patch Cc: audit@FreeBSD.org Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This message is in MIME format --_=XFMail.1.5.0.FreeBSD:20010702232229:393=_ Content-Type: text/plain; charset=us-ascii On 29-Jun-2001 Mike Barcroft wrote: | I would appreciate it if someone would review and commit the patch at | the end of this message. Also available at: | http://testbed.q9media.net/freebsd/chio.20010628.patch | Done, thanks! Mike -- Mike Heffner Fredericksburg, VA --_=XFMail.1.5.0.FreeBSD:20010702232229:393=_ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) Comment: For info see http://www.gnupg.org iD8DBQE7QTp0FokZQs3sv5kRAkoyAJ9frvsIWTbwE4Vyh8Ml3ojJwvLNRACfQ2IQ oOfODReFamF4l3iMGWj/wBs= =Pqwe -----END PGP SIGNATURE----- --_=XFMail.1.5.0.FreeBSD:20010702232229:393=_-- End of MIME message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon Jul 2 20:49:22 2001 Delivered-To: freebsd-audit@freebsd.org Received: from iatl0x01.coxmail.com (iatl1x01.coxmail.com [206.157.231.23]) by hub.freebsd.org (Postfix) with ESMTP id A3C5737B401 for ; Mon, 2 Jul 2001 20:49:18 -0700 (PDT) (envelope-from mheffner@novacoxmail.com) Received: from enterprise.muriel.penguinpowered.com ([208.138.198.178]) by iatl0x01.coxmail.com (InterMail vK.4.03.02.00 201-232-124 license 85f4f10023be2bd3bce00b3a38363ea2) with ESMTP id <20010703034917.RLVZ1034.iatl0x01@enterprise.muriel.penguinpowered.com>; Mon, 2 Jul 2001 23:49:17 -0400 Message-ID: X-Mailer: XFMail 1.5.0 on FreeBSD X-Priority: 3 (Normal) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="_=XFMail.1.5.0.FreeBSD:20010702234816:393=_"; micalg=pgp-md5; protocol="application/pgp-signature" In-Reply-To: Date: Mon, 02 Jul 2001 23:48:16 -0400 (EDT) Reply-To: Mike Heffner From: Mike Heffner To: Mike Heffner Subject: RE: src/bin/chio patch Cc: audit@FreeBSD.org, Mike Barcroft Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This message is in MIME format --_=XFMail.1.5.0.FreeBSD:20010702234816:393=_ Content-Type: text/plain; charset=us-ascii On 03-Jul-2001 Mike Heffner wrote: | | On 29-Jun-2001 Mike Barcroft wrote: || I would appreciate it if someone would review and commit the patch at || the end of this message. Also available at: || http://testbed.q9media.net/freebsd/chio.20010628.patch || | | Done, thanks! Unfortunately I had to revert the Makefile WARNS addition because I forgot to test on alpha first ;( I'll try and look at cleaning up the alpha warnings tomorrow. Below is the compiler warnings from beast in case anyone wants to take a stab at it: cc -W -Wall -ansi -pedantic -Wbad-function-cast -Wcast-align -Wcast-qual -Wchar-subscr ipts -Wconversion -Winline -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wre dundant-decls -Wshadow -Wstrict-prototypes -Wwrite-strings -c chio.c chio.c:124: warning: function declaration isn't a prototype chio.c: In function `do_status': chio.c:692: warning: passing arg 1 of `calloc' with different width due to prototype chio.c:711: warning: passing arg 1 of `bits_to_string' as signed due to prototype chio.c: In function `do_voltag': chio.c:849: warning: pointer targets in passing arg 1 of `strncpy' differ in signedness chio.c: In function `do_return': chio.c:1009: warning: passing arg 1 of `get_element_status' with different width due to prototype chio.c:1009: warning: passing arg 2 of `get_element_status' with different width due to prototype chio.c: In function `get_element_status': chio.c:1047: warning: promoted argument `type' doesn't match prototype chio.c:69: warning: prototype declaration chio.c:1047: warning: promoted argument `element' doesn't match prototype chio.c:69: warning: prototype declaration chio.c:1052: warning: passing arg 1 of `calloc' with different width due to prototype chio.c: In function `find_element': chio.c:1105: warning: passing arg 1 of `calloc' with different width due to prototype chio.c:1188: warning: pointer targets in passing arg 2 of `strcasecmp' differ in signed ness Mike -- Mike Heffner Fredericksburg, VA --_=XFMail.1.5.0.FreeBSD:20010702234816:393=_ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) Comment: For info see http://www.gnupg.org iD8DBQE7QUCAFokZQs3sv5kRAl60AJ9Jo2xegNnPKlLBpgZcq66DbzVkQQCeLgFO kdjNU7+MQLeVN+POvxAIa6E= =WvN3 -----END PGP SIGNATURE----- --_=XFMail.1.5.0.FreeBSD:20010702234816:393=_-- End of MIME message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon Jul 2 21:50: 3 2001 Delivered-To: freebsd-audit@freebsd.org Received: from coffee.q9media.com (coffee.q9media.com [216.94.229.19]) by hub.freebsd.org (Postfix) with ESMTP id 0597B37B405 for ; Mon, 2 Jul 2001 21:49:56 -0700 (PDT) (envelope-from mike@coffee.q9media.com) Received: (from mike@localhost) by coffee.q9media.com (8.11.2/8.11.2) id f63546R06427; Tue, 3 Jul 2001 01:04:06 -0400 (EDT) (envelope-from mike) Date: Tue, 3 Jul 2001 01:04:06 -0400 (EDT) Message-Id: <200107030504.f63546R06427@coffee.q9media.com> To: Mike Heffner From: Mike Barcroft Cc: audit@FreeBSD.org, Mike Heffner Subject: Re: src/bin/chio patch Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > Unfortunately I had to revert the Makefile WARNS addition because I forgot to > test on alpha first ;( I'll try and look at cleaning up the alpha > warnings tomorrow. Below is the compiler warnings from beast in case anyone > wants to take a stab at it: [warnings snipped.] Sorry about that. I should probably put a warning in my patch descriptions that they need to be tested on an Alpha before committing. I think I've corrected all the warnings in this patch. Can you test it and get back to me? The patch is at the end of this message and also available at: http://testbed.q9media.com/freebsd/chio.20010703.patch Best regards, Mike Barcroft ----------------------------------------------------------------------- chio.20010703.patch o Attempt to silence warnings generated on an Alpha. o Set WARNS?=2 Index: chio/Makefile =================================================================== RCS file: /home/ncvs/src/bin/chio/Makefile,v retrieving revision 1.9 diff -u -r1.9 Makefile --- chio/Makefile 2001/07/03 03:34:42 1.9 +++ chio/Makefile 2001/07/03 04:37:41 @@ -2,6 +2,7 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 PROG= chio +WARNS?= 2 SRCS= chio.c .include Index: chio/chio.c =================================================================== RCS file: /home/ncvs/src/bin/chio/chio.c,v retrieving revision 1.18 diff -u -r1.18 chio.c --- chio/chio.c 2001/07/03 03:22:49 1.18 +++ chio/chio.c 2001/07/03 04:37:42 @@ -63,10 +63,11 @@ static const char * element_type_name __P((int et)); static int parse_special __P((char *)); static int is_special __P((char *)); -static const char *bits_to_string __P((int, const char *)); +static const char *bits_to_string __P((ces_status_flags, const char *)); static void find_element __P((char *, u_int16_t *, u_int16_t *)); -static struct changer_element_status *get_element_status __P((u_int16_t, u_int16_t)); +static struct changer_element_status *get_element_status + __P((unsigned int, unsigned int)); static int do_move __P((const char *, int, char **)); static int do_exchange __P((const char *, int, char **)); @@ -689,7 +690,7 @@ /* Allocate storage for the status structures. */ cesr.cesr_element_status = (struct changer_element_status *) - calloc(count, sizeof(struct changer_element_status)); + calloc((size_t)count, sizeof(struct changer_element_status)); if (!cesr.cesr_element_status) errx(1, "can't allocate status storage"); @@ -845,8 +846,9 @@ goto usage; } - strncpy(csvr.csvr_voltag.cv_volid, argv[2], + (void) memcpy(csvr.csvr_voltag.cv_volid, argv[2], sizeof(csvr.csvr_voltag.cv_volid)); + csvr.csvr_voltag.cv_volid[strlen(argv[2]) + 1] = '\0'; if (argc == 4) { csvr.csvr_voltag.cv_serial = atol(argv[3]); @@ -944,7 +946,7 @@ static const char * bits_to_string(v, cp) - int v; + ces_status_flags v; const char *cp; { const char *np; @@ -1006,7 +1008,8 @@ } ++argv; --argc; - ces = get_element_status(type, element); /* Get the status */ + /* Get the status */ + ces = get_element_status((unsigned int)type, (unsigned int)element); if (NULL == ces) errx(1, "%s: null element status pointer", cname); @@ -1042,22 +1045,22 @@ */ static struct changer_element_status * get_element_status(type, element) - u_int16_t type; - u_int16_t element; + unsigned int type; + unsigned int element; { struct changer_element_status_request cesr; struct changer_element_status *ces; ces = (struct changer_element_status *) - calloc(1, sizeof(struct changer_element_status)); + calloc((size_t)1, sizeof(struct changer_element_status)); if (NULL == ces) errx(1, "can't allocate status storage"); (void)memset(&cesr, 0, sizeof(cesr)); - cesr.cesr_element_type = type; - cesr.cesr_element_base = element; + cesr.cesr_element_type = (u_int16_t)type; + cesr.cesr_element_base = (u_int16_t)element; cesr.cesr_element_count = 1; /* Only this one element */ cesr.cesr_flags |= CESR_VOLTAGS; /* Grab voltags as well */ cesr.cesr_element_status = ces; @@ -1088,7 +1091,8 @@ struct changer_params cp; struct changer_element_status_request cesr; struct changer_element_status *ch_ces, *ces; - int elem, total_elem, found = 0; + int found = 0; + size_t elem, total_elem; /* * Get the changer parameters, we're interested in the counts @@ -1185,7 +1189,8 @@ continue; /* Check to see if it is our target */ - if (strcasecmp(voltag, ces->ces_pvoltag.cv_volid) == 0) { + if (strcasecmp(voltag, + (const char *)ces->ces_pvoltag.cv_volid) == 0) { *et = ces->ces_type; *eu = ces->ces_addr; ++found; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon Jul 2 22:18:15 2001 Delivered-To: freebsd-audit@freebsd.org Received: from mail.rpi.edu (mail.rpi.edu [128.113.22.40]) by hub.freebsd.org (Postfix) with ESMTP id 0C4A337B406 for ; Mon, 2 Jul 2001 22:18:13 -0700 (PDT) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.acs.rpi.edu [128.113.24.47]) by mail.rpi.edu (8.11.3/8.11.3) with ESMTP id f635IBY78340; Tue, 3 Jul 2001 01:18:11 -0400 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: References: Date: Tue, 3 Jul 2001 01:18:08 -0400 To: freebsd-print@bostonradio.org From: Garance A Drosihn Subject: Re: Initial ctlinfo, for checking incoming jobs to lpd Cc: freebsd-audit@FreeBSD.org Content-Type: text/plain; charset="us-ascii" ; format="flowed" Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG At 8:49 PM -0400 6/27/01, Garance A Drosihn wrote: >The following patch would add a new source file to lpr/common_source, >called ctlinfo.c. While I have several plans for ctlinfo.c, this >first cut just replaces calls to link & unlink in lpd/recvjob.c >with a call to a new routine which does a whole bunch of work. For those playing at home, the patch also includes a subtle but probably dangerous bug. (it does happen to work fine, until you try to print debugging messages on some other platforms...). Down where I have: >+ sroom = roundup(sizeof(struct cjprivate), 8); >+ sroom2 = sroom + strlen(cfname) + 1; >+ sroom2 = roundup(sroom2, 8); >+ msize = sroom2 + CTI_LINEMAX; >+ msize = roundup(msize, 8); >+ cpriv = (struct cjprivate *)malloc(msize); >+ if (cpriv == NULL) >+ return NULL; >+ memset(cpriv, 0, msize); >+ >+ cpriv->pub.cji_fname = (char *)(cpriv + sroom); >+ strcpy(cpriv->pub.cji_fname, cfname); >+ cpriv->cji_buff = (char *)(cpriv + sroom2); >+ cpriv->cji_eobuff = (char *)(cpriv + msize - 1); The three lines where I add offsets to cpriv are wrong. They should be: + cpriv->pub.cji_fname = (char *)cpriv + sroom; + strcpy(cpriv->pub.cji_fname, cfname); + cpriv->cji_buff = (char *)cpriv + sroom2; + cpriv->cji_eobuff = (char *)cpriv + msize - 1; I haven't refreshed the patch-files that I posted earlier, as I'm still in the middle of testing. But I thought I would mention this in case anyone else was running the patch. [reminder: this patch has not been committed to anywhere yet, so no need to panic...] -- Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon Jul 2 23: 5:58 2001 Delivered-To: freebsd-audit@freebsd.org Received: from coffee.q9media.com (coffee.q9media.com [216.94.229.19]) by hub.freebsd.org (Postfix) with ESMTP id 336A837B406 for ; Mon, 2 Jul 2001 23:05:56 -0700 (PDT) (envelope-from mike@coffee.q9media.com) Received: (from mike@localhost) by coffee.q9media.com (8.11.2/8.11.2) id f636K7u06516; Tue, 3 Jul 2001 02:20:07 -0400 (EDT) (envelope-from mike) Date: Tue, 3 Jul 2001 02:20:07 -0400 (EDT) Message-Id: <200107030620.f636K7u06516@coffee.q9media.com> To: Mike Heffner From: Mike Barcroft Cc: audit@FreeBSD.org, Mike Heffner Subject: Re: src/bin/chio patch Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Mike Barcroft writes: > - strncpy(csvr.csvr_voltag.cv_volid, argv[2], > + (void) memcpy(csvr.csvr_voltag.cv_volid, argv[2], > sizeof(csvr.csvr_voltag.cv_volid)); > + csvr.csvr_voltag.cv_volid[strlen(argv[2]) + 1] = '\0'; Hmm.. what was I thinking with this? It's probably better just to use a cast. Also the NUL char is off by one byte and assumes that strlen(argv[2]) < sizeof(csvr.csvr_voltag.cv_volid). I should go to sleep. I'll fix this in the morning. Best regards, Mike Barcroft To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Tue Jul 3 5:36:13 2001 Delivered-To: freebsd-audit@freebsd.org Received: from albatross.prod.itd.earthlink.net (albatross.mail.pas.earthlink.net [207.217.120.120]) by hub.freebsd.org (Postfix) with ESMTP id F068537B403; Tue, 3 Jul 2001 05:36:04 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from mindspring.com (dialup-209.247.139.34.Dial1.SanJose1.Level3.net [209.247.139.34]) by albatross.prod.itd.earthlink.net (EL-8_9_3_3/8.9.3) with ESMTP id FAA29737; Tue, 3 Jul 2001 05:36:01 -0700 (PDT) Message-ID: <3B41BC54.309D58F2@mindspring.com> Date: Tue, 03 Jul 2001 05:36:36 -0700 From: Terry Lambert Reply-To: tlambert2@mindspring.com X-Mailer: Mozilla 4.7 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Brian Dean Cc: freebsd-audit@FreeBSD.ORG, freebsd-hackers@FreeBSD.ORG Subject: Re: kernel ddb patch for setting hardware watchpoints References: <20010630172522.A64393@neutrino.bsdhome.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Brian Dean wrote: > Caveats: This patch won't do the right thing on SMP systems. The > debug registers are set/cleared only for the CPU running ddb. > Since the debug registers are a per-cpu thing, they won't be > set for the other CPUs. I'll work on that next. FWIW: When you enter into the debugger on an SMP system, it holds all processors other than the boot processor; it restarts them on exit. This means that in single step mode, you will need to ensure that the BP has the registers set. It also means that you probably are going to have a tough time with the signalling in the MP case, where the modification hits on an AP, since an AP can't drop into the debugger. This may not be true in 5.x any more, but in 4.3, you should look at the mp debugger code in /sys/i386/i386. Probably, you will want to take the watchpoint, and then IPI the boot processor, similar to the way a CTRL-ALT-ESC does things (only using an IPI). -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Tue Jul 3 8:30:32 2001 Delivered-To: freebsd-audit@freebsd.org Received: from coffee.q9media.com (coffee.q9media.com [216.94.229.19]) by hub.freebsd.org (Postfix) with ESMTP id BEA5137B405 for ; Tue, 3 Jul 2001 08:30:21 -0700 (PDT) (envelope-from mike@coffee.q9media.com) Received: (from mike@localhost) by coffee.q9media.com (8.11.2/8.11.2) id f63FiaV07250; Tue, 3 Jul 2001 11:44:36 -0400 (EDT) (envelope-from mike) Date: Tue, 3 Jul 2001 11:44:36 -0400 (EDT) Message-Id: <200107031544.f63FiaV07250@coffee.q9media.com> To: Mike Heffner From: Mike Barcroft Cc: audit@FreeBSD.org, Mike Heffner Subject: Re: src/bin/chio patch Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Mike Barcroft writes: > Mike Barcroft writes: > > - strncpy(csvr.csvr_voltag.cv_volid, argv[2], > > + (void) memcpy(csvr.csvr_voltag.cv_volid, argv[2], > > sizeof(csvr.csvr_voltag.cv_volid)); > > + csvr.csvr_voltag.cv_volid[strlen(argv[2]) + 1] = '\0'; > > Hmm.. what was I thinking with this? It's probably better just > to use a cast. Also the NUL char is off by one byte and assumes > that strlen(argv[2]) < sizeof(csvr.csvr_voltag.cv_volid). > > I should go to sleep. I'll fix this in the morning. I've corrected this in the patch at the end of this message and also at: http://testbed.q9media.com/freebsd/chio.20010704.patch Best regards, Mike Barcroft ----------------------------------------------------------------------- chio.20010704.patch o Attempt to silence warnings generated on an Alpha. o Set WARNS?=2 Index: chio/Makefile =================================================================== RCS file: /home/ncvs/src/bin/chio/Makefile,v retrieving revision 1.9 diff -u -r1.9 Makefile --- chio/Makefile 2001/07/03 03:34:42 1.9 +++ chio/Makefile 2001/07/03 15:27:40 @@ -2,6 +2,7 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 PROG= chio +WARNS?= 2 SRCS= chio.c .include Index: chio/chio.c =================================================================== RCS file: /home/ncvs/src/bin/chio/chio.c,v retrieving revision 1.18 diff -u -r1.18 chio.c --- chio/chio.c 2001/07/03 03:22:49 1.18 +++ chio/chio.c 2001/07/03 15:27:41 @@ -63,10 +63,11 @@ static const char * element_type_name __P((int et)); static int parse_special __P((char *)); static int is_special __P((char *)); -static const char *bits_to_string __P((int, const char *)); +static const char *bits_to_string __P((ces_status_flags, const char *)); static void find_element __P((char *, u_int16_t *, u_int16_t *)); -static struct changer_element_status *get_element_status __P((u_int16_t, u_int16_t)); +static struct changer_element_status *get_element_status + __P((unsigned int, unsigned int)); static int do_move __P((const char *, int, char **)); static int do_exchange __P((const char *, int, char **)); @@ -689,7 +690,7 @@ /* Allocate storage for the status structures. */ cesr.cesr_element_status = (struct changer_element_status *) - calloc(count, sizeof(struct changer_element_status)); + calloc((size_t)count, sizeof(struct changer_element_status)); if (!cesr.cesr_element_status) errx(1, "can't allocate status storage"); @@ -845,8 +846,8 @@ goto usage; } - strncpy(csvr.csvr_voltag.cv_volid, argv[2], - sizeof(csvr.csvr_voltag.cv_volid)); + strlcpy((char *)csvr.csvr_voltag.cv_volid, argv[2], + sizeof(csvr.csvr_voltag.cv_volid)); if (argc == 4) { csvr.csvr_voltag.cv_serial = atol(argv[3]); @@ -944,7 +945,7 @@ static const char * bits_to_string(v, cp) - int v; + ces_status_flags v; const char *cp; { const char *np; @@ -1006,7 +1007,8 @@ } ++argv; --argc; - ces = get_element_status(type, element); /* Get the status */ + /* Get the status */ + ces = get_element_status((unsigned int)type, (unsigned int)element); if (NULL == ces) errx(1, "%s: null element status pointer", cname); @@ -1042,22 +1044,22 @@ */ static struct changer_element_status * get_element_status(type, element) - u_int16_t type; - u_int16_t element; + unsigned int type; + unsigned int element; { struct changer_element_status_request cesr; struct changer_element_status *ces; ces = (struct changer_element_status *) - calloc(1, sizeof(struct changer_element_status)); + calloc((size_t)1, sizeof(struct changer_element_status)); if (NULL == ces) errx(1, "can't allocate status storage"); (void)memset(&cesr, 0, sizeof(cesr)); - cesr.cesr_element_type = type; - cesr.cesr_element_base = element; + cesr.cesr_element_type = (u_int16_t)type; + cesr.cesr_element_base = (u_int16_t)element; cesr.cesr_element_count = 1; /* Only this one element */ cesr.cesr_flags |= CESR_VOLTAGS; /* Grab voltags as well */ cesr.cesr_element_status = ces; @@ -1088,7 +1090,8 @@ struct changer_params cp; struct changer_element_status_request cesr; struct changer_element_status *ch_ces, *ces; - int elem, total_elem, found = 0; + int found = 0; + size_t elem, total_elem; /* * Get the changer parameters, we're interested in the counts @@ -1185,7 +1188,8 @@ continue; /* Check to see if it is our target */ - if (strcasecmp(voltag, ces->ces_pvoltag.cv_volid) == 0) { + if (strcasecmp(voltag, + (const char *)ces->ces_pvoltag.cv_volid) == 0) { *et = ces->ces_type; *eu = ces->ces_addr; ++found; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Tue Jul 3 9:58:50 2001 Delivered-To: freebsd-audit@freebsd.org Received: from mail.chem.msu.ru (mail.chem.msu.ru [195.208.208.19]) by hub.freebsd.org (Postfix) with ESMTP id ED45637B403; Tue, 3 Jul 2001 09:58:20 -0700 (PDT) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su ([158.250.32.97]) by mail.chem.msu.ru with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id NHPRVMYP; Tue, 3 Jul 2001 20:52:09 +0400 Received: (from yar@localhost) by comp.chem.msu.su (8.11.1/8.11.1) id f63GvoN31444; Tue, 3 Jul 2001 20:57:50 +0400 (MSD) (envelope-from yar) Date: Tue, 3 Jul 2001 20:57:50 +0400 From: Yar Tikhiy To: audit@freebsd.org, net@freebsd.org Subject: ipfw ipprecedence option Message-ID: <20010703205750.A29370@comp.chem.msu.su> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="lrZ03NoBR/3+SXJZ" Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --lrZ03NoBR/3+SXJZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi there, Current ipfw implementation doesn't allow for matching IP packets by their precedence field while there exist real-life cases when it would be a rather useful feature. Please review the following patches against -current that add the feature: ipfw.diff for the utility, ip_fw.diff for kernel. As for me, they worked without any problems. -- Yar --lrZ03NoBR/3+SXJZ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="ipfw.diff" diff -u --exclude=*orig /usr/src/sbin/ipfw/ipfw.8 ipfw/ipfw.8 --- /usr/src/sbin/ipfw/ipfw.8 Thu Jun 7 00:56:56 2001 +++ ipfw/ipfw.8 Sun Jul 1 15:03:47 2001 @@ -667,6 +667,9 @@ .It Cm ipversion Ar ver Match if the IP header version is .Ar ver . +.It Cm ipprecedence Ar precedence +Match if the numeric value of IP datagram's precedence is equal to +.Ar precedence . .It Cm iptos Ar spec Match if the IP header contains the comma separated list of service types specified in diff -u --exclude=*orig /usr/src/sbin/ipfw/ipfw.c ipfw/ipfw.c --- /usr/src/sbin/ipfw/ipfw.c Tue Jun 5 03:56:26 2001 +++ ipfw/ipfw.c Sun Jul 1 15:34:42 2001 @@ -432,6 +432,8 @@ printf(" iplen %u", chain->fw_iplen); if (chain->fw_ipflg & IP_FW_IF_IPID) printf(" ipid %#x", chain->fw_ipid); + if (chain->fw_ipflg & IP_FW_IF_IPPRE) + printf(" ipprecedence %u", (chain->fw_iptos & 0xe0) >> 5); if (chain->fw_ipflg & IP_FW_IF_IPTOS) { int _opt_printed = 0; @@ -909,6 +911,7 @@ " ipoptions [!]{ssrr|lsrr|rr|ts}, ...\n" " iplen {length}\n" " ipid {identification number}\n" +" ipprecedence {precedence}\n" " iptos [!]{lowdelay|throughput|reliability|mincost|congestion}, ...\n" " ipttl {time to live}\n" " ipversion {version number}\n" @@ -2058,6 +2061,24 @@ show_usage("argument to ipid out of range"); rule.fw_ipflg |= IP_FW_IF_IPID; rule.fw_ipid = (u_short)ipid; + av++; ac--; + } else if (!strncmp(*av, "ipprecedence", strlen(*av))) { + u_long ippre; + char *c; + + av++; ac--; + if (!ac) + show_usage("missing argument" + " for ``ipprecedence''"); + ippre = strtoul(*av, &c, 0); + if (*c != '\0') + show_usage("argument to ipprecedence" + " must be numeric"); + if (ippre > 7) + show_usage("argument to ipprecedence" + " out of range"); + rule.fw_ipflg |= IP_FW_IF_IPPRE; + rule.fw_iptos |= ((u_short)ippre) << 5; av++; ac--; } else if (!strncmp(*av, "iptos", strlen(*av))) { av++; ac--; --lrZ03NoBR/3+SXJZ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="ip_fw.diff" diff -u --exclude=*orig /usr/src/sys/netinet.orig/ip_fw.c netinet/ip_fw.c --- /usr/src/sys/netinet.orig/ip_fw.c Fri Apr 6 10:52:25 2001 +++ netinet/ip_fw.c Sun Jul 1 15:40:52 2001 @@ -373,7 +373,7 @@ u_int flags = (ip->ip_tos & 0x1f); u_char opts, nopts, nopts_sve; - opts = f->fw_iptos; + opts = (f->fw_iptos & 0x1f); nopts = nopts_sve = f->fw_ipntos; while (flags != 0) { @@ -1162,6 +1162,9 @@ if (f->fw_ipflg & IP_FW_IF_IPLEN && f->fw_iplen != ip_len) continue; if (f->fw_ipflg & IP_FW_IF_IPID && f->fw_ipid != ntohs(ip->ip_id)) + continue; + if (f->fw_ipflg & IP_FW_IF_IPPRE && + (f->fw_iptos & 0xe0) != (ip->ip_tos & 0xe0)) continue; if (f->fw_ipflg & IP_FW_IF_IPTOS && !iptos_match(ip, f)) continue; diff -u --exclude=*orig /usr/src/sys/netinet.orig/ip_fw.h netinet/ip_fw.h --- /usr/src/sys/netinet.orig/ip_fw.h Tue Feb 13 17:12:04 2001 +++ netinet/ip_fw.h Sun Jul 1 15:27:24 2001 @@ -234,7 +234,8 @@ #define IP_FW_IF_IPTOS 0x00000800 /* ip type of service */ #define IP_FW_IF_IPTTL 0x00001000 /* ip time to live */ #define IP_FW_IF_IPVER 0x00002000 /* ip version */ -#define IP_FW_IF_IPMSK 0x00003f00 /* mask of all ip values */ +#define IP_FW_IF_IPPRE 0x00004000 /* ip precedence */ +#define IP_FW_IF_IPMSK 0x00007f00 /* mask of all ip values */ #define IP_FW_IF_MSK 0x0000ffff /* All possible bits mask */ --lrZ03NoBR/3+SXJZ-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Tue Jul 3 21:22:45 2001 Delivered-To: freebsd-audit@freebsd.org Received: from iatl0x01.coxmail.com (iatl1x01.coxmail.com [206.157.231.23]) by hub.freebsd.org (Postfix) with ESMTP id 5B7AE37B401 for ; Tue, 3 Jul 2001 21:22:42 -0700 (PDT) (envelope-from mheffner@novacoxmail.com) Received: from enterprise.muriel.penguinpowered.com ([208.138.198.178]) by iatl0x01.coxmail.com (InterMail vK.4.03.02.00 201-232-124 license 85f4f10023be2bd3bce00b3a38363ea2) with ESMTP id <20010704042241.TSZT1034.iatl0x01@enterprise.muriel.penguinpowered.com>; Wed, 4 Jul 2001 00:22:41 -0400 Message-ID: X-Mailer: XFMail 1.5.0 on FreeBSD X-Priority: 3 (Normal) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="_=XFMail.1.5.0.FreeBSD:20010704002118:288=_"; micalg=pgp-md5; protocol="application/pgp-signature" In-Reply-To: <200107031544.f63FiaV07250@coffee.q9media.com> Date: Wed, 04 Jul 2001 00:21:18 -0400 (EDT) Reply-To: Mike Heffner From: Mike Heffner To: Mike Barcroft Subject: Re: src/bin/chio patch Cc: audit@FreeBSD.org Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This message is in MIME format --_=XFMail.1.5.0.FreeBSD:20010704002118:288=_ Content-Type: text/plain; charset=us-ascii On 03-Jul-2001 Mike Barcroft wrote: | Mike Barcroft writes: |> Mike Barcroft writes: |> > - strncpy(csvr.csvr_voltag.cv_volid, argv[2], |> > + (void) memcpy(csvr.csvr_voltag.cv_volid, argv[2], |> > sizeof(csvr.csvr_voltag.cv_volid)); |> > + csvr.csvr_voltag.cv_volid[strlen(argv[2]) + 1] = '\0'; |> |> Hmm.. what was I thinking with this? It's probably better just |> to use a cast. Also the NUL char is off by one byte and assumes |> that strlen(argv[2]) < sizeof(csvr.csvr_voltag.cv_volid). |> |> I should go to sleep. I'll fix this in the morning. | | I've corrected this in the patch at the end of this message and | also at: http://testbed.q9media.com/freebsd/chio.20010704.patch Ok, looks good, Alpha now compiles cleanly. I'll probably committ these tomorrow. Mike -- Mike Heffner Fredericksburg, VA --_=XFMail.1.5.0.FreeBSD:20010704002118:288=_ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) Comment: For info see http://www.gnupg.org iD8DBQE7Qpm+FokZQs3sv5kRAhA6AJ43UBMvwIWDeIuHOPIXifbZYtyEZACeMmaK 4kMpkj2DXZZOh4/hR5IYS6s= =9XyB -----END PGP SIGNATURE----- --_=XFMail.1.5.0.FreeBSD:20010704002118:288=_-- End of MIME message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Jul 4 0:13:13 2001 Delivered-To: freebsd-audit@freebsd.org Received: from beppo.feral.com (beppo.feral.com [192.67.166.79]) by hub.freebsd.org (Postfix) with ESMTP id DFFF137B406; Wed, 4 Jul 2001 00:13:05 -0700 (PDT) (envelope-from mjacob@feral.com) Received: from beppo (mjacob@beppo [192.67.166.79]) by beppo.feral.com (8.11.3/8.11.3) with ESMTP id f647D5S09340; Wed, 4 Jul 2001 00:13:05 -0700 (PDT) (envelope-from mjacob@feral.com) Date: Wed, 4 Jul 2001 00:13:04 -0700 (PDT) From: Matthew Jacob X-Sender: mjacob@beppo Reply-To: mjacob@feral.com To: scsi@freebsd.org Cc: audit@freebsd.org Subject: tunable retry count for DA Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This change implements a sysctl for setting the retry count for normal I/O for scsi_da- this is useful if you're working with noisy Fibre Channel Loops. The principal node, cam, overlaps the same definition in scsi_cd. They probably ought to be moved to someplace else. Index: cam/scsi/scsi_da.c =================================================================== RCS file: /home/ncvs/src/sys/cam/scsi/scsi_da.c,v retrieving revision 1.73 diff -u -r1.73 scsi_da.c --- cam/scsi/scsi_da.c 2001/07/04 05:22:42 1.73 +++ cam/scsi/scsi_da.c 2001/07/04 07:11:13 @@ -38,6 +38,7 @@ #include #include #include +#include #endif /* _KERNEL */ #include @@ -277,6 +278,18 @@ #define DA_DEFAULT_TIMEOUT 60 /* Timeout in seconds */ #endif +#ifndef DA_DEFAULT_RETRY +#define DA_DEFAULT_RETRY 4 +#endif + +static int da_retry_count = DA_DEFAULT_RETRY; + +SYSCTL_NODE(_kern, OID_AUTO, cam, CTLFLAG_RD, 0, "CAM Subsystem"); +SYSCTL_NODE(_kern_cam, OID_AUTO, da, CTLFLAG_RD, 0, + "CAM Direct Access Disk driver"); +SYSCTL_INT(_kern_cam_da, OID_AUTO, retry_count, CTLFLAG_RW, + &da_retry_count, 0, "Normal I/O retry count"); + /* * DA_ORDEREDTAG_INTERVAL determines how often, relative * to the default timeout, we check to see whether an ordered @@ -1103,7 +1116,7 @@ tag_code = MSG_SIMPLE_Q_TAG; } scsi_read_write(&start_ccb->csio, - /*retries*/4, /* retry a few times */ + /*retries*/da_retry_count, dadone, tag_code, bp->bio_cmd == BIO_READ, To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Jul 4 2:39:13 2001 Delivered-To: freebsd-audit@freebsd.org Received: from ringworld.nanolink.com (ringworld.nanolink.com [195.24.48.13]) by hub.freebsd.org (Postfix) with SMTP id 5CB3F37B407 for ; Wed, 4 Jul 2001 02:39:04 -0700 (PDT) (envelope-from roam@orbitel.bg) Received: (qmail 3972 invoked by uid 1000); 4 Jul 2001 09:43:34 -0000 Date: Wed, 4 Jul 2001 12:43:34 +0300 From: Peter Pentchev To: arch@FreeBSD.org Cc: audit@FreeBSD.org Subject: A slight improvement of the rc system Message-ID: <20010704124334.F653@ringworld.oblivion.bg> Mail-Followup-To: arch@FreeBSD.org, audit@FreeBSD.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi, (And yes, I know that there is work in progress of importing the NetBSD rc system; still, I don't think it is going to happen very soon, and I don't think it is going to be MFC'd soon, if ever, so here goes..) Attached is a patch that does two things for the startup/shutdown scripts. First, a new rc.conf variable is introduced - script_name_sep. By default, this is a space, but it should be changed if your startup/shutdown scripts contain spaces. This is not a common occurrence, but it might prove useful, e.g. for people coming from Seattle-OS-based environments, who are prone to generating long, descriptive file names. Second, the rc.shutdown logic is changed a little, so shutdown scripts are executed in reverse alphabetical order. Thus, dependent services are shutdown before the ones they depend upon. G'luck, Peter -- .siht ekil ti gnidaer eb d'uoy ,werbeH ni erew ecnetnes siht fI Index: src/etc/rc =================================================================== RCS file: /home/ncvs/src/etc/rc,v retrieving revision 1.271 diff -u -r1.271 rc --- src/etc/rc 2001/06/28 06:43:47 1.271 +++ src/etc/rc 2001/07/04 07:45:15 @@ -793,17 +793,24 @@ ;; *) echo -n 'Local package initialization:' + slist="" for dir in ${local_startup}; do if [ -d "${dir}" ]; then for script in ${dir}/*.sh; do - if [ -x "${script}" ]; then - (set -T - trap 'exit 1' 2 - ${script} start) - fi + slist="${slist}${script_name_sep}${script}" done fi done + script_save_sep="$IFS" + IFS="${script_name_sep}" + for script in ${slist}; do + if [ -x "${script}" ]; then + (set -T + trap 'exit 1' 2 + ${script} start) + fi + done + IFS="${script_save_sep}" echo '.' ;; esac Index: src/etc/rc.shutdown =================================================================== RCS file: /home/ncvs/src/etc/rc.shutdown,v retrieving revision 1.16 diff -u -r1.16 rc.shutdown --- src/etc/rc.shutdown 2000/12/17 08:15:57 1.16 +++ src/etc/rc.shutdown 2001/07/04 07:45:15 @@ -102,17 +102,24 @@ [Nn][Oo] | '') ;; *) + slist="" for dir in ${local_startup}; do if [ -d "${dir}" ]; then for script in ${dir}/*.sh; do - if [ -x "${script}" ]; then - (set -T - trap 'exit 1' 2 - ${script} stop) - fi + slist="${script}${script_name_sep}${slist}" done fi done + script_save_sep="$IFS" + IFS="${script_name_sep}" + for script in ${slist}; do + if [ -x "${script}" ]; then + (set -T + trap 'exit 1' 2 + ${script} stop) + fi + done + IFS="${script_save_sep}" echo '.' ;; esac Index: src/etc/defaults/rc.conf =================================================================== RCS file: /home/ncvs/src/etc/defaults/rc.conf,v retrieving revision 1.116 diff -u -r1.116 rc.conf --- src/etc/defaults/rc.conf 2001/06/28 21:45:47 1.116 +++ src/etc/defaults/rc.conf 2001/07/04 07:45:15 @@ -31,6 +31,7 @@ pccard_conf="/etc/defaults/pccard.conf" # pccardd(8) config file removable_interfaces="" # Removable network interfaces for /etc/pccard_ether. local_startup="/usr/local/etc/rc.d /usr/X11R6/etc/rc.d" # startup script dirs. +script_name_sep=" " # Change if your startup scripts' names contain spaces rc_conf_files="/etc/rc.conf /etc/rc.conf.local" fsck_y_enable="NO" # Set to YES to do fsck -y if the initial preen fails. background_fsck="YES" # Attempt to run fsck in the background where possible. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Jul 4 3: 8:27 2001 Delivered-To: freebsd-audit@freebsd.org Received: from mail.musha.org (daemon.musha.org [61.122.44.178]) by hub.freebsd.org (Postfix) with ESMTP id D363837B403; Wed, 4 Jul 2001 03:08:15 -0700 (PDT) (envelope-from knu@iDaemons.org) Received: from archon.local.idaemons.org (archon.local.idaemons.org [192.168.1.32]) by mail.musha.org (Postfix) with ESMTP id 290974E3FB; Wed, 4 Jul 2001 19:08:15 +0900 (JST) Date: Wed, 04 Jul 2001 19:08:15 +0900 Message-ID: <8666d9dn1s.wl@archon.local.idaemons.org> From: "Akinori MUSHA" To: obrien@FreeBSD.org Cc: audit@FreeBSD.org Subject: a patch to add bunzip2'ing functionality to gzip(1) User-Agent: Wanderlust/2.5.4 (Smooth) SEMI/1.14.2 (=?ISO-8859-1?Q?Daish=F2?= =?ISO-8859-1?Q?ji?=) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 MULE XEmacs/21.1 (patch 14) (Cuyahoga Valley) (i386--freebsd) Organization: Associated I. Daemons X-PGP-Public-Key: finger knu@FreeBSD.org X-PGP-Fingerprint: 081D 099C 1705 861D 4B70 B04A 920B EFC7 9FD9 E1EE MIME-Version: 1.0 (generated by SEMI 1.14.2 - =?ISO-8859-1?Q?=22Daish=F2ji=22?=) Content-Type: text/plain; charset=US-ASCII Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi, Here is a patch to add bunzip2'ing functionality to our gzip(1), which I obtained from NetBSD. Now that bzip2 is in the base, why don't we make gzip(1) grok how to handle .bz2 files? :) -- / /__ __ Akinori.org / MUSHA.org / ) ) ) ) / FreeBSD.org / Ruby-lang.org Akinori MUSHA aka / (_ / ( (__( @ iDaemons.org / and.or.jp "Freeze this moment a little bit longer, make each impression a little bit stronger.. Experience slips away -- Time stand still" M share/mk/bsd.libnames.mk M gnu/usr.bin/gzip/Makefile M gnu/usr.bin/gzip/gzip.1 M gnu/usr.bin/gzip/gzip.c M gnu/usr.bin/gzip/gzip.h A gnu/usr.bin/gzip/unbzip2.c Index: share/mk/bsd.libnames.mk =================================================================== RCS file: /home/ncvs/src/share/mk/bsd.libnames.mk,v retrieving revision 1.43 diff -u -r1.43 bsd.libnames.mk --- share/mk/bsd.libnames.mk 2001/06/07 08:31:30 1.43 +++ share/mk/bsd.libnames.mk 2001/07/04 09:55:42 @@ -10,6 +10,7 @@ LIBALIAS?= ${DESTDIR}${LIBDIR}/libalias.a LIBASN1?= ${DESTDIR}${LIBDIR}/libasn1.a # XXX in secure dist, not base LIBATM?= ${DESTDIR}${LIBDIR}/libatm.a +LIBBZ2?= ${DESTDIR}${LIBDIR}/libbz2.a LIBC?= ${DESTDIR}${LIBDIR}/libc.a LIBC_PIC?= ${DESTDIR}${LIBDIR}/libc_pic.a LIBC_R?= ${DESTDIR}${LIBDIR}/libc_r.a Index: gnu/usr.bin/gzip/Makefile =================================================================== RCS file: /home/ncvs/src/gnu/usr.bin/gzip/Makefile,v retrieving revision 1.23 diff -u -r1.23 Makefile --- gnu/usr.bin/gzip/Makefile 2001/04/07 11:21:17 1.23 +++ gnu/usr.bin/gzip/Makefile 2001/07/04 09:38:56 @@ -3,7 +3,7 @@ PROG= gzip SRCS= gzip.c zip.c deflate.c trees.c bits.c unzip.c inflate.c util.c \ - crypt.c lzw.c unlzw.c unlzh.c unpack.c getopt.c + crypt.c lzw.c unbzip2.c unlzw.c unlzh.c unpack.c getopt.c CFLAGS+=-DSTDC_HEADERS=1 -DHAVE_UNISTD_H=1 -DDIRENT=1 .if ${MACHINE_ARCH} == "i386" SRCS+= match.S @@ -13,6 +13,9 @@ MAN= gzexe.1 gzip.1 zdiff.1 zforce.1 zmore.1 znew.1 NOSHARED?=yes + +LDADD+= -lbz2 +DPADD+= ${LIBBZ2} LINKS+= ${BINDIR}/gzip ${BINDIR}/gunzip LINKS+= ${BINDIR}/gzip ${BINDIR}/gzcat Index: gnu/usr.bin/gzip/gzip.1 =================================================================== RCS file: /home/ncvs/src/gnu/usr.bin/gzip/gzip.1,v retrieving revision 1.7 diff -u -r1.7 gzip.1 --- gnu/usr.bin/gzip/gzip.1 1999/09/20 09:15:15 1.7 +++ gnu/usr.bin/gzip/gzip.1 2001/07/04 09:42:11 @@ -98,11 +98,11 @@ .PP .I gunzip can currently decompress files created by -.I gzip, zip, compress, compress -H +.I gzip, bzip2, zip, compress, compress -H or .I pack. The detection of the input format is automatic. When using -the first two formats, +the first three formats, .I gunzip checks a 32 bit CRC. For .I pack, gunzip @@ -369,7 +369,8 @@ On Vax/VMS, the name of the environment variable is GZIP_OPT, to avoid a conflict with the symbol set for invocation of the program. .SH "SEE ALSO" -znew(1), zcmp(1), zmore(1), zforce(1), gzexe(1), compress(1) +znew(1), zcmp(1), zmore(1), zforce(1), gzexe(1), zip(1), unzip(1), +bzip2(1), compress(1), pack(1) .SH "DIAGNOSTICS" Exit status is normally 0; if an error occurs, exit status is 1. If a warning occurs, exit status is 2. Index: gnu/usr.bin/gzip/gzip.c =================================================================== RCS file: /home/ncvs/src/gnu/usr.bin/gzip/gzip.c,v retrieving revision 1.10 diff -u -r1.10 gzip.c --- gnu/usr.bin/gzip/gzip.c 1999/08/27 23:35:50 1.10 +++ gnu/usr.bin/gzip/gzip.c 2001/07/04 09:44:43 @@ -957,7 +957,7 @@ int nlen, slen; char suffix[MAX_SUFFIX+3]; /* last chars of name, forced to lower case */ static char *known_suffixes[] = - {z_suffix, ".gz", ".z", ".taz", ".tgz", "-gz", "-z", "_z", + {z_suffix, ".gz", ".z", ".taz", ".tgz", "-gz", "-z", "_z", ".bz2", #ifdef MAX_EXT_CHARS "z", #endif @@ -1291,6 +1291,14 @@ /* check_zipfile may get ofname from the local header */ last_member = 1; + } else if (memcmp(magic, BZIP2_MAGIC, 2) == 0 && inptr == 2 + && memcmp((char*)inbuf, BZIP2_MAGIC, 3) == 0 + && (inbuf[3] >= '0' && inbuf[3] <= '9')) { + inptr = 0; + work = unbzip2; + method = BZIP2ED; + last_member = 1; + } else if (memcmp(magic, PACK_MAGIC, 2) == 0) { work = unpack; method = PACKED; @@ -1340,7 +1348,8 @@ "compr", /* 1 */ "pack ", /* 2 */ "lzh ", /* 3 */ - "", "", "", "", /* 4 to 7 reserved */ + "", "", "", /* 4 to 6 reserved */ + "bzip2", "defla"}; /* 8 */ char *date; Index: gnu/usr.bin/gzip/gzip.h =================================================================== RCS file: /home/ncvs/src/gnu/usr.bin/gzip/gzip.h,v retrieving revision 1.3 diff -u -r1.3 gzip.h --- gnu/usr.bin/gzip/gzip.h 1995/05/30 05:00:35 1.3 +++ gnu/usr.bin/gzip/gzip.h 2001/07/04 09:46:26 @@ -55,7 +55,8 @@ #define COMPRESSED 1 #define PACKED 2 #define LZHED 3 -/* methods 4 to 7 reserved */ +/* methods 4 to 6 reserved */ +#define BZIP2ED 7 #define DEFLATED 8 #define MAX_METHODS 9 extern int method; /* compression method */ @@ -157,6 +158,7 @@ #define OLD_GZIP_MAGIC "\037\236" /* Magic header for gzip 0.5 = freeze 1.x */ #define LZH_MAGIC "\037\240" /* Magic header for SCO LZH Compress files*/ #define PKZIP_MAGIC "\120\113\003\004" /* Magic header for pkzip files */ +#define BZIP2_MAGIC "\102\132\150" /* Magic header for bzip2 files */ /* gzip flag byte */ #define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ @@ -271,6 +273,9 @@ /* in unlzh.c */ extern int unlzh OF((int in, int out)); + + /* in unbzip2.c */ +extern int unbzip2 OF((int in, int out)); /* in gzip.c */ RETSIGTYPE abort_gzip OF((void)); Index: gnu/usr.bin/gzip/unbzip2.c =================================================================== RCS file: unbzip2.c diff -N unbzip2.c --- /dev/null Wed Jul 4 18:55:00 2001 +++ unbzip2.c Wed Jul 4 18:35:50 2001 @@ -0,0 +1,84 @@ +/* unbzip2.c -- decompress files in bzip2 format. + */ + +#ifdef RCSID +/* static char rcsid[] = "$Id: unbzip2.c,v 1.4 2001/06/03 13:43:01 simonb Exp $"; */ +static char rcsid[] = "$FreeBSD$"; +#endif + +#define BZ_NO_STDIO +#include +#include + +#include "gzip.h" + + +/* ============================================================================ + * Bunzip2 in to out. + */ +int unbzip2(in, out) + int in, out; /* input and output file descriptors */ +{ + int n, ret, end_of_file; + bz_stream bzs; + + bzs.bzalloc = NULL; + bzs.bzfree = NULL; + bzs.opaque = NULL; + + end_of_file = 0; + if (BZ2_bzDecompressInit(&bzs, 0, 0) != BZ_OK) + return(ERROR); + + /* Use up the remainder of "inbuf" that's been read in already */ + bzs.next_in = inbuf; + bzs.avail_in = insize; + + while (1) { + if (bzs.avail_in == 0 && !end_of_file) { + n = read(in, inbuf, INBUFSIZ); + if (n < 0) + read_error(); + if (n == 0) + end_of_file = 1; + bzs.next_in = inbuf; + bzs.avail_in = n; + } + + bzs.next_out = outbuf; + bzs.avail_out = OUTBUFSIZ; + ret = BZ2_bzDecompress(&bzs); + + if (ret == BZ_STREAM_END) { + if (!test) { + n = write(out, outbuf, OUTBUFSIZ - bzs.avail_out); + if (n < 0) + write_error(); + bytes_out += n; + } + break; + } + else if (ret == BZ_OK) { + if (end_of_file) + read_error(); + if (!test) + n = write(out, outbuf, OUTBUFSIZ - bzs.avail_out); + bytes_out += n; + } + else { + switch (ret) { + case BZ_DATA_ERROR: + error("bzip2 data integrity error"); + case BZ_DATA_ERROR_MAGIC: + error("bzip2 magic number error"); + case BZ_MEM_ERROR: + error("bzip2 out of memory"); + } + } + } + + if (BZ2_bzDecompressEnd(&bzs) != BZ_OK) + return(ERROR); + + return(OK); +} To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Jul 4 16:56: 1 2001 Delivered-To: freebsd-audit@freebsd.org Received: from mail.rpi.edu (mail.rpi.edu [128.113.22.40]) by hub.freebsd.org (Postfix) with ESMTP id DC24237B406 for ; Wed, 4 Jul 2001 16:55:58 -0700 (PDT) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.acs.rpi.edu [128.113.24.47]) by mail.rpi.edu (8.11.3/8.11.3) with ESMTP id f64NsQS18244; Wed, 4 Jul 2001 19:54:41 -0400 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: References: Date: Wed, 4 Jul 2001 19:54:24 -0400 To: freebsd-print@bostonradio.org From: Garance A Drosihn Subject: Re: lpr/ ctlinfo, second cut of new routine Cc: freebsd-audit@FreeBSD.org Content-Type: text/plain; charset="us-ascii" ; format="flowed" Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG At 8:49 PM -0400 6/27/01, Garance A Drosihn wrote: >The following patch would add a new source file to lpr/common_source, >called ctlinfo.c. While I have several plans for ctlinfo.c, this >first cut just replaces calls to link & unlink in lpd/recvjob.c >with a call to a new routine which does a whole bunch of work. > >The basic goal here is to sanity and safety-check all the lines in >an incoming 'control file' ("cf*") for jobs coming into lpd from >remote hosts. I have what I hope to be the final version of the patch available at: http://people.freebsd.org/~gad/lpr/ctlinfo.diff or ftp://freefour.acs.rpi.edu/pub/bsdlpr/ctlinfo.diff This is tested on i386, and compiles fine on alpha. I've made a number of improvements from my previous patch, based on a few days of testing on other platforms here at RPI. This will be going into production at RPI this week (Thursday morning, if I get up early enough...). I've done a fair amount of checking at this point, so I expect this is pretty much ready to go. Assuming I don't get into any surprises when I put this in production at RPI, I hope to commit this to current sometime next weekend (the 14th or so). MFC to stable a few weeks later. The patch is just under 1000 lines (almost all of which is in the new ctlinfo.c file), so I thought it was a bit too much to include in this message. -- Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Jul 4 21:27:20 2001 Delivered-To: freebsd-audit@freebsd.org Received: from coffee.q9media.com (coffee.q9media.com [216.94.229.19]) by hub.freebsd.org (Postfix) with ESMTP id A736837B405 for ; Wed, 4 Jul 2001 21:27:14 -0700 (PDT) (envelope-from mike@coffee.q9media.com) Received: (from mike@localhost) by coffee.q9media.com (8.11.2/8.11.2) id f654fko09366; Thu, 5 Jul 2001 00:41:46 -0400 (EDT) (envelope-from mike) Date: Thu, 5 Jul 2001 00:41:46 -0400 (EDT) Message-Id: <200107050441.f654fko09366@coffee.q9media.com> To: audit@FreeBSD.org From: Mike Barcroft Subject: src/usr.bin/whois patch Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I would appreciate it if someone would review and commit the patch at the end of this message. Also available at: http://testbed.q9media.net/freebsd/whois.20010705.patch Best regards, Mike Barcroft ----------------------------------------------------------------------- whois.20010705.patch o Re-write the logic that finds the whois server to query. [This fixes a bug where someone would type 'whois foo.bar.' and get an error because of the trailing period.] Index: whois/whois.c =================================================================== RCS file: /home/ncvs/src/usr.bin/whois/whois.c,v retrieving revision 1.20 diff -u -r1.20 whois.c --- whois/whois.c 2001/06/27 23:06:47 1.20 +++ whois/whois.c 2001/07/05 04:08:04 @@ -79,6 +79,7 @@ const char *ip_whois[] = { RNICHOST, PNICHOST, NULL }; +static char *choose_server(const char *); static void usage(void); static void whois(char *, struct addrinfo *, int); @@ -88,7 +89,7 @@ struct addrinfo hints, *res; const char *host; char *qnichost; - int ch, error, flags, i, j, use_qnichost; + int ch, error, flags, use_qnichost; #ifdef SOCKS SOCKSinit(argv[0]); @@ -159,31 +160,17 @@ } while (argc--) { if (use_qnichost) { - for (i = j = 0; (*argv)[i]; i++) - if ((*argv)[i] == '.') - j = i; - if (j != 0) { - if (isdigit(*(*argv + j + 1))) { - asprintf(&qnichost, "%s", ANICHOST); - if (qnichost == NULL) - err(1, "asprintf()"); - } else { - asprintf(&qnichost, "%s%s", - *argv + j + 1, QNICHOST_TAIL); - if (qnichost == NULL) - err(1, "asprintf()"); - } - - memset(&hints, 0, sizeof(hints)); - hints.ai_flags = 0; - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - error = getaddrinfo(qnichost, "whois", - &hints, &res); - if (error != 0) - errx(EX_NOHOST, "%s: %s", qnichost, - gai_strerror(error)); - } + qnichost = choose_server(*argv); + + memset(&hints, 0, sizeof(hints)); + hints.ai_flags = 0; + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + error = getaddrinfo(qnichost, "whois", + &hints, &res); + if (error != 0) + errx(EX_NOHOST, "%s: %s", qnichost, + gai_strerror(error)); } if (qnichost == NULL) { memset(&hints, 0, sizeof(hints)); @@ -202,6 +189,40 @@ freeaddrinfo(res); } exit(0); +} + +/* + * Returns a pointer to newly allocated memory containing the whois server to + * be queried, or a NULL pointer, if the correct server couldn't be determined. + * The caller must remember to free(3) the allocated memory. + */ +static char * +choose_server(const char *domain) +{ + size_t len; + char *buf, *pos, *retval; + + if ((buf = strdup(domain)) == NULL) + err(1, "strdup()"); + len = strlen(buf); + while (len && buf[len - 1] == '.') + buf[--len] = '\0'; + if ((pos = strrchr(buf, '.')) == NULL) { + free(buf); + return (NULL); + } + pos++; + if (isdigit(*pos)) { + asprintf(&retval, "%s", ANICHOST); + if (retval == NULL) + err(1, "asprintf()"); + } else { + asprintf(&retval, "%s%s", pos, QNICHOST_TAIL); + if (retval == NULL) + err(1, "asprintf()"); + } + free(buf); + return (retval); } static void To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Jul 4 22:37:51 2001 Delivered-To: freebsd-audit@freebsd.org Received: from bazooka.unixfreak.org (bazooka.unixfreak.org [63.198.170.138]) by hub.freebsd.org (Postfix) with ESMTP id 6D12637B401; Wed, 4 Jul 2001 22:37:37 -0700 (PDT) (envelope-from dima@unixfreak.org) Received: from hornet.unixfreak.org (hornet [63.198.170.140]) by bazooka.unixfreak.org (Postfix) with ESMTP id EE5383E28; Wed, 4 Jul 2001 22:37:36 -0700 (PDT) To: audit@freebsd.org, peter@freebsd.org Subject: Re: config(8) 'include' patch Date: Wed, 04 Jul 2001 22:37:36 -0700 From: Dima Dorfman Message-Id: <20010705053736.EE5383E28@bazooka.unixfreak.org> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Anybody care to review this? Anybody at all? Dima Dorfman writes: > The attached patch, mostly ported from OpenBSD, adds an 'include' > directive to config(8). As discussed on -hackers, this can be used to > split up kernel config files into a machine-dependent and > machine-independent parts. In relation to this, some people also > asked for unoption/undevice directives; it looks like those would be > easy to implement, but I'd like to commit this first since these > changes ('include' vs. 'unoption') are technically unrelated. > > Please review and comment. > > Thanks, > > Dima Dorfman > dima@unixfreak.org > > > Index: config.h > =================================================================== > RCS file: /stl/src/FreeBSD/src/usr.sbin/config/config.h,v > retrieving revision 1.48 > diff -u -r1.48 config.h > --- config.h 2001/02/28 02:55:15 1.48 > +++ config.h 2001/06/28 05:51:11 > @@ -142,6 +142,7 @@ > > extern char errbuf[80]; > extern int yyline; > +extern const char *yyfile; > > extern struct file_list *ftab; > > Index: config.y > =================================================================== > RCS file: /stl/src/FreeBSD/src/usr.sbin/config/config.y,v > retrieving revision 1.54 > diff -u -r1.54 config.y > --- config.y 2001/02/22 04:00:29 1.54 > +++ config.y 2001/06/28 05:51:11 > @@ -17,6 +17,7 @@ > %token OPTIONS > %token MAKEOPTIONS > %token SEMICOLON > +%token INCLUDE > > %token ID > %token NUMBER > @@ -77,14 +78,15 @@ > char *hints; > int hintmode; int yyline; > +const char *yyfile; > struct file_list *ftab; > char errbuf[80]; > int maxusers; > > #define ns(s) strdup(s) > +int include(const char *, int); > +void yyerror(const char *s); > > -static void yyerror(const char *s); > - > static char * > devopt(char *dev) > { > @@ -147,11 +149,14 @@ > = { > hints = $2; > hintmode = 1; > - }; > + } | > + INCLUDE ID > + = { include($2, 0); }; > > System_spec: > CONFIG System_id System_parameter_list > - = { errx(1, "line %d: root/dump/swap specifications obsolete", yyline > );} > + = { errx(1, "%s:%d: root/dump/swap specifications obsolete", > + yyfile, yyline);} > | > CONFIG System_id > ; > @@ -178,7 +183,8 @@ > > newopt(&opt, $1, NULL); > if ((s = strchr($1, '='))) > - errx(1, "line %d: The `=' in options should not be quot > ed", yyline); > + errx(1, "%s:%d: The `=' in options should not be " > + "quoted", yyfile, yyline); > } | > Save_id EQUALS Opt_value > = { > @@ -229,16 +235,17 @@ > /* and the device part */ > newdev($2, $3); > if ($3 == 0) > - errx(1, "line %d: devices with zero units are not likel > y to be correct", yyline); > + errx(1, "%s:%d: devices with zero units are not " > + "likely to be correct", yyfile, yyline); > } ; > > %% > > -static void > +void > yyerror(const char *s) > { > > - errx(1, "line %d: %s", yyline + 1, s); > + errx(1, "%s:%d: %s", yyfile, yyline + 1, s); > } > > /* > Index: lang.l > =================================================================== > RCS file: /stl/src/FreeBSD/src/usr.sbin/config/lang.l,v > retrieving revision 1.30 > diff -u -r1.30 lang.l > --- lang.l 2001/02/19 04:43:21 1.30 > +++ lang.l 2001/06/28 05:51:11 > @@ -35,6 +35,7 @@ > * $FreeBSD: src/usr.sbin/config/lang.l,v 1.30 2001/02/19 04:43:21 peter Exp > $ > */ > > +#include > #include > #include > #include "y.tab.h" > @@ -43,6 +44,19 @@ > #define YY_NO_UNPUT > > /* > + * Data for returning to previous files from include files. > + */ > +struct incl { > + struct incl *in_prev; /* previous includes in effect, if any */ > + YY_BUFFER_STATE in_buf; /* previous lex state */ > + const char *in_fname; /* previous file name */ > + int in_lineno; /* previous line number */ > + int in_ateof; /* token to insert at EOF */ > +}; > +static struct incl *inclp; > +static const char *lastfile; > + > +/* > * Key word table > */ > > @@ -61,13 +75,17 @@ > { "profile", PROFILE }, > { "option", OPTIONS }, > { "options", OPTIONS }, > + { "include", INCLUDE }, > { 0, 0 }, > }; > > > +static int endinclude(void); > +int include(const char *, int); > int kw_lookup(char *); > int octal(char *); > int hex(char *); > +int yyerror(const char *); > > %} > WORD [A-Za-z_][-A-Za-z_]* > @@ -145,6 +163,16 @@ > ";" { return SEMICOLON; } > "," { return COMMA; } > "=" { BEGIN TOEOL; return EQUALS; } > +<> { > + int tok; > + > + if (inclp == NULL) > + return YY_NULL; > + tok = endinclude(); > + if (tok != 0) > + return tok; > + /* otherwise continue scanning */ > + } > . { return yytext[0]; } > > %% > @@ -185,4 +213,61 @@ > > (void) sscanf(str+2, "%x", &num); > return num; > +} > + > + > +/* > + * Open the named file for inclusion at the current point. Returns 0 on > + * success (file opened and previous state pushed), nonzero on failure > + * (fopen failed, complaint made). The `ateof' parameter controls the > + * token to be inserted at the end of the include file. If ateof == 0, > + * then nothing is inserted. > + */ > +int > +include(const char *fname, int ateof) > +{ > + FILE *fp; > + struct incl *in; > + > + fp = fopen(fname, "r"); > + if (fp == NULL) { > + yyerror("cannot open file"); > + return (-1); > + } > + in = malloc(sizeof(*in)); > + assert(in != NULL); > + in->in_prev = inclp; > + in->in_buf = YY_CURRENT_BUFFER; > + in->in_fname = yyfile; > + in->in_lineno = yyline; > + in->in_ateof = ateof; > + inclp = in; > + yy_switch_to_buffer(yy_create_buffer(fp, YY_BUF_SIZE)); > + yyfile = fname; > + yyline = 0; > + return (0); > +} > + > +/* > + * Terminate the most recent inclusion. > + */ > +static int > +endinclude() > +{ > + struct incl *in; > + int ateof; > + > + in = inclp; > + assert(in != NULL); > + inclp = in->in_prev; > + lastfile = yyfile; > + yy_delete_buffer(YY_CURRENT_BUFFER); > + (void)fclose(yyin); > + yy_switch_to_buffer(in->in_buf); > + yyfile = in->in_fname; > + yyline = in->in_lineno; > + ateof = in->in_ateof; > + free(in); > + > + return (ateof); > } > Index: main.c > =================================================================== > RCS file: /stl/src/FreeBSD/src/usr.sbin/config/main.c,v > retrieving revision 1.50 > diff -u -r1.50 main.c > --- main.c 2001/02/23 00:22:04 1.50 > +++ main.c 2001/06/28 05:51:11 > @@ -144,6 +144,7 @@ > errx(2, "%s isn't a directory", p); > > dtab = NULL; > + yyfile = *argv; > if (yyparse()) > exit(3); > if (machinename == NULL) { To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Jul 5 13:53:39 2001 Delivered-To: freebsd-audit@freebsd.org Received: from coffee.q9media.com (coffee.q9media.com [216.94.229.19]) by hub.freebsd.org (Postfix) with ESMTP id ECC2437B401 for ; Thu, 5 Jul 2001 13:53:34 -0700 (PDT) (envelope-from mike@coffee.q9media.com) Received: (from mike@localhost) by coffee.q9media.com (8.11.2/8.11.2) id f65L8Do10449; Thu, 5 Jul 2001 17:08:13 -0400 (EDT) (envelope-from mike) Date: Thu, 5 Jul 2001 17:08:13 -0400 (EDT) Message-Id: <200107052108.f65L8Do10449@coffee.q9media.com> To: audit@FreeBSD.org From: Mike Barcroft Subject: src/sbin/shutdown patch Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I would appreciate it if someone would review and commit the patch at the end of this message. Also available at: http://testbed.q9media.net/freebsd/shutdown.20010705.patch Best regards, Mike Barcroft ----------------------------------------------------------------------- shutdown.20010705.patch o Mark unused variables o Constify o Remove register storage-classes o Fix some comparison between signed and unsigned warnings o Set WARNS?=2 o Untested on Alpha Index: shutdown/Makefile =================================================================== RCS file: /home/ncvs/src/sbin/shutdown/Makefile,v retrieving revision 1.5 diff -u -r1.5 Makefile --- shutdown/Makefile 2001/03/26 14:33:23 1.5 +++ shutdown/Makefile 2001/07/05 20:46:14 @@ -2,6 +2,7 @@ # $FreeBSD: src/sbin/shutdown/Makefile,v 1.5 2001/03/26 14:33:23 ru Exp $ PROG= shutdown +WARNS?= 2 MAN= shutdown.8 BINGRP= operator BINMODE=4550 Index: shutdown/shutdown.c =================================================================== RCS file: /home/ncvs/src/sbin/shutdown/shutdown.c,v retrieving revision 1.21 diff -u -r1.21 shutdown.c --- shutdown/shutdown.c 1999/08/28 00:14:24 1.21 +++ shutdown/shutdown.c 2001/07/05 20:46:14 @@ -94,7 +94,8 @@ static time_t offset, shuttime; static int dohalt, dopower, doreboot, killflg, mbuflen, oflag; -static char *nosync, *whom, mbuf[BUFSIZ]; +static char mbuf[BUFSIZ]; +static const char *nosync, *whom; void badtime __P((void)); void die_you_gravy_sucking_pig_dog __P((void)); @@ -111,7 +112,7 @@ int argc; char *argv[]; { - register char *p, *endp; + char *p, *endp; struct passwd *pw; int arglen, ch, len, readstdin; @@ -247,7 +248,7 @@ * the next wait time. */ if ((sltime = offset - tp->timeleft)) { - if (sltime > tp->timetowait / 5) + if (sltime > (u_int)(tp->timetowait / 5)) timewarn(offset); (void)sleep(sltime); } @@ -267,7 +268,7 @@ static jmp_buf alarmbuf; -static char *restricted_environ[] = { +static const char *restricted_environ[] = { "PATH=" _PATH_STDPATH, NULL }; @@ -280,7 +281,7 @@ static char hostname[MAXHOSTNAMELEN + 1]; FILE *pf; char wcmd[MAXPATHLEN + 4]; - extern char **environ; + extern const char **environ; if (!first++) (void)gethostname(hostname, sizeof(hostname)); @@ -326,7 +327,7 @@ void timeout(signo) - int signo; + int signo __unused; { longjmp(alarmbuf, 1); } @@ -394,10 +395,10 @@ void getoffset(timearg) - register char *timearg; + char *timearg; { - register struct tm *lt; - register char *p; + struct tm *lt; + char *p; time_t now; int this_year; @@ -500,7 +501,7 @@ void finish(signo) - int signo; + int signo __unused; { if (!killflg) (void)unlink(_PATH_NOLOGIN); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Jul 5 16:14:44 2001 Delivered-To: freebsd-audit@freebsd.org Received: from coffee.q9media.com (coffee.q9media.com [216.94.229.19]) by hub.freebsd.org (Postfix) with ESMTP id 99B4D37B401 for ; Thu, 5 Jul 2001 16:14:41 -0700 (PDT) (envelope-from mike@coffee.q9media.com) Received: (from mike@localhost) by coffee.q9media.com (8.11.2/8.11.2) id f65NTL110566; Thu, 5 Jul 2001 19:29:21 -0400 (EDT) (envelope-from mike) Date: Thu, 5 Jul 2001 19:29:21 -0400 (EDT) Message-Id: <200107052329.f65NTL110566@coffee.q9media.com> To: audit@FreeBSD.org From: Mike Barcroft Subject: src/sbin/reboot patch Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I would appreciate it if someone would review and commit the patch at the end of this message. Also available at: http://testbed.q9media.net/freebsd/reboot.20010705.patch Best regards, Mike Barcroft ----------------------------------------------------------------------- reboot.20010705.patch o Consify o Set WARNS?=2 o Untest on Alpha Index: reboot/Makefile =================================================================== RCS file: /home/ncvs/src/sbin/reboot/Makefile,v retrieving revision 1.7 diff -u -r1.7 Makefile --- reboot/Makefile 2001/03/26 14:33:21 1.7 +++ reboot/Makefile 2001/07/05 23:12:04 @@ -2,6 +2,7 @@ # $FreeBSD: src/sbin/reboot/Makefile,v 1.7 2001/03/26 14:33:21 ru Exp $ PROG= reboot +WARNS?= 2 DPADD= ${LIBUTIL} LDADD= -lutil MAN= reboot.8 boot_i386.8 Index: reboot/reboot.c =================================================================== RCS file: /home/ncvs/src/sbin/reboot/reboot.c,v retrieving revision 1.12 diff -u -r1.12 reboot.c --- reboot/reboot.c 2001/06/24 23:04:18 1.12 +++ reboot/reboot.c 2001/07/05 23:12:05 @@ -70,7 +70,8 @@ struct passwd *pw; int ch, howto, i, lflag, nflag, qflag, pflag, sverrno; u_int pageins; - char *p, *user; + char *p; + const char *user; if (strstr((p = rindex(*argv, '/')) ? p + 1 : *argv, "halt")) { dohalt = 1; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Jul 5 17:44:16 2001 Delivered-To: freebsd-audit@freebsd.org Received: from relay.nuxi.com (nuxi.cs.ucdavis.edu [169.237.7.38]) by hub.freebsd.org (Postfix) with ESMTP id AB13837B406; Thu, 5 Jul 2001 17:44:12 -0700 (PDT) (envelope-from obrien@nuxi.ucdavis.edu) Received: from dragon.nuxi.com (root@trang.muxi.com [206.40.252.115] (may be forged)) by relay.nuxi.com (8.11.2/8.11.2) with ESMTP id f660iBR06663; Thu, 5 Jul 2001 17:44:11 -0700 (PDT) (envelope-from obrien@NUXI.com) Received: (from obrien@localhost) by dragon.nuxi.com (8.11.3/8.11.1) id f660iAB15217; Thu, 5 Jul 2001 17:44:10 -0700 (PDT) (envelope-from obrien) Date: Thu, 5 Jul 2001 17:44:10 -0700 From: "David O'Brien" To: Peter Pentchev Cc: arch@FreeBSD.org, audit@FreeBSD.org Subject: Re: A slight improvement of the rc system Message-ID: <20010705174409.A15136@dragon.nuxi.com> Reply-To: obrien@FreeBSD.org References: <20010704124334.F653@ringworld.oblivion.bg> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010704124334.F653@ringworld.oblivion.bg>; from roam@orbitel.bg on Wed, Jul 04, 2001 at 12:43:34PM +0300 X-Operating-System: FreeBSD 5.0-CURRENT Organization: The NUXI BSD group X-Pgp-Rsa-Fingerprint: B7 4D 3E E9 11 39 5F A3 90 76 5D 69 58 D9 98 7A X-Pgp-Rsa-Keyid: 1024/34F9F9D5 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, Jul 04, 2001 at 12:43:34PM +0300, Peter Pentchev wrote: > +script_name_sep=" " # Change if your startup scripts' names contain spaces Uh... ever heard of "over engineering"? I think we can assume scripts don't have spaces in their names. Anyone trying and has the ability to change this knob knows enought to just not use spaces in a script's name. This is UNIX. -- -- David (obrien@FreeBSD.org) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Jul 5 17:51:14 2001 Delivered-To: freebsd-audit@freebsd.org Received: from mass.dis.org (dhcp44-21.dis.org [216.240.44.21]) by hub.freebsd.org (Postfix) with ESMTP id 80BA337B406; Thu, 5 Jul 2001 17:51:10 -0700 (PDT) (envelope-from msmith@mass.dis.org) Received: from mass.dis.org (localhost [127.0.0.1]) by mass.dis.org (8.11.4/8.11.3) with ESMTP id f6614Y903847; Thu, 5 Jul 2001 18:04:34 -0700 (PDT) (envelope-from msmith@mass.dis.org) Message-Id: <200107060104.f6614Y903847@mass.dis.org> X-Mailer: exmh version 2.1.1 10/15/1999 To: obrien@FreeBSD.org Cc: Peter Pentchev , arch@FreeBSD.org, audit@FreeBSD.org Subject: Re: A slight improvement of the rc system In-reply-to: Your message of "Thu, 05 Jul 2001 17:44:10 PDT." <20010705174409.A15136@dragon.nuxi.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 05 Jul 2001 18:04:34 -0700 From: Mike Smith Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > On Wed, Jul 04, 2001 at 12:43:34PM +0300, Peter Pentchev wrote: > > +script_name_sep=" " # Change if your startup scripts' names contain > spaces > > Uh... ever heard of "over engineering"? I think we can assume scripts > don't have spaces in their names. Anyone trying and has the ability to > change this knob knows enought to just not use spaces in a script's name. > This is UNIX. Actually, anyone writing code to parse a set of filenames knows better than to assume that filenames don't contain spaces. 8) -- ... every activity meets with opposition, everyone who acts has his rivals and unfortunately opponents also. But not because people want to be opponents, rather because the tasks and relationships force people to take different points of view. [Dr. Fritz Todt] V I C T O R Y N O T V E N G E A N C E To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Jul 5 20: 3:57 2001 Delivered-To: freebsd-audit@freebsd.org Received: from iatl0x01.coxmail.com (iatl0x02.coxmail.com [206.157.225.11]) by hub.freebsd.org (Postfix) with ESMTP id B7E2437B405 for ; Thu, 5 Jul 2001 20:03:52 -0700 (PDT) (envelope-from mheffner@novacoxmail.com) Received: from enterprise.muriel.penguinpowered.com ([208.138.198.178]) by iatl0x01.coxmail.com (InterMail vK.4.03.02.00 201-232-124 license 85f4f10023be2bd3bce00b3a38363ea2) with ESMTP id <20010706030317.EYM1279.iatl0x01@enterprise.muriel.penguinpowered.com> for ; Thu, 5 Jul 2001 23:03:17 -0400 Message-ID: X-Mailer: XFMail 1.5.0 on FreeBSD X-Priority: 3 (Normal) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="_=XFMail.1.5.0.FreeBSD:20010705230237:33483=_"; micalg=pgp-md5; protocol="application/pgp-signature" Date: Thu, 05 Jul 2001 23:02:37 -0400 (EDT) Reply-To: Mike Heffner From: Mike Heffner To: FreeBSD-audit Subject: Teach tmpfile(3) about TMPDIR Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This message is in MIME format --_=XFMail.1.5.0.FreeBSD:20010705230237:33483=_ Content-Type: text/plain; charset=us-ascii This patch was inspired by bin/16924. It makes tmpfile(3) attempt to use the TMPDIR environment variable, falling back to '/tmp'. The patch is slightly different from the one in the PR, but I think this might be a little cleaner way of doing it. Note, the patch adds an extra failure point--the case of malloc(3) failing. However, since fdopen(3) is specified as a fail point for tmpfile(3) and fdopen(3) can also fail due to malloc(3), I don't think this is a problem. Please review, and see the PR for discussion. Mike -- Mike Heffner Fredericksburg, VA Also at: http://people.freebsd.org/~mikeh/diffs/tmpfile.diff Index: tmpfile.c =================================================================== RCS file: /home/ncvs/src/lib/libc/stdio/tmpfile.c,v retrieving revision 1.5 diff -u -r1.5 tmpfile.c --- tmpfile.c 2001/01/24 13:00:47 1.5 +++ tmpfile.c 2001/07/06 02:37:52 @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include "un-namespace.h" @@ -57,17 +58,30 @@ FILE *fp; int fd, sverrno; #define TRAILER "tmp.XXXXXX" - char buf[sizeof(_PATH_TMP) + sizeof(TRAILER)]; + char *buf; + const char *tmpdir; + size_t tmpdirlen; - (void)memcpy(buf, _PATH_TMP, sizeof(_PATH_TMP) - 1); - (void)memcpy(buf + sizeof(_PATH_TMP) - 1, TRAILER, sizeof(TRAILER)); + tmpdir = getenv("TMPDIR"); + if (tmpdir == NULL) + tmpdir = _PATH_TMP; + tmpdirlen = strlen(tmpdir); + buf = malloc(tmpdirlen + (tmpdir[tmpdirlen - 1] == '/') ? 0 : 1 + + sizeof(TRAILER)); + if (buf == NULL) + return NULL; + (void)sprintf(buf, "%s%s%s", tmpdir, + (tmpdir[tmpdirlen - 1] == '/') ? "" : "/", TRAILER); + sigfillset(&set); (void)_sigprocmask(SIG_BLOCK, &set, &oset); fd = mkstemp(buf); if (fd != -1) (void)unlink(buf); + + free(buf); (void)_sigprocmask(SIG_SETMASK, &oset, NULL); Index: tmpnam.3 =================================================================== RCS file: /home/ncvs/src/lib/libc/stdio/tmpnam.3,v retrieving revision 1.7 diff -u -r1.7 tmpnam.3 --- tmpnam.3 2001/02/26 13:21:16 1.7 +++ tmpnam.3 2001/07/06 02:37:52 @@ -67,6 +67,12 @@ reference to it is closed. The file is opened with the access value .Ql w+ . +The file is created in the directory determined by the environment variable +.Ev TMPDIR +if set. The default location if +.Ev TMPDIR +is not set is +.Pa /tmp . .Pp The .Fn tmpnam --_=XFMail.1.5.0.FreeBSD:20010705230237:33483=_ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) Comment: For info see http://www.gnupg.org iD8DBQE7RSpMFokZQs3sv5kRAkdJAJwO4j6b4vgJH9DsLvnIwuhA9Ec/8wCgmXIF FDH4AKEpTYg9Wy7AOl9fnrk= =ziRi -----END PGP SIGNATURE----- --_=XFMail.1.5.0.FreeBSD:20010705230237:33483=_-- End of MIME message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Jul 5 20:50:23 2001 Delivered-To: freebsd-audit@freebsd.org Received: from coffee.q9media.com (coffee.q9media.com [216.94.229.19]) by hub.freebsd.org (Postfix) with ESMTP id 8FA6037B40E for ; Thu, 5 Jul 2001 20:50:21 -0700 (PDT) (envelope-from mike@coffee.q9media.com) Received: (from mike@localhost) by coffee.q9media.com (8.11.2/8.11.2) id f66451H10795; Fri, 6 Jul 2001 00:05:01 -0400 (EDT) (envelope-from mike) Date: Fri, 6 Jul 2001 00:05:01 -0400 (EDT) Message-Id: <200107060405.f66451H10795@coffee.q9media.com> To: Mike Heffner From: Mike Barcroft Cc: audit@FreeBSD.org Subject: Re: Teach tmpfile(3) about TMPDIR Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Mike Heffner writes: [...] + buf = malloc(tmpdirlen + (tmpdir[tmpdirlen - 1] == '/') ? 0 : 1 + + sizeof(TRAILER)); + if (buf == NULL) + return NULL; + (void)sprintf(buf, "%s%s%s", tmpdir, + (tmpdir[tmpdirlen - 1] == '/') ? "" : "/", TRAILER); [...] Why not use asprintf(3) instead? Like: (void)asprintf(&buf, "%s%s%s", tmpdir, (tmpdir[strlen(tmpdir) - 1] == '/') ? "" : "/", TRAILER); if (buf == NULL) return NULL; Best regards, Mike Barcroft To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Jul 5 23:22: 2 2001 Delivered-To: freebsd-audit@freebsd.org Received: from ringworld.nanolink.com (ringworld.nanolink.com [195.24.48.13]) by hub.freebsd.org (Postfix) with SMTP id 99FE337B406 for ; Thu, 5 Jul 2001 23:21:57 -0700 (PDT) (envelope-from roam@orbitel.bg) Received: (qmail 3838 invoked by uid 1000); 6 Jul 2001 06:26:24 -0000 Date: Fri, 6 Jul 2001 09:26:24 +0300 From: Peter Pentchev To: David O'Brien Cc: arch@FreeBSD.org, audit@FreeBSD.org Subject: Re: A slight improvement of the rc system Message-ID: <20010706092624.A3782@ringworld.oblivion.bg> Mail-Followup-To: David O'Brien , arch@FreeBSD.org, audit@FreeBSD.org References: <20010704124334.F653@ringworld.oblivion.bg> <20010705174409.A15136@dragon.nuxi.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010705174409.A15136@dragon.nuxi.com>; from obrien@FreeBSD.org on Thu, Jul 05, 2001 at 05:44:10PM -0700 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Thu, Jul 05, 2001 at 05:44:10PM -0700, David O'Brien wrote: > On Wed, Jul 04, 2001 at 12:43:34PM +0300, Peter Pentchev wrote: > > +script_name_sep=" " # Change if your startup scripts' names contain spaces > > Uh... ever heard of "over engineering"? I think we can assume scripts > don't have spaces in their names. Anyone trying and has the ability to > change this knob knows enought to just not use spaces in a script's name. > This is UNIX. Yep, this is Unix, and Unix has no arbitrary restrictions on filenames. It does not have a 8.3 restriction, or a caps-only restriction; so why should a *part* of the system place a no-spaces restriction on filenames? Just about all the filesystems supported by FreeBSD allow filenames to contain spaces; it's only logical to give the user the ability to use them, if she so desires. It's not overcomplicating the code, either - the IFS shell variable is standardized and used, which means that the shell was written with this in mind; not allowing it is just that - not using the shell's capabilities the way they were meant to be used. G'luck, Peter -- I am jealous of the first word in this sentence. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Fri Jul 6 1:56:33 2001 Delivered-To: freebsd-audit@freebsd.org Received: from ringworld.nanolink.com (sentinel.office1.bg [195.24.48.182]) by hub.freebsd.org (Postfix) with SMTP id 83E1137B408 for ; Fri, 6 Jul 2001 01:56:23 -0700 (PDT) (envelope-from roam@orbitel.bg) Received: (qmail 1052 invoked by uid 1000); 6 Jul 2001 09:00:49 -0000 Date: Fri, 6 Jul 2001 12:00:49 +0300 From: Peter Pentchev To: arch@FreeBSD.org Cc: audit@FreeBSD.org Subject: [Fwd: Re: kern/26317: /modules not created by make installkernel] Message-ID: <20010706120049.A590@ringworld.oblivion.bg> Mail-Followup-To: arch@FreeBSD.org, audit@FreeBSD.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi, Anybody see how much harm can come if this patch is committed? It does really solve a possible problem - a removed /modules dir - by interrupting the installworld process instead of happily installing the last module into a file named /modules. G'luck, Peter -- Nostalgia ain't what it used to be. ----- Forwarded message from Gregory Bond ----- Date: Sun, 8 Apr 2001 17:10:02 -0700 (PDT) To: freebsd-bugs@FreeBSD.org Cc: From: Gregory Bond Subject: Re: kern/26317: /modules not created by make installkernel Reply-To: Gregory Bond The following reply was made to PR kern/26317; it has been noted by GNATS. From: Gregory Bond To: David Taylor Cc: freebsd-gnats-submit@FreeBSD.ORG Subject: Re: kern/26317: /modules not created by make installkernel Date: Mon, 09 Apr 2001 10:03:24 +1000 This is a multipart MIME message. --==_Exmh_8133331360 Content-Type: text/plain; charset=us-ascii > It should at least bomb out with an error message, instead of pretending it > succesfully installed your kernel and modules, even though what it > _actually_ did was install one module as '/modules'... A simple patch to achieve this is attached. (I.e. install into /modules/ rather than /modules to force the error to be trapped.) --==_Exmh_8133331360 Content-Type: text/plain ; name="patch"; charset=us-ascii Content-Description: patch Content-Disposition: attachment; filename="patch" Index: kmod.mk =================================================================== RCS file: /usr/ncvs/src/sys/conf/kmod.mk,v retrieving revision 1.82.2.5 diff -u -r1.82.2.5 kmod.mk --- kmod.mk 2001/03/05 06:14:21 1.82.2.5 +++ kmod.mk 2001/04/08 23:59:26 @@ -217,7 +217,7 @@ realinstall: _SUBDIR ${INSTALL} ${COPY} -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \ - ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${KMODDIR} + ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${KMODDIR}/ .if defined(LINKS) && !empty(LINKS) @set ${LINKS}; \ while test $$# -ge 2; do \ --==_Exmh_8133331360-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message ----- End forwarded message ----- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Fri Jul 6 8:50:30 2001 Delivered-To: freebsd-audit@freebsd.org Received: from coffee.q9media.com (coffee.q9media.com [216.94.229.19]) by hub.freebsd.org (Postfix) with ESMTP id 618EF37B406; Fri, 6 Jul 2001 08:50:25 -0700 (PDT) (envelope-from mike@coffee.q9media.com) Received: (from mike@localhost) by coffee.q9media.com (8.11.2/8.11.2) id f66G5C611666; Fri, 6 Jul 2001 12:05:12 -0400 (EDT) (envelope-from mike) Date: Fri, 6 Jul 2001 12:05:12 -0400 (EDT) Message-Id: <200107061605.f66G5C611666@coffee.q9media.com> To: audit@FreeBSD.org From: Mike Barcroft Cc: mckusick@FreeBSD.org Subject: src/sbin/tunefs patch Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I would appreciate it if someone would review and commit the patch at the end of this message. Also available at: http://testbed.q9media.net/freebsd/tunefs.20010706.patch Best regards, Mike Barcroft ----------------------------------------------------------------------- tunefs.20010706.patch o Constify o Remove register storage-classes o Set WARNS?=2 o Untested on Alpha Index: tunefs/Makefile =================================================================== RCS file: /home/ncvs/src/sbin/tunefs/Makefile,v retrieving revision 1.4 diff -u -r1.4 Makefile --- tunefs/Makefile 2001/03/26 14:33:26 1.4 +++ tunefs/Makefile 2001/07/06 15:33:35 @@ -2,6 +2,7 @@ # $FreeBSD: src/sbin/tunefs/Makefile,v 1.4 2001/03/26 14:33:26 ru Exp $ PROG= tunefs +WARNS?= 2 MAN= tunefs.8 .include Index: tunefs/tunefs.c =================================================================== RCS file: /home/ncvs/src/sbin/tunefs/tunefs.c,v retrieving revision 1.17 diff -u -r1.17 tunefs.c --- tunefs/tunefs.c 2001/04/13 23:54:49 1.17 +++ tunefs/tunefs.c 2001/07/06 15:33:35 @@ -76,10 +76,10 @@ int fi; long dev_bsize = 1; -void bwrite __P((daddr_t, char *, int)); +void bwrite __P((daddr_t, const char *, int)); int bread __P((daddr_t, char *, int)); -void getsb __P((struct fs *, char *)); -void putsb __P((struct fs *, char *, int)); +void getsb __P((struct fs *, const char *)); +void putsb __P((struct fs *, const char *, int)); void usage __P((void)); void printfs __P((void)); @@ -88,7 +88,8 @@ int argc; char *argv[]; { - char *special, *name; + char *special; + const char *name; struct stat st; int Aflag = 0, active = 0; int aflag = 0, dflag = 0, eflag = 0, fflag = 0, mflag = 0; @@ -97,7 +98,8 @@ int mvalue = 0, ovalue = 0, svalue = 0; char *nvalue = NULL; struct fstab *fs; - char *chg[2], device[MAXPATHLEN]; + const char *chg[2]; + char device[MAXPATHLEN]; struct ufs_args args; struct statfs stfs; int found_arg, ch; @@ -357,8 +359,8 @@ void getsb(fs, file) - register struct fs *fs; - char *file; + struct fs *fs; + const char *file; { fi = open(file, O_RDONLY); @@ -373,8 +375,8 @@ void putsb(fs, file, all) - register struct fs *fs; - char *file; + struct fs *fs; + const char *file; int all; { int i; @@ -389,11 +391,11 @@ close(i); if (fi < 0) err(3, "cannot open %s", file); - bwrite((daddr_t)SBOFF / dev_bsize, (char *)fs, SBSIZE); + bwrite((daddr_t)SBOFF / dev_bsize, (const char *)fs, SBSIZE); if (all) for (i = 0; i < fs->fs_ncg; i++) bwrite(fsbtodb(fs, cgsblock(fs, i)), - (char *)fs, SBSIZE); + (const char *)fs, SBSIZE); close(fi); } @@ -427,7 +429,7 @@ void bwrite(blk, buf, size) daddr_t blk; - char *buf; + const char *buf; int size; { To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Fri Jul 6 16: 2:36 2001 Delivered-To: freebsd-audit@freebsd.org Received: from iatl0x01.coxmail.com (iatl0x02.coxmail.com [206.157.225.11]) by hub.freebsd.org (Postfix) with ESMTP id 2A7BB37B405 for ; Fri, 6 Jul 2001 16:02:32 -0700 (PDT) (envelope-from mheffner@novacoxmail.com) Received: from enterprise.muriel.penguinpowered.com ([208.138.198.178]) by iatl0x01.coxmail.com (InterMail vK.4.03.02.00 201-232-124 license 85f4f10023be2bd3bce00b3a38363ea2) with ESMTP id <20010706230157.VVH25345.iatl0x01@enterprise.muriel.penguinpowered.com>; Fri, 6 Jul 2001 19:01:57 -0400 Message-ID: X-Mailer: XFMail 1.5.0 on FreeBSD X-Priority: 3 (Normal) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="_=XFMail.1.5.0.FreeBSD:20010706190127:70043=_"; micalg=pgp-md5; protocol="application/pgp-signature" In-Reply-To: <200107060405.f66451H10795@coffee.q9media.com> Date: Fri, 06 Jul 2001 19:01:27 -0400 (EDT) Reply-To: Mike Heffner From: Mike Heffner To: Mike Barcroft Subject: Re: Teach tmpfile(3) about TMPDIR Cc: audit@FreeBSD.org Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This message is in MIME format --_=XFMail.1.5.0.FreeBSD:20010706190127:70043=_ Content-Type: text/plain; charset=us-ascii On 06-Jul-2001 Mike Barcroft wrote: | Mike Heffner writes: | [...] | + buf = malloc(tmpdirlen + (tmpdir[tmpdirlen - 1] == '/') ? 0 : 1 + | + sizeof(TRAILER)); | + if (buf == NULL) | + return NULL; | + (void)sprintf(buf, "%s%s%s", tmpdir, | + (tmpdir[tmpdirlen - 1] == '/') ? "" : "/", TRAILER); | [...] | | Why not use asprintf(3) instead? Like: | (void)asprintf(&buf, "%s%s%s", tmpdir, | (tmpdir[strlen(tmpdir) - 1] == '/') ? "" : "/", TRAILER); | if (buf == NULL) | return NULL; No real reason. I was a little unsure on what errno was set to, if at all, on failure (printf(3) doesn't really state anything), but looking at the code it looks like it'll only return ENOMEM, so it's probably safe to use. Mike -- Mike Heffner Fredericksburg, VA --_=XFMail.1.5.0.FreeBSD:20010706190127:70043=_ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) Comment: For info see http://www.gnupg.org iD8DBQE7RkNGFokZQs3sv5kRAiZKAJ9d7aKouME/+wONsySxUt4m4A37LgCePhCg jYm8OJS7Na5K2JtOnP4y3mw= =a4WU -----END PGP SIGNATURE----- --_=XFMail.1.5.0.FreeBSD:20010706190127:70043=_-- End of MIME message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message