From owner-freebsd-audit Fri Mar 22 20: 2:21 2002 Delivered-To: freebsd-audit@freebsd.org Received: from descent.robbins.dropbear.id.au (254.d.010.mel.iprimus.net.au [210.50.203.254]) by hub.freebsd.org (Postfix) with ESMTP id D858337B419; Fri, 22 Mar 2002 20:02:13 -0800 (PST) Received: (from tim@localhost) by descent.robbins.dropbear.id.au (8.11.6/8.11.6) id g2N415a03833; Sat, 23 Mar 2002 15:01:05 +1100 (EST) (envelope-from tim) Date: Sat, 23 Mar 2002 15:01:05 +1100 From: "Tim J. Robbins" To: "J. Mallett" Cc: freebsd-audit@FreeBSD.ORG, freebsd-standards@FreeBSD.ORG Subject: Re: patch for review: xargs standards compliance Message-ID: <20020323150105.A3813@descent.robbins.dropbear.id.au> References: <20020316192629.A5254@descent.robbins.dropbear.id.au> <20020316090004.A26394@FreeBSD.ORG> <20020316093507.B26394@FreeBSD.ORG> <20020316101434.A2192@FreeBSD.ORG> <20020322035231.A23277@FreeBSD.ORG> <20020322160802.B1338@descent.robbins.dropbear.id.au> <20020322151214.A26549@FreeBSD.ORG> <20020322160631.A31375@FreeBSD.ORG> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20020322160631.A31375@FreeBSD.ORG>; from jmallett@FreeBSD.ORG on Fri, Mar 22, 2002 at 04:06:32PM +0000 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Fri, Mar 22, 2002 at 04:06:32PM +0000, J. Mallett wrote: > One thing I am now unsure of that I'd forgotten all about is: > "Constructed arguments cannot grow larger than 255 bytes. " > > Should I errx() if strlen(*tmp) is >255, or should I augment strnsubst() > to take a size argument and not allow more than that amount to be > allocated, and furthermore, do I strlcat replstr for each match, or do I > do checks along the way to see if it is time to give up on replacing, and > just concatenate the rest of the string. I *think* given the language > relating to umber of replacements in the argument list, that I should TRY > to replace as many times as possible, up to five... $ echo hello | xargs -I xxx echo `perl -e 'print "A"x255;'`xxx xargs: Maximum argument size with insertion via xxx's exceeded Segmentation Fault $ uname -sr SunOS 5.8 Since SUS is biased towards SysV, you should probably print an error message and exit like Solaris tries to; no need for you to segfault like they do though ;) Also: $ echo hello | xargs -Ixxx a xxx b xxx c xxx d xxx e xxx f xxx xargs: too many args with xxx So it seems you should quit with an error when either of these limits are reached. This seems to be a flaw in the standard because these limits are (a) artifically low and (b) cannot be raised by implementors. Tim To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message