From owner-svn-src-head@FreeBSD.ORG Mon Sep 6 08:31:07 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8D4AF1065673; Mon, 6 Sep 2010 08:31:07 +0000 (UTC) (envelope-from prvs=1858bec45e=brian@FreeBSD.org) Received: from idcmail-mo2no.shaw.ca (idcmail-mo2no.shaw.ca [64.59.134.9]) by mx1.freebsd.org (Postfix) with ESMTP id 356E68FC13; Mon, 6 Sep 2010 08:31:06 +0000 (UTC) Received: from pd7ml1no-ssvc.prod.shaw.ca ([10.0.153.161]) by pd7mo1no-svcs.prod.shaw.ca with ESMTP; 06 Sep 2010 02:16:05 -0600 X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.1 cv=AcJjKCdO+C1gfaz5PU+ZhOHJ3th58JHw7dR6QJZP96w= c=1 sm=1 a=vqC7KvwytMoA:10 a=VphdPIyG4kEA:10 a=MJPcHhXccCG8eBs0us8XwA==:17 a=6I5d2MoRAAAA:8 a=MMwg4So0AAAA:8 a=e1ekEgTtaHhNCCMSWWsA:9 a=KiRZqFuAG0I83v7jRoFa5SxRLwYA:4 a=CjuIK1q_8ugA:10 a=SV7veod9ZcQA:10 a=WJ3hkfHDukgA:10 a=duOM1DhI603l9pXQBbIA:9 a=0GY1c-86W7Ef1ToZwOwrUyCg8T8A:4 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 Received: from unknown (HELO store.lan.Awfulhak.org) ([70.79.162.198]) by pd7ml1no-dmz.prod.shaw.ca with ESMTP; 06 Sep 2010 02:16:04 -0600 Received: from store.lan.Awfulhak.org (localhost.localdomain [127.0.0.1]) by localhost (Email Security Appliance) with SMTP id 9B3D5C433AC_C84A2A9B; Mon, 6 Sep 2010 08:13:29 +0000 (GMT) Received: from gw.Awfulhak.org (gw.lan.Awfulhak.org [172.16.0.1]) by store.lan.Awfulhak.org (Sophos Email Appliance) with ESMTP id 31E83C46125_C84A2A6F; Mon, 6 Sep 2010 08:13:26 +0000 (GMT) Received: from dev.lan.Awfulhak.org (brian@dev.lan.Awfulhak.org [172.16.0.5]) by gw.Awfulhak.org (8.14.4/8.14.4) with ESMTP id o868DP33002825; Mon, 6 Sep 2010 01:13:25 -0700 (PDT) (envelope-from brian@FreeBSD.org) Date: Mon, 6 Sep 2010 01:13:18 -0700 From: Brian Somers To: Pawel Jakub Dawidek Message-ID: <20100906011318.3d5c0bb6@dev.lan.Awfulhak.org> In-Reply-To: <20100906064142.GF1900@garage.freebsd.pl> References: <201009060415.o864Fntq011178@svn.freebsd.org> <20100906064142.GF1900@garage.freebsd.pl> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; i386-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/j2cXCpszxfWZhQdr56FEFYh"; protocol="application/pgp-signature" Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r212247 - head/sbin/fdisk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 08:31:07 -0000 --Sig_/j2cXCpszxfWZhQdr56FEFYh Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Mon, 6 Sep 2010 08:41:42 +0200 Pawel Jakub Dawidek wro= te: > On Mon, Sep 06, 2010 at 04:15:49AM +0000, Brian Somers wrote: > > Author: brian > > Date: Mon Sep 6 04:15:49 2010 > > New Revision: 212247 > > URL: http://svn.freebsd.org/changeset/base/212247 > >=20 > > Log: > > Handle geli-encrypted root disk devices. > [...] > > if ((rv =3D regcomp(&re, "^(/dev/[a-z/]+[0-9]+)([sp][0-9]+)?[a-h]?$", > > REG_EXTENDED)) !=3D 0) > > errx(1, "regcomp() failed (%d)", rv); > > - if ((rv =3D regexec(&re, rootfs.f_mntfromname, NMATCHES, rm, 0)) !=3D= 0) > > + strlcpy(dev, rootfs.f_mntfromname, sizeof (dev)); > > + if ((s =3D strstr(dev, ".eli")) !=3D NULL) > > + memmove(s, s+4, strlen(s + 4) + 1); > > + > > + if ((rv =3D regexec(&re, dev, NMATCHES, rm, 0)) !=3D 0) > > errx(1, > > "mounted root fs resource doesn't match expectations (regexec returned= %d)", > > rv); >=20 > Your assumption that .eli can only be present at the end of provider name > is incorrect. It can be eg. /dev/ad0s1a.eli.journal. >=20 > Another problem is that in memmove you cut the first 4 characters, not > the last 4 characters. >=20 > I'm not sure, but can't you simply extend regular expression to: >=20 > "^(/dev/[a-z/]+[0-9]+)([sp][0-9]+)?[a-h]?(\.eli)?$" You've lost me here. I remove .eli from the device name specifically so th= at we handle it being *anywhere* in the string. Your suggestion only handles it = being at the end of the string. The memmove doesn't cut the first four characters, it cuts the ".eli" strin= g.... doesn't it? --=20 Brian Somers Don't _EVER_ lose your sense of humour ! --Sig_/j2cXCpszxfWZhQdr56FEFYh Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iQCVAwUBTISipQ7tvOdmanQhAQJd2QP/fWXS6diqEolCAG9LCj7D5JjN07i9RUpO jAl+aMan8wY1iFhJxt+DBuR5s1y7NC7OTldZRkWzG4CKC/d3RhkPOVrsq5X191JZ O4LFxfJpg++VEGqJM1ciUQQMYRKxYoM5az5ANoOhkvnucUWXLLPnupc0wtuhDTRf vmnC4yPhYCw= =wrh8 -----END PGP SIGNATURE----- --Sig_/j2cXCpszxfWZhQdr56FEFYh--