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 C938E6DE17E1 for ; Sat, 11 Mar 2017 06:35:58 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.005 X-Spam-Level: X-Spam-Status: No, score=-0.005 tagged_above=-999 required=5 tests=[AWL=0.006, 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 W5FOQqW3AZxY for ; Sat, 11 Mar 2017 06:35:58 -0800 (PST) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id EF03B6DE17A6 for ; Sat, 11 Mar 2017 06:35:57 -0800 (PST) Received: from remotemail by fethera.tethera.net with local (Exim 4.84_2) (envelope-from ) id 1cmi70-00042L-VF; Sat, 11 Mar 2017 09:35:15 -0500 Received: (nullmailer pid 29095 invoked by uid 1000); Sat, 11 Mar 2017 14:35:54 -0000 From: David Bremner To: Jani Nikula , notmuch@notmuchmail.org Subject: Re: [RFC 3/5] cli: support shell globbing patterns in new.ignore In-Reply-To: <51db8c12299cb1765d346fa2c93c6c95abb92613.1446579858.git.jani@nikula.org> References: <51db8c12299cb1765d346fa2c93c6c95abb92613.1446579858.git.jani@nikula.org> Date: Sat, 11 Mar 2017 10:35:54 -0400 Message-ID: <87wpbvrid1.fsf@tethera.net> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.22 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: Sat, 11 Mar 2017 14:35:59 -0000 Jani Nikula writes: > Keep the existing strcmp on the basename for backwards compatibility, > and additionally use the new.ignore entries as fnmatch(3) patterns on > the absolute filename. Note that it's not enough to add e.g. "foo*bar" > to the list; you will need to do "*/foo*bar" to match the path also. Are there (many?) fnmatch patterns that don't match themselves? I'm just wondering if the extra strcmp is worth-it / needed? > > typedef struct _filename_node { > char *filename; > @@ -236,15 +237,31 @@ _entries_resemble_maildir (const char *path, struct dirent **entries, int count) > /* Test if the file/directory is to be ignored. > */ > static notmuch_bool_t > -_entry_in_ignore_list (const char *entry, add_files_state_t *state) > +_entry_in_ignore_list (const char *path, const char *entry, > + add_files_state_t *state) > { I was a bit confused when reading this (until I saw the calling context). I guess path is dirname and entry is basename? Other than needing doc and a test, I don't remember any objections to this code, although I vaguely remember some alternative proposals for ignoring? I guess one point is that we are proposing to use regexps against paths in one place [1] and proposing to use fnmatch here. I'm not sure it's worth trying to be more consistent, but now seems to be the time to discuss. I think both places could use either, if someone did the work. Of course the other argument is that the queries should be consistent among themselves. [1]: id:20170308024035.6149-1-david@tethera.net