From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 74F3E6DE0352 for ; Mon, 25 Sep 2017 19:13:33 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[AWL=0.011, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id j_ETP5sOkILa for ; Mon, 25 Sep 2017 19:13:32 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id 98E1E6DE0083 for ; Mon, 25 Sep 2017 19:13:32 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.89) (envelope-from ) id 1dwfJd-0001qb-ED; Mon, 25 Sep 2017 22:09:41 -0400 Received: (nullmailer pid 23000 invoked by uid 1000); Tue, 26 Sep 2017 02:13:27 -0000 From: David Bremner To: Jani Nikula , notmuch@notmuchmail.org Subject: Re: [PATCH 5/6] cli/new: support // in new.ignore In-Reply-To: <5e252ac400993a2fecdbe8c0d739aa4d23d3de72.1504280923.git.jani@nikula.org> References: <5e252ac400993a2fecdbe8c0d739aa4d23d3de72.1504280923.git.jani@nikula.org> Date: Mon, 25 Sep 2017 23:13:27 -0300 Message-ID: <87zi9i437c.fsf@tethera.net> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Sep 2017 02:13:33 -0000 Jani Nikula writes: > + A regular expression delimited with // that will be matched > + against the path of the file or directory relative to the > + database path. The beginning and end of string must be > + explictly anchored. For example, /.*/foo$/ would match > + "bar/foo" and "bar/baz/foo", but not "foo" or "bar/foobar". Is it worth remarking that '/' does not need to be escaped? or more interestingly, what happens if it is escaped, do things break? > > +static notmuch_bool_t > +_setup_ignore (notmuch_config_t *config, add_files_state_t *state) > +{ Would be nice to document what this return value means. > + const char **ignore_list, **ignore; > + int nregex = 0, nverbatim = 0; > + const char **verbatim = NULL; > + regex_t *regex = NULL; > + > + ignore_list = notmuch_config_get_new_ignore (config, NULL); > + if (! ignore_list) > + return TRUE; > + > + for (ignore = ignore_list; *ignore; ignore++) { > + const char *s = *ignore; > + size_t len = strlen (s); > + > + if (len > 2 && s[0] == '/' && s[len - 1] == '/') { One thing we eventually settled on in the query parser is that an opening '/' without a trailing '/' is an errror. But perhaps it's fine to take a more permissive approach here. > + > + if (! state->ignore_regex_length) > + return FALSE; It's a nitpick, even by the standards of this review, but I'd prefer an explicit '> 0' check.