From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1SgZkU-0000XE-Lm for mharc-grub-devel@gnu.org; Mon, 18 Jun 2012 07:03:58 -0400 Received: from eggs.gnu.org ([208.118.235.92]:37671) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SgZkO-0000Wm-7S for grub-devel@gnu.org; Mon, 18 Jun 2012 07:03:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SgZkE-0000ss-1Y for grub-devel@gnu.org; Mon, 18 Jun 2012 07:03:51 -0400 Received: from mail-bk0-f41.google.com ([209.85.214.41]:50634) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SgZkD-0000s0-OA for grub-devel@gnu.org; Mon, 18 Jun 2012 07:03:41 -0400 Received: by bkcjm19 with SMTP id jm19so4607469bkc.0 for ; Mon, 18 Jun 2012 04:03:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type; bh=8uYMrACHR0Z97H2VWTKlg33puSIdElytDhGXAjfAz+0=; b=hwKXKA9eyZZ8E6MtEdQF22iY3AEFYDmzAIA3+iaAFjTVFoMCH/EtQFwTxn2PX5yVl+ vYzQMhGLQrjG19oH/XIF1a5bfYVMiSiqKSZmmLXDLBk08JzhW8pPhO15N/r8N3UuGkYJ GTikJyid5K9Fh3wM8EuwpE7uMVBcuCVPwMlttqtfWpVqsbJwrJ0Ck3w2qP7QlJuR9OV5 vR7QsSD+5rBHsWHqrjNO/uGFFeJ6KTS4jVVw/opeJPVN4IWqVJQBYtlGDn4Iv3YrOh56 MgaFhFgxNaRycN7LHJzB78GN7RwOjhR82B+d01/h0c2segZvoY1B2cy/b7UF215DlO5s Qj7A== Received: by 10.205.127.140 with SMTP id ha12mr6134882bkc.105.1340017418999; Mon, 18 Jun 2012 04:03:38 -0700 (PDT) Received: from debian.x201.phnet (79-232.197-178.cust.bluewin.ch. [178.197.232.79]) by mx.google.com with ESMTPS id gm18sm18159130bkc.7.2012.06.18.04.03.37 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 18 Jun 2012 04:03:38 -0700 (PDT) Message-ID: <4FDF0AF3.3000503@gmail.com> Date: Mon, 18 Jun 2012 13:03:15 +0200 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.4) Gecko/20120510 Icedove/10.0.4 MIME-Version: 1.0 To: grub-devel@gnu.org Subject: Re: [PATCH] '.' causes wildcard expansion References: <4FD59694.3080600@comcast.net> <4FD91756.9080200@comcast.net> In-Reply-To: <4FD91756.9080200@comcast.net> X-Enigmail-Version: 1.4.1 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enig1EB4BF2CE81AC0FB6BBD93D3" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.214.41 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 11:03:58 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig1EB4BF2CE81AC0FB6BBD93D3 Content-Type: multipart/mixed; boundary="------------040906030700060609000906" This is a multi-part message in MIME format. --------------040906030700060609000906 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 14.06.2012 00:42, Robert Mabee wrote: > Having second thoughts. Where I suggested taking out this call >=20 >> - else if (isregexop (ch)) >> + else if (ch =3D=3D '*') /* only wildcard currently implement= ed */ > I should have just taken the extraneous '.' out of isregexop. It's used in other contexts as "needing escaping". So no, this part is fi= ne > That would > make it slightly simpler to add the remaining shell wildcards ('?' and = '[') > when desired. >=20 > '[' already works, Not properly: try a[b* > if there's also a * to trigger expansion, with the small > bug that special chars within [] still get escaped or translated so the= set > may include an unexpected '.' or '\'. >=20 > Other regex chars also work, which probably should be counted as a > bug. I assume the eventual goal is to behave just like a common shell.= Please try attached patch --=20 Regards Vladimir '=CF=86-coder/phcoder' Serbinenko --------------040906030700060609000906 Content-Type: text/x-diff; name="regex.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="regex.diff" =3D=3D=3D modified file 'grub-core/commands/wildcard.c' --- grub-core/commands/wildcard.c 2012-06-08 20:54:21 +0000 +++ grub-core/commands/wildcard.c 2012-06-18 11:01:31 +0000 @@ -80,7 +80,7 @@ merge (char **dest, char **ps) static inline int isregexop (char ch) { - return grub_strchr ("*.\\", ch) ? 1 : 0; + return grub_strchr ("*.\\|+{}[]", ch) ? 1 : 0; } =20 static char * @@ -128,14 +128,22 @@ make_regex (const char *start, const cha { case '\\': buffer[i++] =3D ch; - if (*start !=3D '\0') + if (*start =3D=3D '*' || *start =3D=3D '?') buffer[i++] =3D *start++; + else + buffer[i++] =3D '\\'; break; =20 case '.': case '(': case ')': case '@': + case '|': + case '+': + case '{': + case '}': + case '[': + case ']': buffer[i++] =3D '\\'; buffer[i++] =3D ch; break; @@ -145,6 +153,10 @@ make_regex (const char *start, const cha buffer[i++] =3D '*'; break; =20 + case '?': + buffer[i++] =3D '.'; + break; + default: buffer[i++] =3D ch; } @@ -181,7 +193,7 @@ split_path (const char *str, const char if (ch =3D=3D '\\' && end[1]) end++; =20 - else if (isregexop (ch)) + else if (ch =3D=3D '*' || ch =3D=3D '?') regex =3D 1; =20 else if (ch =3D=3D '/' && ! regex) --------------040906030700060609000906-- --------------enig1EB4BF2CE81AC0FB6BBD93D3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iF4EAREKAAYFAk/fCwQACgkQNak7dOguQgk5kAEAqReX05/bRJ3SJC13FjsbqdGO hD4nCzsgOxAQJu3wuvcA/318lN5Yk86rGwaqHFY0wHdKx0zAVJfAdXwxmB+DZcp5 =QV/7 -----END PGP SIGNATURE----- --------------enig1EB4BF2CE81AC0FB6BBD93D3--