Package: tar Version: 1.34+dfsg-1 Severity: normal Dear Maintainer,
While passing a directory name with a trailing slash for apparently any exclude option parameter, the directory referenced does not get excluded from the tarfile. Reproducible with the following configuration: $ mkdir foo bar baz $ touch {foo,bar,baz}/file $ cat > .gitignore foo bar/ In all the following cases, bar directory is unexpectedly included into the tarfile: $ tar --create --exclude-vcs-ignores . | tar --list ./ ./.gitignore ./bar/ ./bar/file ./baz/ ./baz/file $ tar --create --exclude-from=.gitignore . | tar --list ./ ./.gitignore ./bar/ ./bar/file ./baz/ ./baz/file $ tar --create --exclude=foo --exclude=bar/ . | tar --list ./ ./.gitignore ./bar/ ./bar/file ./baz/ ./baz/file I found it while using --exclude-vcs-ignores where a .gitignore referenced an exclude with a trailing slash (which is properly documented and works inside git), and further tests showed me that it is not only a --exclude-vcs-ignores issue but a more generic one. Also note that using bar/file excludes the file entry but not the directory itself, as expected. -- System Information: Debian Release: 11.5 APT prefers stable-security APT policy: (500, 'stable-security'), (500, 'stable') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 5.10.0-18-amd64 (SMP w/4 CPU threads) Locale: LANG=ca_ES.utf8, LC_CTYPE=ca_ES.utf8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages tar depends on: ii libacl1 2.2.53-10 ii libc6 2.31-13+deb11u4 ii libselinux1 3.1-3 tar recommends no packages. Versions of packages tar suggests: ii bzip2 1.0.8-4 pn ncompress <none> ii tar-doc 1.34-1 pn tar-scripts <none> ii xz-utils 5.2.5-2.1~deb11u1 -- no debconf information