bugGNU tar - Bugs: bug #56262, false positive...

 
 

bug #56262: false positive --exclude-vcs-ignore match for .*

Submitter:  Masahiro Yamada <masahiroy>
Submitted:  Fri 03 May 2019 09:53:30 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  gray
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 03 Dec 2019 09:54:20 AM UTC, comment #6: 


> Parsing .gitignore is somewhat complicated.


Yes, indeed.  The issue is even more complicated, because --exclude-vcs-ignore aims to support ignore files from various version control systems, and their behavior differs quite considerable between each other.

> For example, I doubt tar understands "!", "/" prefixes.


No, it does not.  This was reported earlier (see https://savannah.gnu.org/bugs/?54408).  The work is underway.

Thanks for your help. I'm closing the issue.

Sergey Poznyakoff <gray>
Group administrator
Tue 03 Dec 2019 08:24:56 AM UTC, comment #5: 

Confirmed. Thanks.
Please close this.

When I was previously testing this,
I saw various mis-interpretations of
.gitignore, but I cannot recall exactly.
If you are interested, please compare the
behavior between git and tar.
Parsing .gitignore is somewhat complicated.
For example, I doubt tar understands
"!", "/" prefixes.

Masahiro Yamada <masahiroy>
Tue 03 Dec 2019 08:01:58 AM UTC, comment #4: 

You're right. I misinterpreted my results.  I have pushed the following fix: http://git.savannah.gnu.org/cgit/tar.git/commit/?id=883cc555df870e45599fd5ed951843c332fcdafc

Sergey Poznyakoff <gray>
Group administrator
Tue 03 Dec 2019 06:59:51 AM UTC, comment #3: 

It is a long time ago that I filed this bug report.
So, I am trying to remember it by checking the report description.


The pattern '.*' instructs git to ignore files whose name starts with a dot. (They are hidden files that are only displayed with 'ls -a'.)

My report questions './foo' being ignored.
Of course, './foo' means the file 'foo' located in the current directory, not a hidden file.
Of course, git does not ignore it just because of '.*' in .gitignore

Masahiro Yamada <masahiroy>
Tue 03 Dec 2019 06:25:21 AM UTC, comment #2: 

Hi Masahiro.

Sorry for he long delay.  I run additional tests which have shown that this behavior (however strange as it may look) is in fact the correct behavior.  The --exclude-vcs-ignores option is intended to read exclude patterns from the VCS ignore files and to ignore exactly the same set of files that would have been ignored by the corresponding VCS program.  Now, git itself, when given the '.*' pattern, ignores everything in the directory containing this file and all its subdirectories.  So, tar mimics its behavior as intended.

Sergey Poznyakoff <gray>
Group administrator
Fri 03 May 2019 10:05:05 AM UTC, comment #1: 

Thanks! Will fix it.

Sergey Poznyakoff <gray>
Group administrator
Fri 03 May 2019 09:53:30 AM UTC, original submission:  

The pattern '.*' should ignore
any files that start with a dot.

However, --exclude-vcs-ignore wrongly excludes everything
if the current directory is specified for archiving.

[How to reproduce]

$ mkdir test
$ cd test
$ echo '.*' > .gitignore
$ touch foo
$ cat .gitignore
.*
$ find .
.
./.gitignore
./foo
$ tar cf ../archive.tar --exclude-vcs-ignore .
$ tar tf ../archive.tar
./


I believe the correct behavior is ../archive.tar should contain:
./
./foo

(./foo should not excluded)

Masahiro Yamada <masahiroy>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gray (Posted a comment)
  • -email is unavailable- added by masahiroy (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-12-03 gray Open/ClosedOpen Closed
    2019-12-03 gray StatusWont Fix Fixed
    2019-12-03 gray StatusIn Progress Wont Fix
    2019-05-03 gray StatusNone In Progress
        Assigned toNone gray

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code