From owner-freebsd-arch@FreeBSD.ORG Sun May 8 02:34:58 2005 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 277AD16A4E0; Sun, 8 May 2005 02:34:58 +0000 (GMT) Received: from S2.cableone.net (smtp2.cableone.net [24.116.0.228]) by mx1.FreeBSD.org (Postfix) with ESMTP id C1CA043DB6; Sun, 8 May 2005 02:34:57 +0000 (GMT) (envelope-from v.velox@vvelox.net) Received: from vixen42.local.lan (unverified [24.119.123.39]) by S2.cableone.net (CableOne SMTP Service S2) with ESMTP id 19089439 for multiple; Sat, 07 May 2005 20:03:53 -0700 Date: Sun, 8 May 2005 21:34:16 -0500 From: Vulpes Velox To: "Fafa Hafiz Krantz" Message-ID: <20050508213416.218abc9c@vixen42.local.lan> In-Reply-To: <20050507110557.05A284BEAD@ws1-1.us4.outblaze.com> References: <20050507110557.05A284BEAD@ws1-1.us4.outblaze.com> X-Mailer: Sylpheed-Claws 1.0.4 (GTK+ 1.2.10; i386-portbld-freebsd5.4) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-IP-stats: Incoming Last 1, First 9, in=13, out=0, spam=0 X-External-IP: 24.119.123.39 X-Abuse-Info: Send abuse complaints to abuse@cableone.net cc: arch@freebsd.org cc: questions@freebsd.org cc: dnelson@allantgroup.com Subject: Re: A beautiful dmesg! Maybe one day? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2005 02:34:58 -0000 On Sat, 07 May 2005 06:05:56 -0500 "Fafa Hafiz Krantz" wrote: > > Hey! > > > I personally find the old methode a lot easier to read, compared > > to the new one. If a change is wanted, why not make such a thing > > like this a kernel option? > > Are you referring to the indenting? > Yeah your eyes would have to jump. A sacrifice necessary for order. This has nothing to do with order. It is in the same order as before, just in a less readable form. The extra line returns are nice thought. > But the changes were not only in the indenting. > They were logical changes to areas that seemed neglected. > > You should do a diff! From owner-freebsd-arch@FreeBSD.ORG Sun May 8 10:07:42 2005 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 495FA16A4E1 for ; Sun, 8 May 2005 10:07:42 +0000 (GMT) Received: from webmail-outgoing.us4.outblaze.com (webmail-outgoing.us4.outblaze.com [205.158.62.67]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1B15943D5E for ; Sun, 8 May 2005 10:07:42 +0000 (GMT) (envelope-from fteg@london.com) Received: from unknown (unknown [192.168.9.180])07C7918001AC for ; Sun, 8 May 2005 10:07:42 +0000 (GMT) X-OB-Received: from unknown (205.158.62.49) by wfilter.us4.outblaze.com; 8 May 2005 10:07:41 -0000 Received: by ws1-1.us4.outblaze.com (Postfix, from userid 1001) id E0A504BEAD; Sun, 8 May 2005 10:07:41 +0000 (GMT) Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Received: from [213.187.181.70] by ws1-1.us4.outblaze.com with http for fteg@london.com; Sun, 08 May 2005 05:07:41 -0500 From: "Fafa Hafiz Krantz" To: "Vulpes Velox" Date: Sun, 08 May 2005 05:07:41 -0500 X-Originating-Ip: 213.187.181.70 X-Originating-Server: ws1-1.us4.outblaze.com Message-Id: <20050508100741.E0A504BEAD@ws1-1.us4.outblaze.com> cc: arch@freebsd.org cc: questions@freebsd.org cc: dnelson@allantgroup.com Subject: Re: A beautiful dmesg! Maybe one day? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2005 10:07:42 -0000 > This has nothing to do with order. It is in the same order as before, > just in a less readable form. The extra line returns are nice thought. I didn't mean order as in the arrangement. But order as in tidyness, or to bring order to chaos. The differences are very petite. But they hold great power, at least in my opinion, as they would make me feel a lot more pride every time I watch my boxes boot. Thanks. -- Fafa Hafiz Krantz Research Designer @ http://www.home.no/barbershop Enlightened @ http://www.home.no/barbershop/smart/sharon.pdf --=20 ___________________________________________________________ Sign-up for Ads Free at Mail.com http://promo.mail.com/adsfreejump.htm From owner-freebsd-arch@FreeBSD.ORG Mon May 9 15:55:20 2005 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3015C16A4E8; Mon, 9 May 2005 15:55:20 +0000 (GMT) Received: from cheer.mahoroba.org (gw4.mahoroba.org [218.45.22.175]) by mx1.FreeBSD.org (Postfix) with ESMTP id 269F543D49; Mon, 9 May 2005 15:55:19 +0000 (GMT) (envelope-from ume@mahoroba.org) Received: from lyrics.mahoroba.org (ume@lyrics.mahoroba.org [IPv6:3ffe:501:185b:8010:280:88ff:fe03:4841]) (user=ume mech=CRAM-MD5 bits=0)j49Ft3jO061330 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 10 May 2005 00:55:07 +0900 (JST) (envelope-from ume@mahoroba.org) Date: Tue, 10 May 2005 00:55:01 +0900 Message-ID: From: Hajimu UMEMOTO To: David Schultz In-Reply-To: <20050503224409.GA16252@VARK.MIT.EDU> References: <20050503224409.GA16252@VARK.MIT.EDU> User-Agent: xcite1.38> Wanderlust/2.15.1 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.7 (=?ISO-8859-4?Q?Sanj=F2?=) APEL/10.6 Emacs/22.0.50 (i386-unknown-freebsd5.4) MULE/5.0 (SAKAKI) X-Operating-System: FreeBSD 5.4-STABLE X-PGP-Key: http://www.imasy.or.jp/~ume/publickey.asc X-PGP-Fingerprint: 1F00 0B9E 2164 70FC 6DC5 BF5F 04E9 F086 BF90 71FE Organization: Internet Mutual Aid Society, YOKOHAMA MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-2.0b5 (cheer.mahoroba.org [IPv6:3ffe:501:185b:8010::1]); Tue, 10 May 2005 00:55:07 +0900 (JST) X-Virus-Scanned: by amavisd-new X-Virus-Status: Clean X-Spam-Status: No, score=-5.7 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.0.2 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on cheer.mahoroba.org cc: arch@FreeBSD.ORG cc: standards@FreeBSD.ORG cc: Hajimu UMEMOTO Subject: Re: [CFR] correct type of addrinfo.ai_addrlen and netent.n_net X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2005 15:55:20 -0000 Hi, >>>>> On Tue, 3 May 2005 18:44:09 -0400 >>>>> David Schultz said: das> - You should use socklen_t instead of uint32_t, as appropriate. Are you mean netent.n_net? If so, it is because of POSIX. das> - It's probably better to use the machine/endian.h macros to test das> endianness instead of hard-coding every architecture. Yes. How about this patch? --- include/netdb.h.orig Thu Apr 28 04:12:56 2005 +++ include/netdb.h Mon May 9 15:45:55 2005 @@ -63,6 +63,8 @@ #include #include +#include +#include #ifndef _SIZE_T_DECLARED typedef __size_t size_t; @@ -74,6 +76,11 @@ #define _SOCKLEN_T_DECLARED #endif +#ifndef _UINT32_T_DECLARED +typedef __uint32_t uint32_t; +#define _UINT32_T_DECLARED +#endif + #ifndef _PATH_HEQUIV # define _PATH_HEQUIV "/etc/hosts.equiv" #endif @@ -99,14 +106,27 @@ }; /* - * Assumption here is that a network number - * fits in an unsigned long -- probably a poor one. + * Note: n_net used to be an unsigned long integer. + * In XNS5, and subsequently in POSIX-2001 it was changed to an + * uint32_t. + * To accomodate for this while preserving binary compatibility with + * the old interface, we prepend or append 32 bits of padding, + * depending on the (LP64) architecture's endianness. + * + * This should be deleted the next time the libc major number is + * incremented. */ struct netent { char *n_name; /* official name of net */ char **n_aliases; /* alias list */ int n_addrtype; /* net address type */ - unsigned long n_net; /* network # */ +#if __LONG_BIT == 64 && _BYTE_ORDER == _BIG_ENDIAN + uint32_t __n_pad0; /* ABI compatibility */ +#endif + uint32_t n_net; /* network # */ +#if __LONG_BIT == 64 && _BYTE_ORDER == _LITTLE_ENDIAN + uint32_t __n_pad0; /* ABI compatibility */ +#endif }; struct servent { @@ -122,12 +142,29 @@ int p_proto; /* protocol # */ }; +/* + * Note: ai_addrlen used to be a size_t, per RFC 2553. + * In XNS5.2, and subsequently in POSIX-2001 and RFC 3493 it was + * changed to a socklen_t. + * To accomodate for this while preserving binary compatibility with the + * old interface, we prepend or append 32 bits of padding, depending on + * the (LP64) architecture's endianness. + * + * This should be deleted the next time the libc major number is + * incremented. + */ struct addrinfo { int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */ int ai_family; /* PF_xxx */ int ai_socktype; /* SOCK_xxx */ int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ - size_t ai_addrlen; /* length of ai_addr */ +#if __LONG_BIT == 64 && _BYTE_ORDER == _BIG_ENDIAN + uint32_t __ai_pad0; /* ABI compatibility */ +#endif + socklen_t ai_addrlen; /* length of ai_addr */ +#if __LONG_BIT == 64 && _BYTE_ORDER == _LITTLE_ENDIAN + uint32_t __ai_pad0; /* ABI compatibility */ +#endif char *ai_canonname; /* canonical name for hostname */ struct sockaddr *ai_addr; /* binary address */ struct addrinfo *ai_next; /* next structure in linked list */ @@ -225,7 +262,7 @@ struct hostent *gethostent(void); struct hostent *getipnodebyaddr(const void *, size_t, int, int *); struct hostent *getipnodebyname(const char *, int, int, int *); -struct netent *getnetbyaddr(unsigned long, int); +struct netent *getnetbyaddr(uint32_t, int); struct netent *getnetbyname(const char *); struct netent *getnetent(void); int getnetgrent(char **, char **, char **); das> -#if 1 /* obsolete */ das> +#if __BSD_VISIBLE /* obsolete */ das> #define NI_WITHSCOPEID 0x00000020 das> #endif It reminds me one more issue. I wish to nuke NI_WITHSCOPEID before 6.0-RELEASE. NetBSD and OpenBSD did so already. das> +int getaddrinfo(const char * __restrict, const char * __restrict, das> + const struct addrinfo * __restrict, das> + struct addrinfo ** __restrict); das> +int getnameinfo(const struct sockaddr * __restrict, socklen_t, das> + char * __restrict, __size_t, char * __restrict, das> + __size_t, int); The 4th and 6th arguments are buffer length for return value, and they are size_t in spec. So, they should not be mixuped with others. das> -struct hostent *getipnodebyaddr(const void *, size_t, int, int *); das> +struct hostent *getipnodebyaddr(const void *, __size_t, int, int *); It is thorny issue. I think it is a bug, and it should be int. However, getipnodebyaddr() was defined in RFC 2553, then was deprecated in RFC 3493. So, I think it will never be revised. Sincerely, -- Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan ume@mahoroba.org ume@{,jp.}FreeBSD.org http://www.imasy.org/~ume/ From owner-freebsd-arch@FreeBSD.ORG Mon May 9 16:06:31 2005 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0378E16A4E8; Mon, 9 May 2005 16:06:31 +0000 (GMT) Received: from cheer.mahoroba.org (gw4.mahoroba.org [218.45.22.175]) by mx1.FreeBSD.org (Postfix) with ESMTP id 39D6F43D93; Mon, 9 May 2005 16:06:30 +0000 (GMT) (envelope-from ume@mahoroba.org) Received: from lyrics.mahoroba.org (ume@lyrics.mahoroba.org [IPv6:3ffe:501:185b:8010:280:88ff:fe03:4841]) (user=ume mech=CRAM-MD5 bits=0)j49G6Hpr013396 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 10 May 2005 01:06:18 +0900 (JST) (envelope-from ume@mahoroba.org) Date: Tue, 10 May 2005 01:06:16 +0900 Message-ID: From: Hajimu UMEMOTO To: Peter Wemm In-Reply-To: <200505041529.36826.peter@wemm.org> References: <200505041529.36826.peter@wemm.org> User-Agent: xcite1.38> Wanderlust/2.15.1 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.7 (=?ISO-8859-4?Q?Sanj=F2?=) APEL/10.6 Emacs/22.0.50 (i386-unknown-freebsd5.4) MULE/5.0 (SAKAKI) X-Operating-System: FreeBSD 5.4-STABLE X-PGP-Key: http://www.imasy.or.jp/~ume/publickey.asc X-PGP-Fingerprint: 1F00 0B9E 2164 70FC 6DC5 BF5F 04E9 F086 BF90 71FE Organization: Internet Mutual Aid Society, YOKOHAMA MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-2.0b5 (cheer.mahoroba.org [IPv6:3ffe:501:185b:8010::1]); Tue, 10 May 2005 01:06:18 +0900 (JST) X-Virus-Scanned: by amavisd-new X-Virus-Status: Clean X-Spam-Status: No, score=-5.7 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.0.2 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on cheer.mahoroba.org cc: standards@freebsd.org cc: current@freebsd.org cc: freebsd-arch@freebsd.org Subject: Re: [CFR] correct type of addrinfo.ai_addrlen and netent.n_net X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2005 16:06:31 -0000 Hi, >>>>> On Wed, 4 May 2005 15:29:36 -0700 >>>>> Peter Wemm said: peter> Like David Schultz said, it would be better to use the machine/endian.h peter> macros to set the padding position. I think so, too, thanks. peter> As far as removing the padding goes, it makes little difference whether peter> you break it now or later. Doing it now will be painful. Doing it peter> before 6.0-REL will be just as painful. Not only is this encoded in peter> libc.so.6, but all applications and shared libraries that have exposure peter> to this also know it. Are you suggest when to remove padding? Since the major of libc was bumped already in 6-CURRENT, it may better to wait 7-CURRENT. Sincerely, -- Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan ume@mahoroba.org ume@{,jp.}FreeBSD.org http://www.imasy.org/~ume/ From owner-freebsd-arch@FreeBSD.ORG Mon May 9 16:43:54 2005 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A612E16A4EB; Mon, 9 May 2005 16:43:54 +0000 (GMT) Received: from harmony.village.org (rover.village.org [168.103.84.182]) by mx1.FreeBSD.org (Postfix) with ESMTP id 172A843D62; Mon, 9 May 2005 16:43:54 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (localhost.village.org [127.0.0.1]) by harmony.village.org (8.13.3/8.13.1) with ESMTP id j49GgYdb053165; Mon, 9 May 2005 10:42:34 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Mon, 09 May 2005 10:42:34 -0600 (MDT) Message-Id: <20050509.104234.71141880.imp@bsdimp.com> To: ume@freebsd.org From: Warner Losh In-Reply-To: References: <200505041529.36826.peter@wemm.org> X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: standards@freebsd.org cc: current@freebsd.org cc: freebsd-arch@freebsd.org Subject: Re: [CFR] correct type of addrinfo.ai_addrlen and netent.n_net X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2005 16:43:55 -0000 > Are you suggest when to remove padding? Since the major of libc was > bumped already in 6-CURRENT, it may better to wait 7-CURRENT. We've generally not worried compatibility in the 'rough and tumble' world of FreeBSD current. So unless there's a problem in the upgrade path, I think that we safely omit them. Warner From owner-freebsd-arch@FreeBSD.ORG Tue May 10 18:18:43 2005 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A8AAB16A4D0 for ; Tue, 10 May 2005 18:18:43 +0000 (GMT) Received: from webmail-outgoing.us4.outblaze.com (webmail-outgoing.us4.outblaze.com [205.158.62.67]) by mx1.FreeBSD.org (Postfix) with ESMTP id 561D843D5A for ; Tue, 10 May 2005 18:18:43 +0000 (GMT) (envelope-from fteg@london.com) Received: from unknown (unknown [192.168.9.180])3010418001BB for ; Tue, 10 May 2005 18:18:40 +0000 (GMT) X-OB-Received: from unknown (205.158.62.49) by wfilter.us4.outblaze.com; 10 May 2005 18:18:40 -0000 Received: by ws1-1.us4.outblaze.com (Postfix, from userid 1001) id 1B8A14BEAE; Tue, 10 May 2005 18:18:37 +0000 (GMT) Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" MIME-Version: 1.0 X-Mailer: MIME::Lite 2.117 (F2.6; A1.17; B2.12; Q2.03) Received: from [213.187.181.70] by ws1-1.us4.outblaze.com with http for fteg@london.com; Tue, 10 May 2005 13:18:36 -0500 X-Mailer: mail.com webmail From: "Fafa Hafiz Krantz" To: "Stephen McKay" Date: Tue, 10 May 2005 13:18:36 -0500 X-Originating-Ip: 213.187.181.70 X-Originating-Server: ws1-1.us4.outblaze.com Message-Id: <20050510181837.1B8A14BEAE@ws1-1.us4.outblaze.com> cc: arch@freebsd.org cc: questions@freebsd.org Subject: Re: A beautiful dmesg! Maybe one day? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2005 18:18:43 -0000 > > We can't just forget about it and pray for it to go away. > > > > This is an aesthetic violation to FreeBSD's professional image, > > that is considered to be more important now than ever. >=20 > There is no "aesthetic violation" to forget about or pray over. I like to appreciate. And it's easier to appreciate something that is CORRECT. real memory =3D 100663296 (96 MB) avail memory =3D 93036544 (88 MB) Looks like it's been written by some Linux geek. Real memory =3D 100663296 (96 MB) Available memory =3D 93036544 (88 MB) Doesn't. > As you suggested, I compared these with diff, ignoring the gratuitous > spacing modification using "diff -b". >=20 > In the end, I don't think I can consider even one of your changes to > be an improvement. The closest you came to a useful change was the > capitalisation of "Real memory", but that's hardly necessary, and > the accompanying change to the next line upsets the formatting. Ofcourse it doesn't improve the functionality. And I get the feeling that's what you're all about. > In short, I think you should find some other way to pretty up your FreeBSD > boot. As suggested earlier, try "man splash". Again, I want it to look correct. -- Fafa Hafiz Krantz Research Designer @ http://www.home.no/barbershop Enlightened @ http://www.home.no/barbershop/smart/sharon.pdf --=20 ___________________________________________________________ Sign-up for Ads Free at Mail.com http://promo.mail.com/adsfreejump.htm From owner-freebsd-arch@FreeBSD.ORG Tue May 10 18:40:48 2005 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2E64716A4CE; Tue, 10 May 2005 18:40:48 +0000 (GMT) Received: from chrobd01.vailsys.com (chrobd01.vailsys.com [63.210.102.138]) by mx1.FreeBSD.org (Postfix) with ESMTP id BEEB343D92; Tue, 10 May 2005 18:40:47 +0000 (GMT) (envelope-from rpettit@vailsys.com) Received: from dfsfbd06.vail (dfsfbd06.vail [192.168.129.190]) by chrobd01.vailsys.com (Postfix) with ESMTP id 2F7EF4988; Tue, 10 May 2005 13:40:47 -0500 (CDT) Received: from localhost.vail (unknown [172.16.5.90]) by dfsfbd06.vail (Postfix) with ESMTP id A2F6257AC; Tue, 10 May 2005 13:40:44 -0500 (CDT) Received: (from rpettit@localhost) by localhost.vail (ailsys.com/8.13.1/Submit) id j4AIeejh014865; Tue, 10 May 2005 13:40:40 -0500 (CDT) Date: Tue, 10 May 2005 13:40:40 -0500 From: Rick Pettit To: Fafa Hafiz Krantz Message-ID: <20050510184040.GA23156@vailsys.com> References: <20050510181837.1B8A14BEAE@ws1-1.us4.outblaze.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050510181837.1B8A14BEAE@ws1-1.us4.outblaze.com> User-Agent: Mutt/1.4.2.1i cc: arch@freebsd.org cc: questions@freebsd.org cc: Stephen McKay Subject: Re: A beautiful dmesg! Maybe one day? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2005 18:40:48 -0000 On Tue, May 10, 2005 at 01:18:36PM -0500, Fafa Hafiz Krantz wrote: > > > > We can't just forget about it and pray for it to go away. > > > > > > This is an aesthetic violation to FreeBSD's professional image, > > > that is considered to be more important now than ever. > > > > There is no "aesthetic violation" to forget about or pray over. > > I like to appreciate. > And it's easier to appreciate something that is CORRECT. > > real memory = 100663296 (96 MB) > avail memory = 93036544 (88 MB) > > Looks like it's been written by some Linux geek. > > Real memory = 100663296 (96 MB) > Available memory = 93036544 (88 MB) > > Doesn't. > > > As you suggested, I compared these with diff, ignoring the gratuitous > > spacing modification using "diff -b". > > > > In the end, I don't think I can consider even one of your changes to > > be an improvement. The closest you came to a useful change was the > > capitalisation of "Real memory", but that's hardly necessary, and > > the accompanying change to the next line upsets the formatting. > > Ofcourse it doesn't improve the functionality. > And I get the feeling that's what you're all about. > > > In short, I think you should find some other way to pretty up your FreeBSD > > boot. As suggested earlier, try "man splash". > > Again, I want it to look correct. Time to fork your own project - from the postings I have seen from you on various BSD lists you are going in a direction all your own. -Rick From owner-freebsd-arch@FreeBSD.ORG Tue May 10 19:23:53 2005 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 35D2216A4CE; Tue, 10 May 2005 19:23:53 +0000 (GMT) Received: from malasada.lava.net (malasada.lava.net [64.65.64.17]) by mx1.FreeBSD.org (Postfix) with ESMTP id D7F3643D96; Tue, 10 May 2005 19:23:52 +0000 (GMT) (envelope-from cliftonr@lava.net) Received: by malasada.lava.net (Postfix, from userid 102) id 2DDC2153882; Tue, 10 May 2005 09:23:52 -1000 (HST) Date: Tue, 10 May 2005 09:23:52 -1000 From: Clifton Royston To: Fafa Hafiz Krantz Message-ID: <20050510192350.GC16991@tikitechnologies.com> References: <20050510181837.1B8A14BEAE@ws1-1.us4.outblaze.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050510181837.1B8A14BEAE@ws1-1.us4.outblaze.com> User-Agent: Mutt/1.4.2i cc: arch@freebsd.org cc: questions@freebsd.org cc: Stephen McKay Subject: Re: A beautiful dmesg! Maybe one day? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2005 19:23:53 -0000 On Tue, May 10, 2005 at 01:18:36PM -0500, Fafa Hafiz Krantz wrote: ... > Real memory = 100663296 (96 MB) > Available memory = 93036544 (88 MB) > > Doesn't. > > > As you suggested, I compared these with diff, ignoring the gratuitous > > spacing modification using "diff -b". > > > > In the end, I don't think I can consider even one of your changes to > > be an improvement. The closest you came to a useful change was the > > capitalisation of "Real memory", but that's hardly necessary, and > > the accompanying change to the next line upsets the formatting. > > Ofcourse it doesn't improve the functionality. > And I get the feeling that's what you're all about. Indeed, you understand correctly. Functionality is exactly what the BSD family of OSs is all about. Most kernel developers are busy with activities like improving system performance on multi-CPU systems, increasing OS reliability with SATA drives, and other activities of a deep and essential nature. I don't generally tell the kernel developers what to do, because I know that they know their own knowledge domain far better than I do. [...] > > In short, I think you should find some other way to pretty up your FreeBSD > > boot. As suggested earlier, try "man splash". > > Again, I want it to look correct. The appearance is a matter of personal taste, and "de gustibus non disputandum." Your claim that your personal preference is "correct" does not cause other people to prefer it. It should be clear by now that you are getting nowhere trying to persuade others to implement this for you, so your only course is to implement it yourself. If these changes matter a great deal to you, I suggest you invest the sweat to change it on your own system. You have all the sources, you have the power. If you don't know how yet, you have the opportunity to learn. If you succeed and post public patches to do it, then others can share the changes if they wish, and you will get some smidgen of positive recognition and credibility. If this matters so much to you, it should be worth your effort. If you are incapable of making these changes, then your preferences will get some smidgin less weight, as there will be that much less evidence that your opinions should be valued. The open source world is largely a meritocracy and technocracy; this is not to say that "politics" and opinions play no part, but generally speaking "working code wins." Mostly people in the OSS world take it for granted that others understand this, which may be why nobody has told you this in so many words before now. -- Clifton -- Clifton Royston -- cliftonr@tikitechnologies.com Tiki Technologies Lead Programmer/Software Architect "I'm gonna tell my son to grow up pretty as the grass is green And whip-smart as the English Channel's wide..." -- 'Whip-Smart', Liz Phair From owner-freebsd-arch@FreeBSD.ORG Tue May 10 21:13:29 2005 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A7D7416A4CE for ; Tue, 10 May 2005 21:13:29 +0000 (GMT) Received: from eql145.neoplus.adsl.tpnet.pl (eql145.neoplus.adsl.tpnet.pl [83.20.79.145]) by mx1.FreeBSD.org (Postfix) with SMTP id 0DE8D43DAA for ; Tue, 10 May 2005 21:13:28 +0000 (GMT) (envelope-from clutches@nicosia.com) Received: from [60.167.36.196] (port=2464 helo=[delete]) by eql145.neoplus.adsl.tpnet.pl with esmtp id 2621458901bribes51943 for freebsd-arch@freebsd.org; Tue, 10 May 2005 23:05:46 +0300 Mime-Version: 1.0 (Apple Message framework v728) Content-Transfer-Encoding: 7bit Message-Id: <8285850847.84751@eql145.neoplus.adsl.tpnet.pl> Content-Type: text/plain; charset=US-ASCII; format=flowed To: freebsd-arch@freebsd.org From: Herman Date: Tue, 10 May 2005 23:05:45 +0300 X-Mailer: Apple Mail (2.728) Subject: Hey man, stop throwing away your money X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2005 21:13:29 -0000 Wish you could be better? http://www.doaset.info/ss/ Feel insecure about your penis size? From owner-freebsd-arch@FreeBSD.ORG Wed May 11 09:48:31 2005 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1583E16A4D0 for ; Wed, 11 May 2005 09:48:31 +0000 (GMT) Received: from webmail-outgoing.us4.outblaze.com (webmail-outgoing.us4.outblaze.com [205.158.62.67]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9C4F043D45 for ; Wed, 11 May 2005 09:48:30 +0000 (GMT) (envelope-from fteg@london.com) Received: from unknown (unknown [192.168.9.180])767241800129 for ; Wed, 11 May 2005 09:48:30 +0000 (GMT) X-OB-Received: from unknown (205.158.62.49) by wfilter.us4.outblaze.com; 11 May 2005 09:48:30 -0000 Received: by ws1-1.us4.outblaze.com (Postfix, from userid 1001) id 5EA974BEAD; Wed, 11 May 2005 09:48:30 +0000 (GMT) Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" MIME-Version: 1.0 X-Mailer: MIME::Lite 2.117 (F2.6; A1.17; B2.12; Q2.03) Received: from [213.187.181.70] by ws1-1.us4.outblaze.com with http for fteg@london.com; Wed, 11 May 2005 04:48:30 -0500 X-Mailer: mail.com webmail From: "Fafa Hafiz Krantz" To: "Clifton Royston" Date: Wed, 11 May 2005 04:48:30 -0500 X-Originating-Ip: 213.187.181.70 X-Originating-Server: ws1-1.us4.outblaze.com Message-Id: <20050511094830.5EA974BEAD@ws1-1.us4.outblaze.com> cc: arch@freebsd.org cc: questions@freebsd.org cc: Stephen McKay Subject: Re: A beautiful dmesg! Maybe one day? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 May 2005 09:48:31 -0000 Clifton! I've never read a better e-mail. Thank you for your words, wise man. I've been inspired now. :) ----- Original Message ----- From: "Clifton Royston" To: "Fafa Hafiz Krantz" Subject: Re: A beautiful dmesg! Maybe one day? Date: Tue, 10 May 2005 09:23:52 -1000 >=20 > On Tue, May 10, 2005 at 01:18:36PM -0500, Fafa Hafiz Krantz wrote: > ... > > Real memory =3D 100663296 (96 MB) > > Available memory =3D 93036544 (88 MB) > > > > Doesn't. > > > > > As you suggested, I compared these with diff, ignoring the gratuitous > > > spacing modification using "diff -b". > > > > In the end, I don't think I can consider even one of your changes to > > > be an improvement. The closest you came to a useful change was the > > > capitalisation of "Real memory", but that's hardly necessary, and > > > the accompanying change to the next line upsets the formatting. > > > > Ofcourse it doesn't improve the functionality. > > And I get the feeling that's what you're all about. >=20 > Indeed, you understand correctly. Functionality is exactly what the > BSD family of OSs is all about. >=20 > Most kernel developers are busy with activities like improving system > performance on multi-CPU systems, increasing OS reliability with SATA > drives, and other activities of a deep and essential nature. I don't > generally tell the kernel developers what to do, because I know that > they know their own knowledge domain far better than I do. >=20 > [...] > > > In short, I think you should find some other way to pretty up your Fr= eeBSD > > > boot. As suggested earlier, try "man splash". > > > > Again, I want it to look correct. >=20 > The appearance is a matter of personal taste, and "de gustibus non > disputandum." Your claim that your personal preference is "correct" > does not cause other people to prefer it. >=20 > It should be clear by now that you are getting nowhere trying to > persuade others to implement this for you, so your only course is to > implement it yourself. If these changes matter a great deal to you, I > suggest you invest the sweat to change it on your own system. You have > all the sources, you have the power. If you don't know how yet, you > have the opportunity to learn. If you succeed and post public patches > to do it, then others can share the changes if they wish, and you will > get some smidgen of positive recognition and credibility. >=20 > If this matters so much to you, it should be worth your effort. >=20 > If you are incapable of making these changes, then your preferences > will get some smidgin less weight, as there will be that much less > evidence that your opinions should be valued. The open source world is > largely a meritocracy and technocracy; this is not to say that > "politics" and opinions play no part, but generally speaking "working > code wins." >=20 > Mostly people in the OSS world take it for granted that others > understand this, which may be why nobody has told you this in so many > words before now. >=20 > -- Clifton >=20 > -- > Clifton Royston -- cliftonr@tikitechnologies.com > Tiki Technologies Lead Programmer/Software Architect > "I'm gonna tell my son to grow up pretty as the grass is green > And whip-smart as the English Channel's wide..." > -- 'Whip-Smart', Liz Phair -- Fafa Hafiz Krantz Research Designer @ http://www.home.no/barbershop Enlightened @ http://www.home.no/barbershop/smart/sharon.pdf --=20 ___________________________________________________________ Sign-up for Ads Free at Mail.com http://promo.mail.com/adsfreejump.htm From owner-freebsd-arch@FreeBSD.ORG Fri May 13 16:05:24 2005 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5B49116A4CE for ; Fri, 13 May 2005 16:05:24 +0000 (GMT) Received: from www.portaone.com (web.portaone.com [195.70.151.35]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8089643D68 for ; Fri, 13 May 2005 16:05:23 +0000 (GMT) (envelope-from sobomax@FreeBSD.org) Received: from [192.168.4.107] (039sub211.uottawa.ca [137.122.39.144]) (authenticated bits=0) by www.portaone.com (8.12.11/8.12.11) with ESMTP id j4DG5KnA033978 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 13 May 2005 18:05:21 +0200 (CEST) (envelope-from sobomax@FreeBSD.org) Message-ID: <4284D038.50805@FreeBSD.org> Date: Fri, 13 May 2005 19:05:12 +0300 From: Maxim Sobolev User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Garance A Drosihn References: <200410020349.i923nG8v021675@northstar.hetzel.org> <20041002052856.GE17792@nexus.dglawrence.com> <20041002233542.GL714@nexus.dglawrence.com> <421DAD8F.6000704@portaone.com> In-Reply-To: Content-Type: multipart/mixed; boundary="------------000408000806020903010402" X-Virus-Scanned: ClamAV 0.83/876/Fri May 13 01:14:29 2005 on www.portaone.com X-Virus-Status: Clean cc: freebsd-arch@FreeBSD.org Subject: Re: Bug in #! processing - One More Time X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2005 16:05:24 -0000 This is a multi-part message in MIME format. --------------000408000806020903010402 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Attached please find patch which rips any special processing of command line arguments. It should put FreeBSD into the very same ship with the rest of unices and linuces out there. In addition it makes implemetation matching documentation, so that ENAMETOOLONG is only returned when interpreter name exceeds MAXSHELLCMDLEN. Previously, it has been returned when length of interpreter name plus length of all arguments exceeded MAXSHELLCMDLEN. If there is no objections I'd like to commit it in the next few days. This corresponds to the case (3) from the Garance's original message. I've run this change through buildworld. -Maxim Garance A Drosihn wrote: > At 12:33 PM +0200 2/24/05, Maxim Sobolev wrote: > >> Garance A Drosihn wrote: >> >>> >>> As I see it, we have the following choices to fix this: >>> >>> 1) MFC the January 31st change to kern/imgact_shell.c to 5.3-stable, >>> as it is. This means we haven't fixed the problem that people >>> complained about in 2002 and again in 2004. And I still think >>> it is "not appropriate" for the execve() system to be deciding >>> what '#' means on that line. The biggest advantage is that this >>> means 5.4-release will behave exactly the same as 3.5 through >>> 5.3-release have behaved. > > > We have the code-freeze coming up on Wednesday. It turns out the > Jan 31st change had some bugs in it, and afaik we are still coming > up with a better version of that for *current*, never mind -stable. > > At this point I think we should revert change 1.26.4.1 in -stable, > such that 5.4-release will behave the same way as all previous > releases. Which is to say, it will continue to look for '#' on > the shebang line, and ignore everything after one is found. > > I have a patch ready to do this, assuming people aren't too upset > at the idea. I just don't feel comfortable trying to rush through > multiple changes for this issue at the last minute. > --------------000408000806020903010402 Content-Type: text/plain; name="diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diff" Index: kern/imgact_shell.c =================================================================== RCS file: /home/ncvs/src/sys/kern/imgact_shell.c,v retrieving revision 1.32 diff -d -u -d -u -r1.32 imgact_shell.c --- kern/imgact_shell.c 25 Feb 2005 10:17:53 -0000 1.32 +++ kern/imgact_shell.c 13 May 2005 15:40:58 -0000 @@ -42,6 +42,41 @@ #define SHELLMAGIC 0x2321 #endif +static inline const char * +find_token_end(const char *bcp, const char *ecp) +{ + const char *cp; + + for (cp = bcp; cp < ecp; cp++) + if ((*cp == '\0') || (*cp == '\n') || (*cp == ' ') || + (*cp == '\t')) + break; + return cp; +} + +static inline const char * +find_whitespace_end(const char *bcp, const char *ecp) +{ + const char *cp; + + for (cp = bcp; cp < ecp; cp++) + if ((*cp == '\0') || (*cp == '\n') || ((*cp != ' ') && + (*cp != '\t'))) + break; + return cp; +} + +static inline const char * +find_line_end(const char *bcp, const char *ecp) +{ + const char *cp; + + for (cp = bcp; cp < ecp; cp++) + if ((*cp == '\0') || (*cp == '\n')) + break; + return cp; +} + /* * Shell interpreter image activator. An interpreter name beginning * at imgp->args->begin_argv is the minimal successful exit requirement. @@ -50,14 +85,16 @@ exec_shell_imgact(imgp) struct image_params *imgp; { - const char *image_header = imgp->image_header; - const char *ihp; - int error, offset; - size_t length, clength; + const char *bcp, *ecp; + int error, alength; + size_t rlength; struct vattr vattr; + const char *argv[2]; + int argv_len[2]; + bcp = imgp->image_header; /* a shell script? */ - if (((const short *) image_header)[0] != SHELLMAGIC) + if (((const short *)bcp)[0] != SHELLMAGIC) return(-1); /* @@ -65,7 +102,7 @@ * script. :-) */ if (imgp->interpreted) - return(ENOEXEC); + return (ENOEXEC); imgp->interpreted = 1; @@ -78,68 +115,52 @@ error = VOP_GETATTR(imgp->vp, &vattr, imgp->proc->p_ucred, curthread); if (error) return (error); + if (vattr.va_size < 3) + return (ENOEXEC); - clength = (vattr.va_size > MAXSHELLCMDLEN) ? - MAXSHELLCMDLEN : vattr.va_size; + ecp = bcp + vattr.va_size; /* - * Figure out the number of bytes that need to be reserved in the + * Parse the first line of the shell script which is necessary to + * figure out the number of bytes that need to be reserved in the * argument string to copy the contents of the interpreter's command * line into the argument string. */ - ihp = &image_header[2]; - offset = 0; - while (ihp < &image_header[clength]) { - /* Skip any whitespace */ - if ((*ihp == ' ') || (*ihp == '\t')) { - ihp++; - continue; - } - - /* End of line? */ - if ((*ihp == '\n') || (*ihp == '#') || (*ihp == '\0')) - break; - - /* Found a token */ - do { - offset++; - ihp++; - } while ((*ihp != ' ') && (*ihp != '\t') && (*ihp != '\n') && - (*ihp != '#') && (*ihp != '\0') && - (ihp < &image_header[clength])); - /* Include terminating nulls in the offset */ - offset++; - } - + argv[0] = find_whitespace_end(bcp + 2, ecp); + argv_len[0] = find_token_end(argv[0], ecp) - argv[0]; + /* Check that the name of interpreter is in allowed range */ + if (argv_len[0] > MAXSHELLCMDLEN) + return (ENAMETOOLONG); /* If the script gives a null line as the interpreter, we bail */ - if (offset == 0) + if (argv_len[0] == 0) return (ENOEXEC); - - /* Check that we aren't too big */ - if (ihp == &image_header[MAXSHELLCMDLEN]) - return (ENAMETOOLONG); + argv[1] = find_whitespace_end(argv[0] + argv_len[0], ecp); + argv_len[1] = find_line_end(argv[1], ecp) - argv[1]; /* * The full path name of the original script file must be tagged * onto the end, adjust the offset to deal with it. * - * The original argv[0] is being replaced, set 'length' to the number - * of bytes being removed. So 'offset' is the number of bytes being - * added and 'length' is the number of bytes being removed. + * The original argv[0] is being replaced, set 'rlength' to the number + * of bytes being removed. So 'alength' is the number of bytes being + * added and 'rlength' is the number of bytes being removed. */ - offset += strlen(imgp->args->fname) + 1; /* add fname */ - length = (imgp->args->argc == 0) ? 0 : + alength = argv_len[0] + argv_len[1] + + strlen(imgp->args->fname) + 1; /* add fname */ + alength += (argv_len[1] == 0) ? 1 : 2; /* compensate for NULs */ + rlength = (imgp->args->argc == 0) ? 0 : strlen(imgp->args->begin_argv) + 1; /* bytes to delete */ - if (offset - length > imgp->args->stringspace) + if (alength - rlength > imgp->args->stringspace) return (E2BIG); - bcopy(imgp->args->begin_argv + length, imgp->args->begin_argv + offset, - imgp->args->endp - (imgp->args->begin_argv + length)); + /* Move the rest of the arguments */ + bcopy(imgp->args->begin_argv + rlength, + imgp->args->begin_argv + alength, + imgp->args->endp - (imgp->args->begin_argv + rlength)); - offset -= length; /* calculate actual adjustment */ - imgp->args->begin_envv += offset; - imgp->args->endp += offset; - imgp->args->stringspace -= offset; + imgp->args->begin_envv += alength - rlength; + imgp->args->endp += alength - rlength; + imgp->args->stringspace -= alength - rlength; /* * If there were no arguments then we've added one, otherwise @@ -148,44 +169,29 @@ if (imgp->args->argc == 0) imgp->args->argc = 1; - /* - * Loop through the interpreter name yet again, copying as - * we go. - */ - ihp = &image_header[2]; - offset = 0; - while (ihp < &image_header[clength]) { - /* Skip whitespace */ - if ((*ihp == ' ') || (*ihp == '\t')) { - ihp++; - continue; - } - - /* End of line? */ - if ((*ihp == '\n') || (*ihp == '#') || (*ihp == '\0')) - break; - - /* Found a token, copy it */ - do { - imgp->args->begin_argv[offset++] = *ihp++; - } while ((*ihp != ' ') && (*ihp != '\t') && (*ihp != '\n') && - (*ihp != '#') && (*ihp != '\0') && - (ihp < &image_header[MAXSHELLCMDLEN])); - imgp->args->begin_argv[offset++] = '\0'; + /* Fill argv[0] and optionally argv[1] */ + bcopy(argv[0], imgp->args->begin_argv, argv_len[0]); + imgp->args->begin_argv[argv_len[0]] = '\0'; + imgp->args->argc++; + if (argv_len[1] != 0) { + bcopy(argv[1], imgp->args->begin_argv + argv_len[0] + 1, + argv_len[1]); + imgp->args->begin_argv[argv_len[0] + 1 + argv_len[1]] = '\0'; imgp->args->argc++; } + /* Add the filename as argv[1] or argv[2] for the interpreter to use */ + error = copystr(imgp->args->fname, imgp->args->begin_argv + + argv_len[0] + argv_len[1] + ((argv_len[1] == 0) ? 1 : 2), + imgp->args->stringspace, &rlength); + /* - * Finally, add the filename onto the end for the interpreter to - * use and copy the interpreter's name to imgp->interpreter_name - * for exec to use. + * Finally copy the interpreter's name including terminating + * NUL to imgp->interpreter_name for exec to use. */ - error = copystr(imgp->args->fname, imgp->args->buf + offset, - imgp->args->stringspace, &length); - if (error == 0) - error = copystr(imgp->args->begin_argv, imgp->interpreter_name, - MAXSHELLCMDLEN, &length); + bcopy(imgp->args->begin_argv, imgp->interpreter_name, + argv_len[0] + 1); return (error); } --------------000408000806020903010402-- From owner-freebsd-arch@FreeBSD.ORG Fri May 13 16:19:32 2005 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 085B116A538; Fri, 13 May 2005 16:19:32 +0000 (GMT) Received: from smtp4.server.rpi.edu (smtp4.server.rpi.edu [128.113.2.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9C96243D5F; Fri, 13 May 2005 16:19:31 +0000 (GMT) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.netel.rpi.edu [128.113.24.47]) by smtp4.server.rpi.edu (8.13.0/8.13.0) with ESMTP id j4DGJUbL003166; Fri, 13 May 2005 12:19:30 -0400 Mime-Version: 1.0 Message-Id: In-Reply-To: <4284D038.50805@FreeBSD.org> References: <200410020349.i923nG8v021675@northstar.hetzel.org> <20041002052856.GE17792@nexus.dglawrence.com> <20041002233542.GL714@nexus.dglawrence.com> <421DAD8F.6000704@portaone.com> <4284D038.50805@FreeBSD.org> Date: Fri, 13 May 2005 12:19:29 -0400 To: Maxim Sobolev From: Garance A Drosihn Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-CanItPRO-Stream: default X-RPI-SA-Score: undef - spam-scanning disabled X-Scanned-By: CanIt (www . canit . ca) on 128.113.2.4 cc: Paul Saab cc: freebsd-arch@FreeBSD.org Subject: Re: Bug in #! processing - One More Time X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2005 16:19:32 -0000 At 7:05 PM +0300 5/13/05, Maxim Sobolev wrote: >Attached please find patch which rips any special processing of >command line arguments. It should put FreeBSD into the very same >ship with the rest of unices and linuces out there. Actually, thanks to a message from Paul Saab last weekend, I've been working on this change for much of the past week. I want to make sure that this time we get the change right. As near as I can tell, every single change which has been made to this file in the past year has been wrong in one way or another, so I've been extra-paranoid that I understand what is going on and why it's going on... -- Garance Alistair Drosehn = gad@gilead.netel.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu From owner-freebsd-arch@FreeBSD.ORG Fri May 13 16:24:39 2005 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5992416A4CE; Fri, 13 May 2005 16:24:39 +0000 (GMT) Received: from www.portaone.com (support.portaone.com [195.70.151.35]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9784443D31; Fri, 13 May 2005 16:24:38 +0000 (GMT) (envelope-from sobomax@FreeBSD.org) Received: from [192.168.4.107] (039sub211.uottawa.ca [137.122.39.144]) (authenticated bits=0) by www.portaone.com (8.12.11/8.12.11) with ESMTP id j4DGOZFk037806 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 13 May 2005 18:24:36 +0200 (CEST) (envelope-from sobomax@FreeBSD.org) Message-ID: <4284D4BC.9070705@FreeBSD.org> Date: Fri, 13 May 2005 19:24:28 +0300 From: Maxim Sobolev User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Garance A Drosihn References: <200410020349.i923nG8v021675@northstar.hetzel.org> <20041002052856.GE17792@nexus.dglawrence.com> <20041002233542.GL714@nexus.dglawrence.com> <421DAD8F.6000704@portaone.com> <4284D038.50805@FreeBSD.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV 0.83/876/Fri May 13 01:14:29 2005 on www.portaone.com X-Virus-Status: Clean cc: Paul Saab cc: freebsd-arch@FreeBSD.org Subject: Re: Bug in #! processing - One More Time X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2005 16:24:39 -0000 Garance A Drosihn wrote: > At 7:05 PM +0300 5/13/05, Maxim Sobolev wrote: > >> Attached please find patch which rips any special processing of >> command line arguments. It should put FreeBSD into the very same >> ship with the rest of unices and linuces out there. > > > Actually, thanks to a message from Paul Saab last weekend, I've > been working on this change for much of the past week. I want to > make sure that this time we get the change right. As near as I > can tell, every single change which has been made to this file in > the past year has been wrong in one way or another, so I've been > extra-paranoid that I understand what is going on and why it's > going on... Well, let's agree that if I don't hear from you for another 2 days I'll commit my change, OK? -Maxim From owner-freebsd-arch@FreeBSD.ORG Fri May 13 16:45:32 2005 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DB62516A4CE; Fri, 13 May 2005 16:45:32 +0000 (GMT) Received: from smtp2.server.rpi.edu (smtp2.server.rpi.edu [128.113.2.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 786B243D77; Fri, 13 May 2005 16:45:32 +0000 (GMT) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.netel.rpi.edu [128.113.24.47]) by smtp2.server.rpi.edu (8.13.0/8.13.0) with ESMTP id j4DGjU1Q015343; Fri, 13 May 2005 12:45:31 -0400 Mime-Version: 1.0 Message-Id: In-Reply-To: <4284D4BC.9070705@FreeBSD.org> References: <200410020349.i923nG8v021675@northstar.hetzel.org> <20041002052856.GE17792@nexus.dglawrence.com> <20041002233542.GL714@nexus.dglawrence.com> <421DAD8F.6000704@portaone.com> <4284D038.50805@FreeBSD.org> <4284D4BC.9070705@FreeBSD.org> Date: Fri, 13 May 2005 12:45:29 -0400 To: Maxim Sobolev From: Garance A Drosihn Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-CanItPRO-Stream: default X-RPI-SA-Score: undef - spam-scanning disabled X-Scanned-By: CanIt (www . canit . ca) on 128.113.2.2 cc: Paul Saab cc: freebsd-arch@FreeBSD.org Subject: Re: Bug in #! processing - One More Time X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2005 16:45:33 -0000 At 7:24 PM +0300 5/13/05, Maxim Sobolev wrote: >Garance A Drosihn wrote: >>At 7:05 PM +0300 5/13/05, Maxim Sobolev wrote: >> >>>Attached please find patch which rips any special processing of >>>command line arguments. It should put FreeBSD into the very same >>>ship with the rest of unices and linuces out there. >> >>Actually, thanks to a message from Paul Saab last weekend, I've >>been working on this change for much of the past week. > >Well, let's agree that if I don't hear from you for another 2 days >I'll commit my change, OK? I should have done enough testing by Sunday evening to say something, one way or another. Sure. Note that I'm not just "running this through buildworld". That's how all the previous changes were tested, too. I have a whole battery of tests that I've been slogging through. And most the time I've been doing that, I've been muttering to myself "How did I talk myself into this?"... -- Garance Alistair Drosehn = gad@gilead.netel.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu From owner-freebsd-arch@FreeBSD.ORG Fri May 13 18:09:37 2005 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F273F16A4CE; Fri, 13 May 2005 18:09:36 +0000 (GMT) Received: from www.portaone.com (web.portaone.com [195.70.151.35]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4D8B043D83; Fri, 13 May 2005 18:09:36 +0000 (GMT) (envelope-from sobomax@FreeBSD.org) Received: from [192.168.4.107] (039sub211.uottawa.ca [137.122.39.144]) (authenticated bits=0) by www.portaone.com (8.12.11/8.12.11) with ESMTP id j4DI9VC1057740 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 13 May 2005 20:09:34 +0200 (CEST) (envelope-from sobomax@FreeBSD.org) Message-ID: <4284ED54.9010603@FreeBSD.org> Date: Fri, 13 May 2005 21:09:24 +0300 From: Maxim Sobolev User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Garance A Drosihn References: <200410020349.i923nG8v021675@northstar.hetzel.org> <20041002052856.GE17792@nexus.dglawrence.com> <20041002233542.GL714@nexus.dglawrence.com> <421DAD8F.6000704@portaone.com> <4284D038.50805@FreeBSD.org> <4284D4BC.9070705@FreeBSD.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV 0.83/876/Fri May 13 01:14:29 2005 on www.portaone.com X-Virus-Status: Clean cc: Paul Saab cc: freebsd-arch@FreeBSD.org Subject: Re: Bug in #! processing - One More Time X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2005 18:09:37 -0000 Garance A Drosihn wrote: > At 7:24 PM +0300 5/13/05, Maxim Sobolev wrote: > >> Garance A Drosihn wrote: >> >>> At 7:05 PM +0300 5/13/05, Maxim Sobolev wrote: >>> >>>> Attached please find patch which rips any special processing of >>>> command line arguments. It should put FreeBSD into the very same >>>> ship with the rest of unices and linuces out there. >>> >>> >>> Actually, thanks to a message from Paul Saab last weekend, I've >>> been working on this change for much of the past week. >> >> >> Well, let's agree that if I don't hear from you for another 2 days >> I'll commit my change, OK? > > > I should have done enough testing by Sunday evening to say something, > one way or another. Sure. Good, since this issue has been taking too much time to fix. > Note that I'm not just "running this through buildworld". That's how > all the previous changes were tested, too. I have a whole battery of > tests that I've been slogging through. And most the time I've been > doing that, I've been muttering to myself "How did I talk myself into > this?"... Well, I'd suggest you to put those tests into src/tools/regression, to ensure that this won't be broken occasionally in the future. -Maxim From owner-freebsd-arch@FreeBSD.ORG Fri May 13 18:09:46 2005 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 18CB216A4D2 for ; Fri, 13 May 2005 18:09:46 +0000 (GMT) Received: from sp.dominia.org (efnet-math.org [69.60.109.125]) by mx1.FreeBSD.org (Postfix) with ESMTP id 84F0443D69 for ; Fri, 13 May 2005 18:09:45 +0000 (GMT) (envelope-from ssouhlal@FreeBSD.org) Received: from [192.168.1.12] (63-170-138-118.cst-sg.blacksburg.ntc-com.net [63.170.138.118]) (authenticated bits=0) by sp.dominia.org (8.13.1/8.13.1) with ESMTP id j4DI9hcE023209 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NO) for ; Fri, 13 May 2005 14:09:44 -0400 Mime-Version: 1.0 (Apple Message framework v728) To: freebsd-arch@FreeBSD.org Message-Id: Content-Type: multipart/mixed; boundary=Apple-Mail-2-261623109 From: Suleiman Souhlal Date: Fri, 13 May 2005 14:09:36 -0400 X-Mailer: Apple Mail (2.728) Subject: [PATCH] Allow watching of vnodes that reside on non-UFS filesystems with kqueue X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2005 18:09:46 -0000 --Apple-Mail-2-261623109 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Hello, The patch at http://people.freebsd.org/~ssouhlal/testing/kqueue- hooks-20050509.diff makes EVFILT_VNODE kqueue filters work on any filesystem, and not just UFS, like it currently does. It does this by moving all the knote activations into VOP hooks. This behavior can be overridden, for (remote) filesystems where change notifications might come in a different way. According to a benchmark that I ran, this does not degrade performance (probably because the knote() function doesn't get called unless someone is watching the particular vnode, resulting in one less mutex acquisition) when no one is watching a vnode. You can find the benchmark results attached to this mail. rwatson assured me that this patch does not conflict with OpenBSM/ audit, and that he thinks that it's a good idea because "it simplifies filesystems and centralizes more common functionalities neatly in VFS as vnode properties". jmg ok'd the kqueue changes in an earlier version of this patch (although not much as changed). jeff is "inclined to support this diff". Any comments/objections before I commit this to HEAD? Bye, --Apple-Mail-2-261623109 Content-Transfer-Encoding: 7bit Content-Type: text/plain; x-unix-mode=0644; name="kqueue-hooks-bench.txt" Content-Disposition: attachment; filename=kqueue-hooks-bench.txt WITHOUT PATCH: %bonnie -------Sequential Output-------- ---Sequential Input-- --Random-- -Per Char- --Block--- -Rewrite-- -Per Char- --Block--- --Seeks--- Machine MB K/sec %CPU K/sec %CPU K/sec %CPU K/sec %CPU K/sec %CPU /sec %CPU 100 32391 90.1 26732 25.1 35221 38.8 37788 99.7 252279 100.0 20044.2 141.0 4.578u 3.855s 0:18.31 45.9% 1+17k 5+2145io 0pf+0w 2583c/6246w %bonnie -------Sequential Output-------- ---Sequential Input-- --Random-- -Per Char- --Block--- -Rewrite-- -Per Char- --Block--- --Seeks--- Machine MB K/sec %CPU K/sec %CPU K/sec %CPU K/sec %CPU K/sec %CPU /sec %CPU 100 27349 76.9 29570 27.7 33273 36.1 38038 100.0 252489 100.0 19479.0 153.7 4.181u 4.288s 0:18.69 45.2% 1+18k 0+2123io 0pf+0w 2269c/8465w %bonnie . -------Sequential Output-------- ---Sequential Input-- --Random-- -Per Char- --Block--- -Rewrite-- -Per Char- --Block--- --Seeks--- Machine MB K/sec %CPU K/sec %CPU K/sec %CPU K/sec %CPU K/sec %CPU /sec %CPU 100 30758 85.0 27033 25.3 38829 40.8 37869 99.7 251386 100.0 19110.4 156.1 4.395u 4.005s 0:18.18 46.1% 1+19k 1+1975io 0pf+0w 2274c/8849w nyuu# foreach i ( 1 2 3 ) Foreach? make -j 3 buildworld NO_IPFILTER=1 > /dev/null foreach? end 8083.315u 1007.560s 1:22:00.50 184.7% 391+244k 27712+3447io 1412pf+0w 824029c/711750w 8097.046u 1004.605s 1:21:18.68 186.5% 391+246k 10537+3534io 1191pf+0w 831965c/695294w 8098.296u 1024.747s 1:22:37.83 184.0% 390+244k 12473+3442io 439pf+0w 951639c/698819w WITH PATCH: %bonnie -------Sequential Output-------- ---Sequential Input-- --Random-- -Per Char- --Block--- -Rewrite-- -Per Char- --Block--- --Seeks--- Machine MB K/sec %CPU K/sec %CPU K/sec %CPU K/sec %CPU K/sec %CPU /sec %CPU 100 34134 94.3 23748 22.3 37425 41.7 37570 99.6 246146 99.6 20500.4 158.7 4.407u 4.075s 0:18.49 45.8% 1+17k 2+2142io 0pf+0w 2560c/8476w %bonnie -------Sequential Output-------- ---Sequential Input-- --Random-- -Per Char- --Block--- -Rewrite-- -Per Char- --Block--- --Seeks--- Machine MB K/sec %CPU K/sec %CPU K/sec %CPU K/sec %CPU K/sec %CPU /sec %CPU 100 30574 85.3 30099 28.1 34008 37.9 37588 99.6 247798 99.6 20564.0 158.6 3.928u 4.571s 0:18.20 46.6% 1+19k 0+2112io 0pf+0w 2514c/8501w %bonnie -------Sequential Output-------- ---Sequential Input-- --Random-- -Per Char- --Block--- -Rewrite-- -Per Char- --Block--- --Seeks--- Machine MB K/sec %CPU K/sec %CPU K/sec %CPU K/sec %CPU K/sec %CPU /sec %CPU 100 34741 95.9 26694 24.9 37612 41.1 37028 99.6 247715 99.9 18901.3 152.2 4.306u 4.187s 0:18.00 47.1% 1+17k 0+2145io 0pf+0w 2565c/8312w nyuu# foreach i ( 1 2 3 ) foreach? make -j 3 buildworld NO_IPFILTER=1 > /dev/null foreach? end 8117.377u 1007.894s 1:22:32.11 184.2% 392+244k 29839+3465io 1641pf+0w 837875c/721285w 8104.076u 1026.791s 1:21:31.15 186.6% 391+244k 10513+3468io 1188pf+0w 826879c/703385w 8104.517u 1016.058s 1:21:32.08 186.4% 392+244k 9949+3453io 435pf+0w 825781c/700621w --Apple-Mail-2-261623109 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed -- Suleiman Souhlal | ssouhlal@vt.edu The FreeBSD Project | ssouhlal@FreeBSD.org --Apple-Mail-2-261623109-- From owner-freebsd-arch@FreeBSD.ORG Fri May 13 21:52:40 2005 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4D36116A4CE; Fri, 13 May 2005 21:52:40 +0000 (GMT) Received: from smtp2.server.rpi.edu (smtp2.server.rpi.edu [128.113.2.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id CC2A643D6B; Fri, 13 May 2005 21:52:39 +0000 (GMT) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.netel.rpi.edu [128.113.24.47]) by smtp2.server.rpi.edu (8.13.0/8.13.0) with ESMTP id j4DLqawU002172; Fri, 13 May 2005 17:52:38 -0400 Mime-Version: 1.0 Message-Id: In-Reply-To: <4284ED54.9010603@FreeBSD.org> References: <200410020349.i923nG8v021675@northstar.hetzel.org> <20041002052856.GE17792@nexus.dglawrence.com> <20041002233542.GL714@nexus.dglawrence.com> <421DAD8F.6000704@portaone.com> <4284D038.50805@FreeBSD.org> <4284D4BC.9070705@FreeBSD.org> <4284ED54.9010603@FreeBSD.org> Date: Fri, 13 May 2005 17:52:36 -0400 To: Maxim Sobolev From: Garance A Drosihn Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-CanItPRO-Stream: default X-RPI-SA-Score: undef - spam-scanning disabled X-Scanned-By: CanIt (www . canit . ca) on 128.113.2.2 cc: Paul Saab cc: freebsd-arch@FreeBSD.org Subject: Re: Bug in #! processing - One More Time X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2005 21:52:40 -0000 At 9:09 PM +0300 5/13/05, Maxim Sobolev wrote: >Garance A Drosihn wrote: >> >>I should have done enough testing by Sunday evening to say >>something, one way or another. Sure. > >Good, since this issue has been taking too much time to fix. I'll admit to being guilty on that. >>Note that I'm not just "running this through buildworld". That's >>how all the previous changes were tested, too. I have a whole >>battery of tests that I've been slogging through. > >Well, I'd suggest you to put those tests into src/tools/regression, >to ensure that this won't be broken occasionally in the future. Well, there's some simply tests in ~gad/shellargs on the freefall.org machines. Copy the directory, 'make /tmp/shellargs', and then 'make run/tests'. These aren't quite in the right format for the standard regression-testing ideas, but they're in the ballpark. The main idea was to give me a way to check what *other* operating systems actually do with whatever is on the #!-line. The 'results' directory has the results from several hosts around here (@RPI). Linux, Solaris, AIX, IRIX. I also have a userland program written for testing imgact_shell.c itself, but that is a bit more bizarre. Still, it's what I felt I needed so I could do a lot of testing of perverse examples, without having to rebuild kernels and rebooting every 5 minutes. It also lets me test with triggering panics which kill the system, as had happened in some previous updates to imgact_shell. Not sure that program would make any sense in regression testing. Maybe if it was cleaned up a bit. Anyway, back to my testing... -- Garance Alistair Drosehn = gad@gilead.netel.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu From owner-freebsd-arch@FreeBSD.ORG Sat May 14 16:41:59 2005 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 601B916A4CE; Sat, 14 May 2005 16:41:59 +0000 (GMT) Received: from www.portaone.com (support.portaone.com [195.70.151.35]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1D02D43D72; Sat, 14 May 2005 16:41:58 +0000 (GMT) (envelope-from sobomax@FreeBSD.org) Received: from [192.168.1.144] (039sub204.uottawa.ca [137.122.39.154]) (authenticated bits=0) by www.portaone.com (8.12.11/8.12.11) with ESMTP id j4EFrlkh094987 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 14 May 2005 17:53:49 +0200 (CEST) (envelope-from sobomax@FreeBSD.org) Message-ID: <42861F04.4060004@FreeBSD.org> Date: Sat, 14 May 2005 18:53:40 +0300 From: Maxim Sobolev User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Garance A Drosihn References: <200410020349.i923nG8v021675@northstar.hetzel.org> <20041002052856.GE17792@nexus.dglawrence.com> <20041002233542.GL714@nexus.dglawrence.com> <421DAD8F.6000704@portaone.com> <4284D038.50805@FreeBSD.org> <4284D4BC.9070705@FreeBSD.org> <4284ED54.9010603@FreeBSD.org> In-Reply-To: Content-Type: multipart/mixed; boundary="------------000408060608050105030907" X-Virus-Scanned: ClamAV 0.83/876/Fri May 13 01:14:29 2005 on www.portaone.com X-Virus-Status: Clean cc: Paul Saab cc: freebsd-arch@FreeBSD.org Subject: Re: Bug in #! processing - One More Time X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 May 2005 16:41:59 -0000 This is a multi-part message in MIME format. --------------000408060608050105030907 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Great, I've catched one bug in my patch using this set of tests - whitespaces have not being trimmed from the end of the arguments line. Just in case attached is the updated patch. -Maxim Garance A Drosihn wrote: > At 9:09 PM +0300 5/13/05, Maxim Sobolev wrote: > >> Garance A Drosihn wrote: >> >>> >>> I should have done enough testing by Sunday evening to say >>> something, one way or another. Sure. >> >> >> Good, since this issue has been taking too much time to fix. > > > I'll admit to being guilty on that. > >>> Note that I'm not just "running this through buildworld". That's >>> how all the previous changes were tested, too. I have a whole >>> battery of tests that I've been slogging through. >> >> >> Well, I'd suggest you to put those tests into src/tools/regression, >> to ensure that this won't be broken occasionally in the future. > > > Well, there's some simply tests in ~gad/shellargs on the freefall.org > machines. Copy the directory, 'make /tmp/shellargs', and then > 'make run/tests'. These aren't quite in the right format for the > standard regression-testing ideas, but they're in the ballpark. The > main idea was to give me a way to check what *other* operating systems > actually do with whatever is on the #!-line. The 'results' directory > has the results from several hosts around here (@RPI). Linux, Solaris, > AIX, IRIX. > > I also have a userland program written for testing imgact_shell.c > itself, but that is a bit more bizarre. Still, it's what I felt I > needed so I could do a lot of testing of perverse examples, without > having to rebuild kernels and rebooting every 5 minutes. It also > lets me test with triggering panics which kill the system, as had > happened in some previous updates to imgact_shell. Not sure that > program would make any sense in regression testing. Maybe if it was > cleaned up a bit. > > Anyway, back to my testing... > --------------000408060608050105030907 Content-Type: text/plain; name="diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diff" Index: kern/imgact_shell.c =================================================================== RCS file: /home/ncvs/src/sys/kern/imgact_shell.c,v retrieving revision 1.32 diff -d -u -d -u -r1.32 imgact_shell.c --- kern/imgact_shell.c 25 Feb 2005 10:17:53 -0000 1.32 +++ kern/imgact_shell.c 14 May 2005 15:48:05 -0000 @@ -42,6 +42,48 @@ #define SHELLMAGIC 0x2321 #endif +static inline const char * +find_token_end(const char *bcp, const char *ecp) +{ + + for (; bcp < ecp; bcp++) + if ((*bcp == '\0') || (*bcp == '\n') || (*bcp == ' ') || + (*bcp == '\t')) + break; + return (bcp); +} + +static inline const char * +find_whitespace_end(const char *bcp, const char *ecp) +{ + + for (; bcp < ecp; bcp++) + if ((*bcp == '\0') || (*bcp == '\n') || ((*bcp != ' ') && + (*bcp != '\t'))) + break; + return (bcp); +} + +static inline const char * +find_line_end(const char *bcp, const char *ecp) +{ + + for (; bcp < ecp; bcp++) + if ((*bcp == '\0') || (*bcp == '\n')) + break; + return (bcp); +} + +static inline const char * +find_whitespace_begin(const char *bcp, const char *ecp) +{ + + for (; ecp > bcp; ecp--) + if ((ecp[-1] != ' ') && (ecp[-1] != '\t')) + break; + return (ecp); +} + /* * Shell interpreter image activator. An interpreter name beginning * at imgp->args->begin_argv is the minimal successful exit requirement. @@ -50,14 +92,16 @@ exec_shell_imgact(imgp) struct image_params *imgp; { - const char *image_header = imgp->image_header; - const char *ihp; - int error, offset; - size_t length, clength; + const char *bcp, *ecp; + int error, alength; + size_t rlength; struct vattr vattr; + const char *argv[2]; + int argv_len[2]; + bcp = imgp->image_header; /* a shell script? */ - if (((const short *) image_header)[0] != SHELLMAGIC) + if (((const short *)bcp)[0] != SHELLMAGIC) return(-1); /* @@ -65,7 +109,7 @@ * script. :-) */ if (imgp->interpreted) - return(ENOEXEC); + return (ENOEXEC); imgp->interpreted = 1; @@ -78,68 +122,53 @@ error = VOP_GETATTR(imgp->vp, &vattr, imgp->proc->p_ucred, curthread); if (error) return (error); + if (vattr.va_size < 3) + return (ENOEXEC); - clength = (vattr.va_size > MAXSHELLCMDLEN) ? - MAXSHELLCMDLEN : vattr.va_size; + ecp = bcp + vattr.va_size; /* - * Figure out the number of bytes that need to be reserved in the + * Parse the first line of the shell script which is necessary to + * figure out the number of bytes that need to be reserved in the * argument string to copy the contents of the interpreter's command * line into the argument string. */ - ihp = &image_header[2]; - offset = 0; - while (ihp < &image_header[clength]) { - /* Skip any whitespace */ - if ((*ihp == ' ') || (*ihp == '\t')) { - ihp++; - continue; - } - - /* End of line? */ - if ((*ihp == '\n') || (*ihp == '#') || (*ihp == '\0')) - break; - - /* Found a token */ - do { - offset++; - ihp++; - } while ((*ihp != ' ') && (*ihp != '\t') && (*ihp != '\n') && - (*ihp != '#') && (*ihp != '\0') && - (ihp < &image_header[clength])); - /* Include terminating nulls in the offset */ - offset++; - } - + argv[0] = find_whitespace_end(bcp + 2, ecp); + argv_len[0] = find_token_end(argv[0], ecp) - argv[0]; + /* Check that the name of interpreter is in allowed range */ + if (argv_len[0] > MAXSHELLCMDLEN) + return (ENAMETOOLONG); /* If the script gives a null line as the interpreter, we bail */ - if (offset == 0) + if (argv_len[0] == 0) return (ENOEXEC); - - /* Check that we aren't too big */ - if (ihp == &image_header[MAXSHELLCMDLEN]) - return (ENAMETOOLONG); + argv[1] = find_whitespace_end(argv[0] + argv_len[0], ecp); + argv_len[1] = find_whitespace_begin(argv[1], + find_line_end(argv[1], ecp)) - argv[1]; /* * The full path name of the original script file must be tagged * onto the end, adjust the offset to deal with it. * - * The original argv[0] is being replaced, set 'length' to the number - * of bytes being removed. So 'offset' is the number of bytes being - * added and 'length' is the number of bytes being removed. + * The original argv[0] is being replaced, set 'rlength' to the number + * of bytes being removed. So 'alength' is the number of bytes being + * added and 'rlength' is the number of bytes being removed. */ - offset += strlen(imgp->args->fname) + 1; /* add fname */ - length = (imgp->args->argc == 0) ? 0 : + alength = argv_len[0] + argv_len[1] + + strlen(imgp->args->fname) + 1; /* add fname */ + alength += (argv_len[1] == 0) ? 1 : 2; /* compensate for NULs */ + rlength = (imgp->args->argc == 0) ? 0 : strlen(imgp->args->begin_argv) + 1; /* bytes to delete */ - if (offset - length > imgp->args->stringspace) + if (alength - rlength > imgp->args->stringspace) return (E2BIG); - bcopy(imgp->args->begin_argv + length, imgp->args->begin_argv + offset, - imgp->args->endp - (imgp->args->begin_argv + length)); + /* Move the rest of the arguments */ + bcopy(imgp->args->begin_argv + rlength, + imgp->args->begin_argv + alength, + imgp->args->endp - (imgp->args->begin_argv + rlength)); - offset -= length; /* calculate actual adjustment */ - imgp->args->begin_envv += offset; - imgp->args->endp += offset; - imgp->args->stringspace -= offset; + imgp->args->begin_envv += alength - rlength; + imgp->args->endp += alength - rlength; + imgp->args->stringspace -= alength - rlength; /* * If there were no arguments then we've added one, otherwise @@ -148,44 +177,29 @@ if (imgp->args->argc == 0) imgp->args->argc = 1; - /* - * Loop through the interpreter name yet again, copying as - * we go. - */ - ihp = &image_header[2]; - offset = 0; - while (ihp < &image_header[clength]) { - /* Skip whitespace */ - if ((*ihp == ' ') || (*ihp == '\t')) { - ihp++; - continue; - } - - /* End of line? */ - if ((*ihp == '\n') || (*ihp == '#') || (*ihp == '\0')) - break; - - /* Found a token, copy it */ - do { - imgp->args->begin_argv[offset++] = *ihp++; - } while ((*ihp != ' ') && (*ihp != '\t') && (*ihp != '\n') && - (*ihp != '#') && (*ihp != '\0') && - (ihp < &image_header[MAXSHELLCMDLEN])); - imgp->args->begin_argv[offset++] = '\0'; + /* Fill argv[0] and optionally argv[1] */ + bcopy(argv[0], imgp->args->begin_argv, argv_len[0]); + imgp->args->begin_argv[argv_len[0]] = '\0'; + imgp->args->argc++; + if (argv_len[1] != 0) { + bcopy(argv[1], imgp->args->begin_argv + argv_len[0] + 1, + argv_len[1]); + imgp->args->begin_argv[argv_len[0] + 1 + argv_len[1]] = '\0'; imgp->args->argc++; } + /* Add the filename as argv[1] or argv[2] for the interpreter to use */ + error = copystr(imgp->args->fname, imgp->args->begin_argv + + argv_len[0] + argv_len[1] + ((argv_len[1] == 0) ? 1 : 2), + imgp->args->stringspace, &rlength); + /* - * Finally, add the filename onto the end for the interpreter to - * use and copy the interpreter's name to imgp->interpreter_name - * for exec to use. + * Finally copy the interpreter's name including terminating + * NUL to imgp->interpreter_name for exec to use. */ - error = copystr(imgp->args->fname, imgp->args->buf + offset, - imgp->args->stringspace, &length); - if (error == 0) - error = copystr(imgp->args->begin_argv, imgp->interpreter_name, - MAXSHELLCMDLEN, &length); + bcopy(imgp->args->begin_argv, imgp->interpreter_name, + argv_len[0] + 1); return (error); } --------------000408060608050105030907--