GNU bug report logs - #27730
--exclude-dir does ignore subdirectory

Previous Next

Package: grep;

Reported by: Jiří Kozlovský <mail <at> jkozlovsky.cz>

Date: Mon, 17 Jul 2017 06:05:01 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 27730 in the body.
You can then email your comments to 27730 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-grep <at> gnu.org:
bug#27730; Package grep. (Mon, 17 Jul 2017 06:05:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jiří Kozlovský <mail <at> jkozlovsky.cz>:
New bug report received and forwarded. Copy sent to bug-grep <at> gnu.org. (Mon, 17 Jul 2017 06:05:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jiří Kozlovský <mail <at> jkozlovsky.cz>
To: bug-grep <at> gnu.org
Subject: --exclude-dir does ignore subdirectory
Date: Mon, 17 Jul 2017 07:51:53 +0200
When I run:
grep -Hrn --color=auto --exclude-dir=idserver/sql anything

Then the subdirectory idserver/sql is not ignored (it's included in the output).

The searching tree is like this:
.
./idserver
./idserver/sql
./idserver/sql/tablename
./idserver/sql/tablename/2013-10-07.sql

So if "./idserver/sql/tablename/2013-10-07.sql" has "anything" in it, then it gets outputted, because exclude-dir not working.

My grep version:
grep (GNU grep) 2.25
Copyright © 2016 Free Software Foundation, Inc.

My distro:
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.2 LTS
Release:	16.04
Codename:	xenial

Regards,
George




Information forwarded to bug-grep <at> gnu.org:
bug#27730; Package grep. (Tue, 18 Jul 2017 01:04:01 GMT) Full text and rfc822 format available.

Message #8 received at 27730 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Jiří Kozlovský <mail <at> jkozlovsky.cz>,
 27730 <at> debbugs.gnu.org
Subject: Re: bug#27730: --exclude-dir does ignore subdirectory
Date: Mon, 17 Jul 2017 18:03:03 -0700
This does not appear to be a bug, in that grep is operating as documented. When 
searching recursively, --exclude-dir=GLOB will "skip any subdirectory whose base 
name matches GLOB. Ignore any redundant trailing slashes in GLOB." In your case, 
GLOB contains a non-redundant trailing slash, and such a pattern cannot match 
any base name.

To get the behavior that you want, you can use a fancier tool like 'find'.




Information forwarded to bug-grep <at> gnu.org:
bug#27730; Package grep. (Fri, 24 May 2019 20:41:02 GMT) Full text and rfc822 format available.

Message #11 received at 27730 <at> debbugs.gnu.org (full text, mbox):

From: "Michael Thielker" <mthielker <at> whttiger.net>
To: 27730 <at> debbugs.gnu.org
Subject: --exclude-dir ignoring subdirectory
Date: Fri, 24 May 2019 13:13:40 -0700
[Message part 1 (text/html, inline)]

Information forwarded to bug-grep <at> gnu.org:
bug#27730; Package grep. (Fri, 24 May 2019 23:03:02 GMT) Full text and rfc822 format available.

Message #14 received at 27730 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Michael Thielker <mthielker <at> whttiger.net>
Cc: 27730 <at> debbugs.gnu.org
Subject: Re: bug#27730: --exclude-dir ignoring subdirectory
Date: Fri, 24 May 2019 16:02:38 -0700
On 5/24/19 1:13 PM, Michael Thielker wrote:
>     Can grep 2.6.3-3 be used with RHEL 6.10 to resolve our issue in the
>     meantime?

That sounds like a Red Hat issue more than an issue that needs to be 
answered upstream, so I suggest sending a bug report to Red Hat.

As I recall, it is a tricky area since the older grep documentation was 
ambiguous in this area and the implementation was inconstent, and 
nailing things down was bound to make one set of users or another unhappy.

Also see this change in grep 2.23:

  --exclude and related options are now matched against trailing
  parts of command-line arguments, not against the entire arguments.
  This partly reverts the --exclude-related change in 2.22.
  [bug introduced in grep-2.22]





bug closed, send any further explanations to 27730 <at> debbugs.gnu.org and Jiří Kozlovský <mail <at> jkozlovsky.cz> Request was from Paul Eggert <eggert <at> cs.ucla.edu> to control <at> debbugs.gnu.org. (Tue, 31 Dec 2019 19:20:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 29 Jan 2020 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 81 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.