From owner-svn-src-all@FreeBSD.ORG Mon Sep 6 06:42:15 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A10C010656B0; Mon, 6 Sep 2010 06:42:15 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 0344C8FC0A; Mon, 6 Sep 2010 06:42:04 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id F3E3645CD8; Mon, 6 Sep 2010 08:42:01 +0200 (CEST) Received: from localhost (chello089077043238.chello.pl [89.77.43.238]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 0253045C9C; Mon, 6 Sep 2010 08:41:56 +0200 (CEST) Date: Mon, 6 Sep 2010 08:41:42 +0200 From: Pawel Jakub Dawidek To: Brian Somers Message-ID: <20100906064142.GF1900@garage.freebsd.pl> References: <201009060415.o864Fntq011178@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="DNUSDXU7R7AVVM8C" Content-Disposition: inline In-Reply-To: <201009060415.o864Fntq011178@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 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-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 06:42:15 -0000 --DNUSDXU7R7AVVM8C Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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); Your assumption that .eli can only be present at the end of provider name is incorrect. It can be eg. /dev/ad0s1a.eli.journal. Another problem is that in memmove you cut the first 4 characters, not the last 4 characters. I'm not sure, but can't you simply extend regular expression to: "^(/dev/[a-z/]+[0-9]+)([sp][0-9]+)?[a-h]?(\.eli)?$" --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --DNUSDXU7R7AVVM8C Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkyEjSUACgkQForvXbEpPzRmwwCeOC5ba4WlfmGirPXY7nOTOrwl UIsAoNnODx5+1P9APsXYqMqc5YsEn3T+ =xKD+ -----END PGP SIGNATURE----- --DNUSDXU7R7AVVM8C--