LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-25-2022, 05:37 AM   #1
Arch900
LQ Newbie
 
Registered: Jan 2022
Posts: 4

Rep: Reputation: 0
tree giving false matches when using pattern flag


Hi all,

This question is maybe more suited for tree's github page, but I want to make sure I'm not being an idiot.

When using more than one wildcard as a pattern with tree I get what I consider to be false matches. For example
Code:
tree -P "*.gpg" --prune .
works as expected and shows me all my .gpg files, however
Code:
tree -P "*.html*.gpg" --prune .
matches both files ending in .html.gpg AND files ending in just .html (but not files ending in just .gpg). In my opinon it should only match files that have both .html and .gpg in the title.

Am I wrong, or am I making a mistake in the command?

 
Old 01-25-2022, 05:56 AM   #2
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,688

Rep: Reputation: Disabled
Definitely looks like a bug. I can reproduce this with tree 1.7.0 and 1.8.0. The latest version is 2.0.1 though, and the changelog indicates there were changes in -P processing recently. I'd try the latest version before filing a bug report.

Update. Still present in 2.0.1. Report the bug. The homepage has an option of sending a nasty e-mail to the maintainer with the subject "You Bastard!"

Last edited by shruggy; 01-25-2022 at 06:29 AM.
 
1 members found this post helpful.
Old 01-25-2022, 07:02 AM   #3
Arch900
LQ Newbie
 
Registered: Jan 2022
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by shruggy View Post
Definitely looks like a bug. I can reproduce this with tree 1.7.0 and 1.8.0. The latest version is 2.0.1 though, and the changelog indicates there were changes in -P processing recently. I'd try the latest version before filing a bug report.

Update. Still present in 2.0.1. Report the bug.
Thank you for confirming. I've reported it now (by email - I think the github I was looking at is a fork as it's a bit out of date).

Quote:
Originally Posted by shruggy View Post
The homepage has an option of sending a nasty e-mail to the maintainer with the subject "You Bastard!"
That's funny. I like maintainers with a sense of humour!
 
Old 01-26-2022, 01:39 PM   #4
Arch900
LQ Newbie
 
Registered: Jan 2022
Posts: 4

Original Poster
Rep: Reputation: 0
I've had a reply to my report!

Quote:
Looks like a bug. I think this will fix it, for 2.0.1 insert the
line:

match = 0;

after line 1145 of tree.c, i.e.:

if(!*pat) return 1;

in the patmatch function. It seems that match should default to no match
unless the remainder of the pattern matches something. The line at 1159
might also need to be moved just before the 'return match' line (outside
of the else). That was likely placed in the else clause alone in error.

Thanks for the report. I'd like to add a few things before another update,
so it might be a bit (just hopefully not another 3 years.)
 
  


Reply

Tags
tree



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting file matching a pattern from the remote server which matches current date using python AshuTrip Linux - Newbie 3 01-21-2021 11:42 AM
Comparing JPEGs and finding matches... or not finding matches. rnturn Linux - General 16 02-20-2018 02:37 PM
printing pattern match and not whole line that matches pattern Avatar33 Programming 13 05-06-2009 06:17 AM
bash: routine outputting both matches and non-matches separately??? Bebo Programming 8 07-19-2004 06:52 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration