From unknown Wed Jun 18 23:04:46 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#22820 <22820@debbugs.gnu.org> To: bug#22820 <22820@debbugs.gnu.org> Subject: Status: grep: Misleading error message when presenting a badly formed character class Reply-To: bug#22820 <22820@debbugs.gnu.org> Date: Thu, 19 Jun 2025 06:04:46 +0000 retitle 22820 grep: Misleading error message when presenting a badly formed= character class reassign 22820 grep submitter 22820 santiagorr@riseup.net severity 22820 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 26 09:51:36 2016 Received: (at submit) by debbugs.gnu.org; 26 Feb 2016 14:51:36 +0000 Received: from localhost ([127.0.0.1]:47074 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aZJk0-0005Vo-AL for submit@debbugs.gnu.org; Fri, 26 Feb 2016 09:51:36 -0500 Received: from eggs.gnu.org ([208.118.235.92]:39216) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aZJjz-0005Vb-2T for submit@debbugs.gnu.org; Fri, 26 Feb 2016 09:51:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aZJjt-0005yy-82 for submit@debbugs.gnu.org; Fri, 26 Feb 2016 09:51:30 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:34240) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZJjt-0005yu-5D for submit@debbugs.gnu.org; Fri, 26 Feb 2016 09:51:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58420) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZJjs-0000ZC-Dk for bug-grep@gnu.org; Fri, 26 Feb 2016 09:51:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aZJjn-0005yU-Ae for bug-grep@gnu.org; Fri, 26 Feb 2016 09:51:28 -0500 Received: from mx1.riseup.net ([198.252.153.129]:51337) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZJjn-0005yO-3W for bug-grep@gnu.org; Fri, 26 Feb 2016 09:51:23 -0500 Received: from piha.riseup.net (unknown [10.0.1.163]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "*.riseup.net", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.riseup.net (Postfix) with ESMTPS id C47F61A1D76 for ; Fri, 26 Feb 2016 14:51:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1456498281; bh=dSJj3//5rGfvlkY5FkDTiG43GYVazquoxrbWvyFqHkk=; h=Date:From:To:Subject:From; b=dPWX3fWeDDOfuB3S2gYxLc/S/BZbT4qa/mflPHNp8c2Rjx97JS1RzLU+dH8uxT7PW n7jFJBrBq+Fa87Lmsx0Ez4Mt5fgimF4Gizb/k1Alq9zoAklYjw3k2hBoU6X0oR6QK4 fnl0mkn1Q5EGn3XpW6xvg6vktwPw9XSCApGoNHWA= Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: santiagorr) with ESMTPSA id 55ABD1C008C Received: by nomada (sSMTP sendmail emulation); Fri, 26 Feb 2016 15:51:18 +0100 Date: Fri, 26 Feb 2016 15:51:18 +0100 From: santiagorr@riseup.net To: bug-grep Subject: grep: Misleading error message when presenting a badly formed character class Message-ID: <20160226145118.GA10833@riseup.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline X-Virus-Scanned: clamav-milter 0.98.7 at mx1.riseup.net X-Virus-Status: Clean Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.4 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.4 (----) Hi, I'd like to forward a bug filled by Gunnar Wolf in Debian some time ago: "It seems that whenever egrep finds something it cannot digest inside a character class, it spews out the same error string: =ABUnmatched [ or [^= =BB. This can be misleading and opens the way for long debugging time, specially when trying to understand complex regexes. To illustrate the point: $ echo | egrep -v '[[:digit]]+' egrep: Unmatched [ or [^ The brackets _are_ balanced, however the character class is not (it lacks a finishing colon)." Thanks, Santiago From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 26 11:50:00 2016 Received: (at 22820-done) by debbugs.gnu.org; 26 Feb 2016 16:50:00 +0000 Received: from localhost ([127.0.0.1]:47833 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aZLaa-000062-J7 for submit@debbugs.gnu.org; Fri, 26 Feb 2016 11:50:00 -0500 Received: from mail-oi0-f53.google.com ([209.85.218.53]:35490) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aZLaY-00005o-Mb for 22820-done@debbugs.gnu.org; Fri, 26 Feb 2016 11:49:59 -0500 Received: by mail-oi0-f53.google.com with SMTP id w80so9177827oiw.2 for <22820-done@debbugs.gnu.org>; Fri, 26 Feb 2016 08:49:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=HTvzIFfqFfniyEgqvD4fF+LFlEoxlrGKOl7O2uQCWd0=; b=jv/P4NAs09EIm1Z9Mb9uDWdc/T0aRzSnxNWPqxILAIdU3TBHTech8LECcrtCuXOpSd cviV7+aDw5ACxh6vvDDUrh4bvZkDyANGB43s/03IjSJtpq9646E0HpUV1si2KnIWHjsX oikzimvn70j1ICsNeg4HsgPk0Pz0X7bwRCUfQJQXUSwMDZNuAN2F9Rywfmc2VHF4j/+Z +AprgIxvI3UsgccSaZT0ejajyi6y7uH4dJR9b4DtYmCS81S6IOyHTA16p80ywziJHQ7S PaS6cea9FacSOFPCztciMYIi9pdoTJs/ZffF7kFoBuEwj4+MDTfmxdisHpkOpKjgd2Fb 44/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=HTvzIFfqFfniyEgqvD4fF+LFlEoxlrGKOl7O2uQCWd0=; b=fKC0PucTP+NlUPySfsj+PTlP6yyK4jJWzfJsYXLjd1FwvMDfyUsJHjQS90N++V3ElL nzhrPLkNzbpPGyflV3j88n8gM8bdE8qVGRsp/+iX4goQl6hsJgTp4R21meqejU9pQpyl bObjxz1GiCIRQMUZo0y2cCSzsqSs5a3pJmtyXelKyrps//996bRIpm5CJla7dY9AXihG v2TbumYPR5W8wq9/UWAGp7g0+AO/iP+thOLszHLmL4mG55cEhGC+mjvMtj646XPY7KZf 5cPKxwugRvL5nm/l7jfrAJ7r9eZPtH8swCEPn3AK1TfdQok4wjbLeq2f04bYtd+mO2JB eCtw== X-Gm-Message-State: AD7BkJIjbPfi/oOwYltzg5iWtyO37J93v8y9uG3cPQVNIRGVMSLYOa5VVzsLK9wYM3YygRhSJ3jm1KBj7NMwWg== X-Received: by 10.202.84.82 with SMTP id i79mr1908176oib.130.1456505393165; Fri, 26 Feb 2016 08:49:53 -0800 (PST) MIME-Version: 1.0 Received: by 10.202.44.194 with HTTP; Fri, 26 Feb 2016 08:49:32 -0800 (PST) In-Reply-To: <20160226145118.GA10833@riseup.net> References: <20160226145118.GA10833@riseup.net> From: Jim Meyering Date: Fri, 26 Feb 2016 08:49:32 -0800 X-Google-Sender-Auth: P7yy-oKwsuKkCdAiKHMDt3M1NNM Message-ID: Subject: Re: bug#22820: grep: Misleading error message when presenting a badly formed character class To: Bailes Magio Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.5 (/) X-Debbugs-Envelope-To: 22820-done Cc: 22820-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) On Fri, Feb 26, 2016 at 6:51 AM, wrote: > Hi, > > I'd like to forward a bug filled by Gunnar Wolf in Debian some time > ago: > > "It seems that whenever egrep finds something it cannot digest inside a > character class, it spews out the same error string: =C2=ABUnmatched [ or= [^=C2=BB. > This can be misleading and opens the way for long debugging time, > specially when trying to understand complex regexes. To illustrate the > point: > > $ echo | egrep -v '[[:digit]]+' > egrep: Unmatched [ or [^ > > The brackets _are_ balanced, however the character class is not (it > lacks a finishing colon)." Thank you for forwarding that. The diagnostic was fixed in gnulib via a commit last month: git.savannah.gnu.org/cgit/gnulib.git/commit/?id=3D7c6e85cf4eccbd5129 Thus, as long as grep is configured --with-included-regex, you will now see this: $ grep -E '[[:digit]]+' grep: Unmatched [, [^, [:, [., or [=3D If grep is configure with --without-included-regex, you will still see the inferior diagnostic, but that string will then be coming from your system's C library. Since fixing glibc's copy of regcomp.c is outside the scope of grep's issue tracker, I'm marking this as "done". From unknown Wed Jun 18 23:04:46 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 26 Mar 2016 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator