From owner-freebsd-hackers@FreeBSD.ORG Wed Feb 10 00:48:00 2010 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BBABA1065670 for ; Wed, 10 Feb 2010 00:48:00 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: from mail-yw0-f184.google.com (mail-yw0-f184.google.com [209.85.211.184]) by mx1.freebsd.org (Postfix) with ESMTP id 7099E8FC1D for ; Wed, 10 Feb 2010 00:48:00 +0000 (UTC) Received: by ywh14 with SMTP id 14so812366ywh.28 for ; Tue, 09 Feb 2010 16:47:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:mime-version :content-type:from:in-reply-to:date:cc:content-transfer-encoding :message-id:references:to:x-mailer; bh=gobZMM8twj17hqn4N8JfeUVQfnhnXnE+OZ4XTFFnnlM=; b=C2/mnhTbmo5rNfcCQ7/hXrcOnVF9pdKMU6z9o7BRCrOtp+SAuLMNj+/f8J7v4IHizB 055zDhleVUGiVWebKqwb388u5TtUXP8v3/+ihLZBxmJoTjGGM5h2Eh1zDp+lakAMsMnZ ib5hwuRa/t4YrIz9GPMwsojJBMzihlAU2X0zE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; b=Kr3w5EhVHW82ozFVA3JCg/nAtrVTpxAPAYr3bRKCgsIq/W2wAUML1h6PiSJUr8ydjQ JSCboIV1LyWqn4rQX9hj0RBq5GgWKJrrEpeYNMUCBidwoV5kSuLCFYWhAKhlHt+vLi58 dMLjcurdXMSxu8OrJeTQ4S9oY/htsyq3x2S1c= Received: by 10.150.169.1 with SMTP id r1mr1228412ybe.216.1265762879640; Tue, 09 Feb 2010 16:47:59 -0800 (PST) Received: from dhcp-173-37-1-138.cisco.com (nat.ironport.com [63.251.108.100]) by mx.google.com with ESMTPS id 5sm236784yxg.46.2010.02.09.16.47.57 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 09 Feb 2010 16:47:58 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v1077) Content-Type: text/plain; charset=us-ascii From: Garrett Cooper In-Reply-To: <20100210001937.GU391@bunrab.catwhisker.org> Date: Tue, 9 Feb 2010 16:47:56 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <6A6276EA-27D4-4BC2-A4A9-EFF190D3EB10@gmail.com> References: <86tytqvwky.fsf@ds4.des.no> <26049703-8844-4476-B277-776A4EFC0A53@gmail.com> <20100210001937.GU391@bunrab.catwhisker.org> To: David Wolfskill X-Mailer: Apple Mail (2.1077) Cc: hackers@freebsd.org Subject: Re: sysctl with regex? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Feb 2010 00:48:00 -0000 On Feb 9, 2010, at 4:19 PM, David Wolfskill wrote: > On Tue, Feb 09, 2010 at 04:14:12PM -0800, Garrett Cooper wrote: >> ... >> I'll see if I can whip up a quick patch in the next day or so -- = but before I do that, does it make more sense to do globs or regular = expressions? There are pluses and minuses to each version and would = require some degree of parsing (and potentially escaping). >> ... >=20 > I believe it's easier to be precise about exactly what is wanted with = a > regex (vs. a glob). >=20 > On the other hand, globs tend to be "quick & dirty" (in my = experience). ;-} Your doppleganger's Andrew :o? Regexps have a certain degree of ambiguity with them, as the = following is a valid regexp: sysctl dev\.cpu\..*\.temperature Assuming the correct periods are escaped, this would be a minor = bug-prone task to complete. Whereas this form will return different results from what you = want most likely (note the subtle difference with the extra period): sysctl dev\.cpu.*\.temperature Globs in this case don't buy you that much difference for what = you want, and (IMO) add unnecessary complexity to the problem as you can = still apply basic character classes, et all. Thanks, -Garrett=