Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Mar 2002 16:06:32 +0000
From:      "J. Mallett" <jmallett@FreeBSD.ORG>
To:        "J. Mallett" <jmallett@FreeBSD.ORG>
Cc:        "Tim J. Robbins" <tim@robbins.dropbear.id.au>, freebsd-audit@FreeBSD.ORG, freebsd-standards@FreeBSD.ORG
Subject:   Re: patch for review: xargs standards compliance
Message-ID:  <20020322160631.A31375@FreeBSD.ORG>
In-Reply-To: <20020322151214.A26549@FreeBSD.ORG>
References:  <20020315231100.A20942@FreeBSD.ORG> <20020316192629.A5254@descent.robbins.dropbear.id.au> <20020316090004.A26394@FreeBSD.ORG> <xzpd6y4voj9.fsf@flood.ping.uio.no> <20020316093507.B26394@FreeBSD.ORG> <xzp8z8svni7.fsf@flood.ping.uio.no> <20020316101434.A2192@FreeBSD.ORG> <20020322035231.A23277@FreeBSD.ORG> <20020322160802.B1338@descent.robbins.dropbear.id.au> <20020322151214.A26549@FreeBSD.ORG>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Mar 22, 2002 at 03:12:15PM +0000, J. Mallett wrote:
> 
> Well, given all the input thus far, I'd like to commit
> 	http://people.freebsd.org/~jmallett/xargs.patch4
> 

However I just pulled up the SUS spec online and found I was 
misremembering how exactly things were worded, and realised that strnsubst 
needs run with a n of 5 for each argument, not for the entire arguments 
list.

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...

Thoughts?

Anyway, here's with strnsubst() taking yet another size_t argument, and it 
being used to set the maximum size, and checks as I think the standard 
permits it.  The way I've done it is to ensure we either get as much of 
the input string as possible, or we continue concatenating.  This 
sometimes results in arguments less than 255 bytes, but will never result 
in a higher amount.  The standard is not clear enough on this point in my 
opinion, and so it is up to the implementation what to do to ensure it 
never grows beyond 255 bytes per argument, I suppose, in whatever way is 
seen fit.

	http://people.freebsd.org/~jmallett/xargs.patch5

This is being copied to -standards, as now I am getting into the grounds 
of interpereting SUS, and I'd rather not do that without review in 
principle as well as in code.

Thank you,
	/j.

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




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