From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#24914: 24.5; isearch-regexp: wrong error message Date: Mon, 04 Dec 2017 20:18:02 -0500 Message-ID: <87h8t6gegl.fsf@users.sourceforge.net> References: <7c208ac0-8aa2-4db8-a38d-760f91c50500@default> <87h8t7ix7m.fsf@users.sourceforge.net> <87d13visrh.fsf@users.sourceforge.net> <87shcrgg8g.fsf@users.sourceforge.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1512436749 22476 195.159.176.226 (5 Dec 2017 01:19:09 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 5 Dec 2017 01:19:09 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) Cc: 24914@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Dec 05 02:19:05 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eM1t2-0005ct-Ns for geb-bug-gnu-emacs@m.gmane.org; Tue, 05 Dec 2017 02:19:04 +0100 Original-Received: from localhost ([::1]:45909 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eM1t9-0003AZ-PC for geb-bug-gnu-emacs@m.gmane.org; Mon, 04 Dec 2017 20:19:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48795) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eM1t3-0003AR-LI for bug-gnu-emacs@gnu.org; Mon, 04 Dec 2017 20:19:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eM1t0-0001uL-Gn for bug-gnu-emacs@gnu.org; Mon, 04 Dec 2017 20:19:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:37476) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eM1t0-0001u6-Cp for bug-gnu-emacs@gnu.org; Mon, 04 Dec 2017 20:19:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eM1sz-0008OS-SH for bug-gnu-emacs@gnu.org; Mon, 04 Dec 2017 20:19:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 05 Dec 2017 01:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24914 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed Original-Received: via spool by 24914-submit@debbugs.gnu.org id=B24914.151243669332211 (code B ref 24914); Tue, 05 Dec 2017 01:19:01 +0000 Original-Received: (at 24914) by debbugs.gnu.org; 5 Dec 2017 01:18:13 +0000 Original-Received: from localhost ([127.0.0.1]:46157 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eM1sC-0008NT-Ts for submit@debbugs.gnu.org; Mon, 04 Dec 2017 20:18:13 -0500 Original-Received: from mail-it0-f44.google.com ([209.85.214.44]:37525) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eM1sB-0008NE-9m for 24914@debbugs.gnu.org; Mon, 04 Dec 2017 20:18:11 -0500 Original-Received: by mail-it0-f44.google.com with SMTP id d137so11396851itc.2 for <24914@debbugs.gnu.org>; Mon, 04 Dec 2017 17:18:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=TBZtFW3e74UDOXnxrcJBH1tN/+OIG0UGjj0WW4Kv4zU=; b=oZAgrjDEU0OGYTEvAtODDxL1KXOxo4ztivdbiTxkNA2OeRGVHUVJpGUvcgb55PzyGo BuLIrYIcmTnMwUXFFnNViPBPFWquQeqYMkcHWPWhNGLVfKIiwhCl7pymVlkUJQ0z/Y2X vFkIhjWZ+17pvuGcm0JulIGD0UnglIdb2nRfbqWy3wOAc/MvVkcfApcni3VgF2lo+5Qv qXGX6XnX7iUxYuv21cGwWZAnQCFCbD8dblcmiDEWat58MXiChO0Vr0HLxq/ELudlU3Vc Uv2lhuc11rnEbXIMDDgDfMOkwU/C/eP2JKae5ZNOSjga+oQTVfuoQdasJO5O4ES4zMAE PQyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=TBZtFW3e74UDOXnxrcJBH1tN/+OIG0UGjj0WW4Kv4zU=; b=a3O8Za0FkcHUk42CyxyzJPOFzrIE2CHFhFlLSDm981ePwHHiPJl3oo/2u8hB0KD44n bFwJepERYUj4mFeGtGdmypQbDT+m6XFSyfuVTX/Hicnr5by6WjmDQHHYECcngcuA5lUq /jRSOT51QdtBC/Zike12kgV9UK7/CxG2WE/1z2o5z07ggYQ3xQ6LEnSGJQyQZBPx2UpB GojZzBZXbHsJbLVFcrVFcA9Q967ywS60bO4IzgUJmEWVTLuD4Q3J5XfsYYYH8MYIakUJ TDyIDIxLlgB+t9hcihtXhU2O2CAMhdyqDENb4QavHQvMA/T0TDi/af5FbxgLQKVkv0Sg 5xeQ== X-Gm-Message-State: AKGB3mKsXJQO5yCJe9VFmhn8bD1SxGtJaNFo1Q/AcaGtsELj7LM+jIEd z6DV/zJXEMDU8lM1sCoJkmc5Fg== X-Google-Smtp-Source: AGs4zMaQ4jrli4Xk4txwuDv3ch5eVcbDllVb4dQRgQpYsq1Rc7vA2s9CASjHMmdfIPoG69UwRr7Y6A== X-Received: by 10.36.110.14 with SMTP id w14mr15714441itc.100.1512436685272; Mon, 04 Dec 2017 17:18:05 -0800 (PST) Original-Received: from zebian ([45.2.119.34]) by smtp.googlemail.com with ESMTPSA id f90sm6602056ioi.30.2017.12.04.17.18.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Dec 2017 17:18:04 -0800 (PST) In-Reply-To: (Drew Adams's message of "Mon, 4 Dec 2017 06:52:27 -0800 (PST)") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:140706 Archived-At: Drew Adams writes: > What I cited are cases where we do flag _particular kinds_ > of invalid regexps, and so tailor the error msg. I'm not sure if you're citing actual code we have right now, or just some hypotheticals. In isearch.el, we pretty much do the opposite of tailor the error message. >> Actually, I'm wondering what's the point of isearch showing >> "incomplete" instead of the actual regexp invalid error. >> I.e., why not instead of >> >> \ [incomplete] >> \{ [incomplete] >> \{4 [incomplete] >> \{4000 [incomplete] >> \{4000\ [incomplete] >> \{4000\} >> >> show this: >> >> \ [Trailing backslash] >> \{ [Unmatched \{] >> \{4 [Unmatched \{] >> \{4000 [Unmatched \{] >> \{4000\ [Trailing backslash] >> \{4000\} > > Feel free to work on that. You might run into some cases > that are not so clear-cut. But you might well improve > things generally in some way. I meant just the following patch, you can try it out easily: --- i/lisp/isearch.el +++ w/lisp/isearch.el @@ -2850,10 +2850,6 @@ isearch-search (invalid-regexp (setq isearch-error (car (cdr lossage))) (cond - ((string-match - "\\`Premature \\|\\`Unmatched \\|\\`Invalid " - isearch-error) - (setq isearch-error "incomplete input")) ((and (not isearch-regexp) (string-match "\\`Regular expression too big" isearch-error)) (cond Eli Zaretskii writes: >> >> /* If sizeof(int) == 2, then ((1 << 15) - 1) overflows. */ >> #define RE_DUP_MAX (0x7fff) >> >> Does Emacs even support 16 bit platforms? > > Emacs never did (the MS-DOS port of Emacs runs in i386 32-bit > protected mode on top of a 16-bit OS). But regex.c did, at some very > distant past, to support the 16-bit MS compiler, or at least it tried > to. So changing to 2^31 as the max should be fine, right? --- i/src/regex.h +++ w/src/regex.h @@ -270,8 +270,10 @@ #ifdef RE_DUP_MAX # undef RE_DUP_MAX #endif -/* If sizeof(int) == 2, then ((1 << 15) - 1) overflows. */ -#define RE_DUP_MAX (0x7fff) +/* If sizeof(int) == 4, then ((1 << 31) - 1) overflows. This used to + be limited to 0x7fff, but Emacs never supported 16 bit platforms + anyway. */ +#define RE_DUP_MAX (0x7fffffff) /* POSIX `cflags' bits (i.e., information for `regcomp'). */