From owner-freebsd-audit Mon Dec 3 13:56: 4 2001 Delivered-To: freebsd-audit@freebsd.org Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by hub.freebsd.org (Postfix) with SMTP id AED5837B416; Mon, 3 Dec 2001 13:55:55 -0800 (PST) Received: from astro.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 3 Dec 2001 21:55:54 +0000 (GMT) To: audit@freebsd.org Cc: markm@freebsd.org Subject: Warns for tcopy and wc. X-Request-Do: Date: Mon, 03 Dec 2001 21:55:54 +0000 From: David Malone Message-ID: <200112032155.aa79655@salmon.maths.tcd.ie> 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 have warns patches for tcopy and wc, but they run into the following problems. 1) If people want to count something big then they often use int64_t. Unfortunately these are defined in terms of different types on the alpha and i386 (long and long long respectively). This means that printfing these requires a cast, so in some cases it seems to make more sense to just use a long long (which C99 says is at least 64 bits). 2) As far as I know, %qd is for printing quat_t and %lld is for printing long longs. Unfortunately our gcc doesn't seem to know this and thinks that %qd is for printing long longs. Until this is fixed it means that quad_t's are as hard to print as int64_t. 'cos of these two problems, I arrived at the following patches which use long longs in preference to either quad_t or int64_t. Any comments on if this should be committed? David. Index: tcopy/Makefile =================================================================== RCS file: /home/ncvs/src/usr.bin/tcopy/Makefile,v retrieving revision 1.1.1.1 diff -u -u -r1.1.1.1 Makefile --- tcopy/Makefile 27 May 1994 12:32:47 -0000 1.1.1.1 +++ tcopy/Makefile 3 Dec 2001 20:54:29 -0000 @@ -1,5 +1,6 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 PROG= tcopy +WARNS?= 2 .include Index: tcopy/tcopy.c =================================================================== RCS file: /home/ncvs/src/usr.bin/tcopy/tcopy.c,v retrieving revision 1.9 diff -u -u -r1.9 tcopy.c --- tcopy/tcopy.c 13 Aug 2001 21:58:16 -0000 1.9 +++ tcopy/tcopy.c 3 Dec 2001 21:44:29 -0000 @@ -64,7 +64,7 @@ #define NOCOUNT (-2) int filen, guesslen, maxblk = MAXREC; -u_int64_t lastrec, record, size, tsize; +unsigned long long lastrec, record, size, tsize; FILE *msg; void *getspace __P((int)); @@ -83,7 +83,8 @@ enum {READ, VERIFY, COPY, COPYVERIFY} op = READ; sig_t oldsig; int ch, needeof; - char *buff, *inf; + char *buff; + const char *inf; msg = stdout; guesslen = 1; @@ -157,16 +158,16 @@ if (nread >= 0) goto r1; } - err(1, "read error, file %d, record %qu", filen, record); + err(1, "read error, file %d, record %llu", filen, record); } else if (nread != lastnread) { if (lastnread != 0 && lastnread != NOCOUNT) { if (lastrec == 0 && nread == 0) - fprintf(msg, "%qu records\n", record); + fprintf(msg, "%llu records\n", record); else if (record - lastrec > 1) - fprintf(msg, "records %qu to %qu\n", + fprintf(msg, "records %llu to %llu\n", lastrec, record); else - fprintf(msg, "record %qu\n", lastrec); + fprintf(msg, "record %llu\n", lastrec); } if (nread != 0) fprintf(msg, "file %d: block size %d: ", @@ -184,9 +185,9 @@ nw = write(outp, buff, nread); if (nw != nread) { if (nw == -1) { - warn("write error, file %d, record %qu", filen, record); + warn("write error, file %d, record %llu", filen, record); } else { - warnx("write error, file %d, record %qu", filen, record); + warnx("write error, file %d, record %llu", filen, record); warnx("write (%d) != read (%d)", nw, nread); } errx(5, "copy aborted"); @@ -200,7 +201,7 @@ break; } fprintf(msg, - "file %d: eof after %qu records: %qu bytes\n", + "file %d: eof after %llu records: %llu bytes\n", filen, record, size); needeof = 1; filen++; @@ -210,7 +211,7 @@ } lastnread = nread; } - fprintf(msg, "total length: %qu bytes\n", tsize); + fprintf(msg, "total length: %llu bytes\n", tsize); (void)signal(SIGINT, oldsig); if (op == COPY || op == COPYVERIFY) { writeop(outp, MTWEOF); @@ -280,16 +281,16 @@ void intr(signo) - int signo; + int signo __unused; { if (record) { if (record - lastrec > 1) - fprintf(msg, "records %qu to %qu\n", lastrec, record); + fprintf(msg, "records %llu to %llu\n", lastrec, record); else - fprintf(msg, "record %qu\n", lastrec); + fprintf(msg, "record %llu\n", lastrec); } - fprintf(msg, "interrupt at file %d: record %qu\n", filen, record); - fprintf(msg, "total length: %ld bytes\n", tsize + size); + fprintf(msg, "interrupt at file %d: record %llu\n", filen, record); + fprintf(msg, "total length: %lld bytes\n", tsize + size); exit(1); } Index: wc/Makefile =================================================================== RCS file: /home/ncvs/src/usr.bin/wc/Makefile,v retrieving revision 1.1.1.1 diff -u -u -r1.1.1.1 Makefile --- wc/Makefile 27 May 1994 12:33:28 -0000 1.1.1.1 +++ wc/Makefile 3 Dec 2001 20:54:29 -0000 @@ -1,5 +1,6 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 PROG= wc +WARNS?= 2 .include Index: wc/wc.c =================================================================== RCS file: /home/ncvs/src/usr.bin/wc/wc.c,v retrieving revision 1.11 diff -u -u -r1.11 wc.c --- wc/wc.c 28 Aug 1999 01:07:34 -0000 1.11 +++ wc/wc.c 3 Dec 2001 20:54:29 -0000 @@ -58,10 +58,10 @@ #include #include -u_quad_t tlinect, twordct, tcharct; +unsigned long long tlinect, twordct, tcharct; int doline, doword, dochar; -int cnt __P((char *)); +int cnt __P((const char *)); void usage __P((void)); int @@ -113,11 +113,11 @@ if (total > 1) { if (doline) - (void)printf(" %7qu", tlinect); + (void)printf(" %7llu", tlinect); if (doword) - (void)printf(" %7qu", twordct); + (void)printf(" %7llu", twordct); if (dochar) - (void)printf(" %7qu", tcharct); + (void)printf(" %7llu", tcharct); (void)printf(" total\n"); } exit(errors == 0 ? 0 : 1); @@ -125,10 +125,10 @@ int cnt(file) - char *file; + const char *file; { struct stat sb; - u_quad_t linect, wordct, charct; + unsigned long long linect, wordct, charct; int fd, len; short gotsp; u_char *p; @@ -163,10 +163,10 @@ ++linect; } tlinect += linect; - (void)printf(" %7qu", linect); + (void)printf(" %7llu", linect); if (dochar) { tcharct += charct; - (void)printf(" %7qu", charct); + (void)printf(" %7llu", charct); } (void)close(fd); return (0); @@ -217,15 +217,15 @@ } if (doline) { tlinect += linect; - (void)printf(" %7qu", linect); + (void)printf(" %7llu", linect); } if (doword) { twordct += wordct; - (void)printf(" %7qu", wordct); + (void)printf(" %7llu", wordct); } if (dochar) { tcharct += charct; - (void)printf(" %7qu", charct); + (void)printf(" %7llu", charct); } (void)close(fd); return (0); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon Dec 3 18:55:55 2001 Delivered-To: freebsd-audit@freebsd.org Received: from espresso.q9media.com (espresso.q9media.com [216.254.138.122]) by hub.freebsd.org (Postfix) with ESMTP id 30A0437B405; Mon, 3 Dec 2001 18:55:52 -0800 (PST) Received: (from mike@localhost) by espresso.q9media.com (8.11.6/8.11.6) id fB42sqv58749; Mon, 3 Dec 2001 21:54:52 -0500 (EST) (envelope-from mike) Date: Mon, 3 Dec 2001 21:54:52 -0500 From: Mike Barcroft To: David Malone Cc: audit@freebsd.org, markm@freebsd.org Subject: Re: Warns for tcopy and wc. Message-ID: <20011203215452.E57237@espresso.q9media.com> References: <200112032155.aa79655@salmon.maths.tcd.ie> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200112032155.aa79655@salmon.maths.tcd.ie>; from dwmalone@maths.tcd.ie on Mon, Dec 03, 2001 at 09:55:54PM +0000 Organization: The FreeBSD Project 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 David Malone writes: > I have warns patches for tcopy and wc, but they run into the > following problems. > > 1) If people want to count something big then they often > use int64_t. Unfortunately these are defined in terms of > different types on the alpha and i386 (long and long long > respectively). This means that printfing these requires > a cast, so in some cases it seems to make more sense to > just use a long long (which C99 says is at least 64 bits). Consider using intmax_t and the printf(3) modifier %j (or the unsigned variant). > 2) As far as I know, %qd is for printing quat_t and %lld > is for printing long longs. Unfortunately our gcc doesn't > seem to know this and thinks that %qd is for printing long > longs. Until this is fixed it means that quad_t's are as > hard to print as int64_t. The quad_t type is deprecated; use something else. 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 Dec 4 5:41:14 2001 Delivered-To: freebsd-audit@freebsd.org Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by hub.freebsd.org (Postfix) with SMTP id D502837B41B; Tue, 4 Dec 2001 05:41:10 -0800 (PST) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 4 Dec 2001 13:41:10 +0000 (GMT) To: Mike Barcroft Cc: audit@freebsd.org, markm@freebsd.org, Bruce Evans Subject: Re: Warns for tcopy and wc. In-reply-to: Your message of "Mon, 03 Dec 2001 21:54:52 EST." <20011203215452.E57237@espresso.q9media.com> X-Request-Do: Date: Tue, 04 Dec 2001 13:41:07 +0000 From: David Malone Message-ID: <200112041341.aa05762@salmon.maths.tcd.ie> 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 Tue, Dec 04, 2001 at 12:51:25PM +1100, Bruce Evans wrote: bde> %ll should not be used to print typedefed types after this. mike> Consider using intmax_t and the printf(3) modifier %j (or the unsigned mike> variant). I presume casting to intmax_t will be the oficially blessed way of printing typedefed things now? If so we should make gcc's format warning code understand the %j modifier - maybe I should look into that (or maybe some of the FreeBSD standards people are doing that?). Is it apropriate to use intmax_t where you want to count something big? For example, would it be OK to change wc and tcopy to use intmax_t instead of the int64_t and quad_t which they currently use? David. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Tue Dec 4 8:23:17 2001 Delivered-To: freebsd-audit@freebsd.org Received: from espresso.q9media.com (espresso.q9media.com [216.254.138.122]) by hub.freebsd.org (Postfix) with ESMTP id 61A6237B416; Tue, 4 Dec 2001 08:23:13 -0800 (PST) Received: (from mike@localhost) by espresso.q9media.com (8.11.6/8.11.6) id fB4GLm862899; Tue, 4 Dec 2001 11:21:48 -0500 (EST) (envelope-from mike) Date: Tue, 4 Dec 2001 11:21:48 -0500 From: Mike Barcroft To: David Malone Cc: audit@freebsd.org, markm@freebsd.org, Bruce Evans Subject: Re: Warns for tcopy and wc. Message-ID: <20011204112148.F57237@espresso.q9media.com> References: <20011203215452.E57237@espresso.q9media.com> <200112041341.aa05762@salmon.maths.tcd.ie> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200112041341.aa05762@salmon.maths.tcd.ie>; from dwmalone@maths.tcd.ie on Tue, Dec 04, 2001 at 01:41:07PM +0000 Organization: The FreeBSD Project 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 David Malone writes: > I presume casting to intmax_t will be the oficially blessed way of > printing typedefed things now? If so we should make gcc's format > warning code understand the %j modifier - maybe I should look into > that (or maybe some of the FreeBSD standards people are doing that?). Yes, intmax_t is guaranteed to be capable of representing any value of any signed integer. Similarly, uintmax_t is guaranteed to be capable of representing any value of any unsigned integer. It would probably be a good idea to teach GCC about these types. > Is it apropriate to use intmax_t where you want to count something > big? For example, would it be OK to change wc and tcopy to use > intmax_t instead of the int64_t and quad_t which they currently > use? That seems like a reasonable use to me. 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 Wed Dec 5 12: 0:16 2001 Delivered-To: freebsd-audit@freebsd.org Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by hub.freebsd.org (Postfix) with SMTP id 719BF37B416; Wed, 5 Dec 2001 12:00:10 -0800 (PST) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 5 Dec 2001 20:00:09 +0000 (GMT) Date: Wed, 5 Dec 2001 20:00:06 +0000 From: David Malone To: Mike Barcroft Cc: audit@freebsd.org, markm@freebsd.org, Bruce Evans , obrien@freebsd.org Subject: Re: Warns for tcopy and wc. Message-ID: <20011205200006.A38562@walton.maths.tcd.ie> References: <20011203215452.E57237@espresso.q9media.com> <200112041341.aa05762@salmon.maths.tcd.ie> <20011204112148.F57237@espresso.q9media.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20011204112148.F57237@espresso.q9media.com>; from mike@freebsd.org on Tue, Dec 04, 2001 at 11:21:48AM -0500 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 Tue, Dec 04, 2001 at 11:21:48AM -0500, Mike Barcroft wrote: > David Malone writes: > > I presume casting to intmax_t will be the oficially blessed way of > > printing typedefed things now? If so we should make gcc's format > > warning code understand the %j modifier - maybe I should look into > > that (or maybe some of the FreeBSD standards people are doing that?). > > Yes, intmax_t is guaranteed to be capable of representing any value of > any signed integer. Similarly, uintmax_t is guaranteed to be capable > of representing any value of any unsigned integer. It would probably > be a good idea to teach GCC about these types. The following patch makes gcc think that intmat_t is the same thing as a long long when it is doing format checking. The list of types gcc knows for format checking is just after line 1060 of c-common.c and long long is the closest thing available. I've included a short shell script which should emit no warnings if gcc has been patched with this patch. If someone could compile and install gcc on the alpha with this patch and then run the shell script to see if it emits a warning, that would be useful. (I'll try to do it myself, but it is hard to test gcc without installing it). David. Index: c-common.c =================================================================== RCS file: /cvs/FreeBSD-CVS/src/contrib/gcc.295/c-common.c,v retrieving revision 1.12 diff -u -r1.12 c-common.c --- c-common.c 25 May 2001 19:00:07 -0000 1.12 +++ c-common.c 5 Dec 2001 19:36:02 -0000 @@ -1777,6 +1777,13 @@ warning ("ANSI C does not support the `%c' length modifier", length_char); } + else if (*format_chars == 'j') + { + length_char = 'q', format_chars++; + if (pedantic) + warning ("ANSI C does not support the `%c' length modifier", + length_char); + } else if (*format_chars == 'Z') { length_char = *format_chars++; #!/bin/sh cat > jtest.c < #include int main() { intmax_t a=0; printf("%jd", a); return 0; } EOF gcc -W -Wall -o jtest jtest.c rm -f jtest.c jtest To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Dec 5 12:11:22 2001 Delivered-To: freebsd-audit@freebsd.org Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by hub.freebsd.org (Postfix) with SMTP id 44DA437B41E; Wed, 5 Dec 2001 12:11:18 -0800 (PST) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 5 Dec 2001 20:11:17 +0000 (GMT) Date: Wed, 5 Dec 2001 20:11:17 +0000 From: David Malone To: Mike Barcroft Cc: audit@freebsd.org, markm@freebsd.org, Bruce Evans , obrien@freebsd.org Subject: Re: Warns for tcopy and wc. Message-ID: <20011205201117.A39616@walton.maths.tcd.ie> References: <20011203215452.E57237@espresso.q9media.com> <200112041341.aa05762@salmon.maths.tcd.ie> <20011204112148.F57237@espresso.q9media.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20011204112148.F57237@espresso.q9media.com>; from mike@freebsd.org on Tue, Dec 04, 2001 at 11:21:48AM -0500 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 Drat - that doesn't actually help on the alpha 'cos intmax_t is actually a long on the alpha. Maybe it would be reasonable to change intmax_t to be a long long on the alpha? David. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Dec 5 12:22:32 2001 Delivered-To: freebsd-audit@freebsd.org Received: from dragon.nuxi.com (trang.nuxi.com [66.92.13.169]) by hub.freebsd.org (Postfix) with ESMTP id 059AE37B405; Wed, 5 Dec 2001 12:22:23 -0800 (PST) Received: (from obrien@localhost) by dragon.nuxi.com (8.11.6/8.11.1) id fB5KMBm66678; Wed, 5 Dec 2001 12:22:11 -0800 (PST) (envelope-from obrien) Date: Wed, 5 Dec 2001 12:22:10 -0800 From: "David O'Brien" To: David Malone Cc: Mike Barcroft , audit@freebsd.org, markm@freebsd.org, Bruce Evans Subject: Re: Warns for tcopy and wc. Message-ID: <20011205122210.C11004@dragon.nuxi.com> Reply-To: obrien@freebsd.org References: <20011203215452.E57237@espresso.q9media.com> <200112041341.aa05762@salmon.maths.tcd.ie> <20011204112148.F57237@espresso.q9media.com> <20011205200006.A38562@walton.maths.tcd.ie> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20011205200006.A38562@walton.maths.tcd.ie>; from dwmalone@maths.tcd.ie on Wed, Dec 05, 2001 at 08:00:06PM +0000 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, Dec 05, 2001 at 08:00:06PM +0000, David Malone wrote: > I've included a short shell script which should emit no warnings if > gcc has been patched with this patch. If someone could compile and > install gcc on the alpha with this patch and then run the shell script > to see if it emits a warning, that would be useful. This patch is only applicable to RELENG_4. Please install the gcc30 port and see what needs to be done for that version of GCC (as -current is moving to 3.0.3). To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Dec 5 12:59:30 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 99EE237B41A; Wed, 5 Dec 2001 12:59:26 -0800 (PST) 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 HAA21590; Thu, 6 Dec 2001 07:59:18 +1100 Date: Thu, 6 Dec 2001 07:59:43 +1100 (EST) From: Bruce Evans X-X-Sender: To: David Malone Cc: Mike Barcroft , , , Subject: Re: Warns for tcopy and wc. In-Reply-To: <20011205201117.A39616@walton.maths.tcd.ie> Message-ID: <20011206075514.Q12983-100000@gamplex.bde.org> 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 Wed, 5 Dec 2001, David Malone wrote: > Drat - that doesn't actually help on the alpha 'cos intmax_t is > actually a long on the alpha. Maybe it would be reasonable to change > intmax_t to be a long long on the alpha? No. intmax_t is a typedefed type since it is machine-dependent and possibly longer than long long. Changing it to long long on all machine defeats the point of it. There is a problem since gcc-2.x doesn't understand intmax_t. Perhaps this gcc-3 understands it. If it supports C99 then it should support %j already. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Dec 5 13: 4:51 2001 Delivered-To: freebsd-audit@freebsd.org Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by hub.freebsd.org (Postfix) with SMTP id 6E0A937B619; Wed, 5 Dec 2001 13:04:45 -0800 (PST) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 5 Dec 2001 21:04:44 +0000 (GMT) To: Bruce Evans Cc: Mike Barcroft , audit@freebsd.org, markm@freebsd.org, obrien@freebsd.org Subject: Re: Warns for tcopy and wc. In-reply-to: Your message of "Thu, 06 Dec 2001 07:59:43 +1100." <20011206075514.Q12983-100000@gamplex.bde.org> X-Request-Do: Date: Wed, 05 Dec 2001 21:04:43 +0000 From: David Malone Message-ID: <200112052104.aa04006@salmon.maths.tcd.ie> 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 > > Drat - that doesn't actually help on the alpha 'cos intmax_t is > > actually a long on the alpha. Maybe it would be reasonable to change > > intmax_t to be a long long on the alpha? > No. intmax_t is a typedefed type since it is machine-dependent and > possibly longer than long long. Changing it to long long on all > machine defeats the point of it. There is a problem since gcc-2.x > doesn't understand intmax_t. Indeed - I was suggesting this as a patch to tie us over until we have a gcc which understands intmax_t properly. All the same, declaring intmax_t as long on a platform which has long long seems perverse - as you point out it must be atleast as big as long long. > Perhaps this gcc-3 understands it. If > it supports C99 then it should support %j already. David O'Brien suggested that I look and see if anything needs to be done for gcc-3. I'll try to do that tomorrow. David. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Dec 6 5:41:40 2001 Delivered-To: freebsd-audit@freebsd.org Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by hub.freebsd.org (Postfix) with SMTP id 7427B37B405; Thu, 6 Dec 2001 05:41:36 -0800 (PST) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 6 Dec 2001 13:41:35 +0000 (GMT) Date: Thu, 6 Dec 2001 13:41:35 +0000 From: David Malone To: David O'Brien Cc: Mike Barcroft , audit@freebsd.org, markm@freebsd.org, Bruce Evans Subject: Re: Warns for tcopy and wc. Message-ID: <20011206134134.A4182@walton.maths.tcd.ie> References: <20011203215452.E57237@espresso.q9media.com> <200112041341.aa05762@salmon.maths.tcd.ie> <20011204112148.F57237@espresso.q9media.com> <20011205200006.A38562@walton.maths.tcd.ie> <20011205122210.C11004@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: <20011205122210.C11004@dragon.nuxi.com>; from obrien@freebsd.org on Wed, Dec 05, 2001 at 12:22:10PM -0800 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, Dec 05, 2001 at 12:22:10PM -0800, David O'Brien wrote: > On Wed, Dec 05, 2001 at 08:00:06PM +0000, David Malone wrote: > > I've included a short shell script which should emit no warnings if > > gcc has been patched with this patch. If someone could compile and > > install gcc on the alpha with this patch and then run the shell script > > to see if it emits a warning, that would be useful. > > This patch is only applicable to RELENG_4. Please install the gcc30 port > and see what needs to be done for that version of GCC (as -current is > moving to 3.0.3). I've just checked gcc 3.0.2 from ports and it understands the %j modifier natively. I guess we can live without %j support in -stable, as long as there are no plans to move the warns stuff back there. Do we have an ETA for gcc-3.0.3 in -current? David. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Dec 6 8:58:12 2001 Delivered-To: freebsd-audit@freebsd.org Received: from espresso.q9media.com (espresso.q9media.com [216.254.138.122]) by hub.freebsd.org (Postfix) with ESMTP id B2B4137B405; Thu, 6 Dec 2001 08:58:08 -0800 (PST) Received: (from mike@localhost) by espresso.q9media.com (8.11.6/8.11.6) id fB6Gueu75121; Thu, 6 Dec 2001 11:56:40 -0500 (EST) (envelope-from mike) Date: Thu, 6 Dec 2001 11:56:40 -0500 From: Mike Barcroft To: David Malone Cc: "David O'Brien" , audit@freebsd.org, markm@freebsd.org, Bruce Evans Subject: Re: Warns for tcopy and wc. Message-ID: <20011206115640.C71848@espresso.q9media.com> References: <20011203215452.E57237@espresso.q9media.com> <200112041341.aa05762@salmon.maths.tcd.ie> <20011204112148.F57237@espresso.q9media.com> <20011205200006.A38562@walton.maths.tcd.ie> <20011205122210.C11004@dragon.nuxi.com> <20011206134134.A4182@walton.maths.tcd.ie> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20011206134134.A4182@walton.maths.tcd.ie>; from dwmalone@maths.tcd.ie on Thu, Dec 06, 2001 at 01:41:35PM +0000 Organization: The FreeBSD Project 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 David Malone writes: > I've just checked gcc 3.0.2 from ports and it understands the %j > modifier natively. I guess we can live without %j support in -stable, > as long as there are no plans to move the warns stuff back there. > Do we have an ETA for gcc-3.0.3 in -current? It's probably not a problem because -Werror is never set on -STABLE. 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 Dec 6 9: 9:26 2001 Delivered-To: freebsd-audit@freebsd.org Received: from dragon.nuxi.com (trang.nuxi.com [66.92.13.169]) by hub.freebsd.org (Postfix) with ESMTP id 95D7C37B405; Thu, 6 Dec 2001 09:09:24 -0800 (PST) Received: (from obrien@localhost) by dragon.nuxi.com (8.11.6/8.11.1) id fB6H9N922610; Thu, 6 Dec 2001 09:09:23 -0800 (PST) (envelope-from obrien) Date: Thu, 6 Dec 2001 09:09:23 -0800 From: "David O'Brien" To: Mike Barcroft Cc: David Malone , audit@freebsd.org, markm@freebsd.org, Bruce Evans Subject: Re: Warns for tcopy and wc. Message-ID: <20011206090923.A9444@dragon.nuxi.com> Reply-To: obrien@freebsd.org References: <20011203215452.E57237@espresso.q9media.com> <200112041341.aa05762@salmon.maths.tcd.ie> <20011204112148.F57237@espresso.q9media.com> <20011205200006.A38562@walton.maths.tcd.ie> <20011205122210.C11004@dragon.nuxi.com> <20011206134134.A4182@walton.maths.tcd.ie> <20011206115640.C71848@espresso.q9media.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20011206115640.C71848@espresso.q9media.com>; from mike@freebsd.org on Thu, Dec 06, 2001 at 11:56:40AM -0500 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 Thu, Dec 06, 2001 at 11:56:40AM -0500, Mike Barcroft wrote: > David Malone writes: > > I've just checked gcc 3.0.2 from ports and it understands the %j > > modifier natively. I guess we can live without %j support in -stable, > > as long as there are no plans to move the warns stuff back there. > > Do we have an ETA for gcc-3.0.3 in -current? > > It's probably not a problem because -Werror is never set on -STABLE. Not totally true. I added support for it (set WARNS_WERROR in /etc/make.conf). IMO, all committers should be running with WARNS_WERROR on their RELENG_4 boxes to prevent regressions. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sat Dec 8 7:16:35 2001 Delivered-To: freebsd-audit@freebsd.org Received: from Veronica.wmol.com (veronica.wmol.com [208.242.83.241]) by hub.freebsd.org (Postfix) with ESMTP id 64E9B37B416 for ; Sat, 8 Dec 2001 07:16:32 -0800 (PST) Received: from rain.hill.hom (24.247.83.42.bay.mi.chartermi.net [24.247.83.42]) by Veronica.wmol.com (Vircom SMTPRS 5.0.193) with ESMTP id for ; Sat, 8 Dec 2001 10:12:50 -0500 Date: Sat, 8 Dec 2001 10:15:21 +0000 From: David Hill To: freebsd-audit@freebsd.org Subject: write.c diff Message-Id: <20011208101521.0163ee8c.lists@phobia.ms> X-Mailer: Sylpheed version 0.6.5 (GTK+ 1.2.10; i386--freebsd5.0) Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Multipart_Sat__8_Dec_2001_10:15:21_+0000_08168000" 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 is a multi-part message in MIME format. --Multipart_Sat__8_Dec_2001_10:15:21_+0000_08168000 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Hello - Here is a small code cleanup patch for write(1). - David --- /usr/src/usr.bin/write/write.c.orig Mon Dec 3 17:42:45 2001 +++ /usr/src/usr.bin/write/write.c Mon Dec 3 17:45:22 2001 @@ -190,8 +190,7 @@ while (read(ufd, (char *) &u, sizeof(u)) == sizeof(u)) if (strncmp(user, u.ut_name, sizeof(u.ut_name)) == 0) { ++nloggedttys; - (void)strncpy(atty, u.ut_line, UT_LINESIZE); - atty[UT_LINESIZE] = '\0'; + (void)strlcpy(atty, u.ut_line, UT_LINESIZE); if (term_chk(atty, &msgsok, &atime, 0)) continue; /* bad term? skip */ if (myuid && !msgsok) @@ -240,7 +239,7 @@ warn("%s", path); return(1); } - *msgsokP = (s.st_mode & (S_IWRITE >> 3)) != 0; /* group write bit */ + *msgsokP = (s.st_mode & S_IWGRP) != 0; /* group write bit */ *atimeP = s.st_atime; return(0); } --Multipart_Sat__8_Dec_2001_10:15:21_+0000_08168000 Content-Type: application/octet-stream; name="write.c.diff" Content-Disposition: attachment; filename="write.c.diff" Content-Transfer-Encoding: base64 LS0tIC91c3Ivc3JjL3Vzci5iaW4vd3JpdGUvd3JpdGUuYy5vcmlnCU1vbiBEZWMgIDMgMTc6NDI6 NDUgMjAwMQorKysgL3Vzci9zcmMvdXNyLmJpbi93cml0ZS93cml0ZS5jCU1vbiBEZWMgIDMgMTc6 NDU6MjIgMjAwMQpAQCAtMTkwLDggKzE5MCw3IEBACiAJd2hpbGUgKHJlYWQodWZkLCAoY2hhciAq KSAmdSwgc2l6ZW9mKHUpKSA9PSBzaXplb2YodSkpCiAJCWlmIChzdHJuY21wKHVzZXIsIHUudXRf bmFtZSwgc2l6ZW9mKHUudXRfbmFtZSkpID09IDApIHsKIAkJCSsrbmxvZ2dlZHR0eXM7Ci0JCQko dm9pZClzdHJuY3B5KGF0dHksIHUudXRfbGluZSwgVVRfTElORVNJWkUpOwotCQkJYXR0eVtVVF9M SU5FU0laRV0gPSAnXDAnOworCQkJKHZvaWQpc3RybGNweShhdHR5LCB1LnV0X2xpbmUsIFVUX0xJ TkVTSVpFKTsKIAkJCWlmICh0ZXJtX2NoayhhdHR5LCAmbXNnc29rLCAmYXRpbWUsIDApKQogCQkJ CWNvbnRpbnVlOwkvKiBiYWQgdGVybT8gc2tpcCAqLwogCQkJaWYgKG15dWlkICYmICFtc2dzb2sp CkBAIC0yNDAsNyArMjM5LDcgQEAKIAkJCXdhcm4oIiVzIiwgcGF0aCk7CiAJCXJldHVybigxKTsK IAl9Ci0JKm1zZ3Nva1AgPSAocy5zdF9tb2RlICYgKFNfSVdSSVRFID4+IDMpKSAhPSAwOwkvKiBn cm91cCB3cml0ZSBiaXQgKi8KKwkqbXNnc29rUCA9IChzLnN0X21vZGUgJiBTX0lXR1JQKSAhPSAw OwkvKiBncm91cCB3cml0ZSBiaXQgKi8KIAkqYXRpbWVQID0gcy5zdF9hdGltZTsKIAlyZXR1cm4o MCk7CiB9Cg== --Multipart_Sat__8_Dec_2001_10:15:21_+0000_08168000-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message