tcsh-org / tcsh

This is a read-only mirror of the tcsh code repository.
https://www.tcsh.org/
Other
232 stars 42 forks source link

Filename expansion inside square brackets bug #13

Closed oldpink closed 2 years ago

oldpink commented 5 years ago

I have been running TCSH version 6.21.00 on my Slackware system since Patrick Volkderding made the new build of TCSH part of Slackware-current on May 10. However, I ran into a really nasty issue with this new version of TCSH that breaks filename pattern matching within square brackets, specifically, I tried upgrading (via upgradepkg) several of my Slackware packages selectively by excluding some of the packages that I had downloaded so that I could install the excluded packages as additions instead of upgrading them. I excluded the kernel packages, using the following command: upgradepkg [b-c,l-z].t?z However, much to my dismay, it went ahead and upgraded the kernel- packages anyway, deleting my three already installed kernel packages that I wanted to keep in place as secondary bootup and backups. Sure enough, when I type "ls [b-c,l-z].t?z, it includes the kernel- files in the list of files, too. Obviously, this is not the way it should work, so I downloaded version 6.20.00 from source, then compiled it using the Slackware build script (called a SlackBuild) to see if reverting the previous kernel would correct the error, and Shazam! yes it works as it should, properly excluding the kernel-* files in my filespec. I'm certain that this is a bug, and a very bad one at that, so I'll be using the previous version of TCSH for now, but I wanted to let you know about my problem with the current version so that maybe something could be done before someone unintentionally wipes out an entire file system or something else because of this bug.

reikred commented 4 years ago

I think the following is the same bug, that some wildcard patterns involving square brackets no longer work properly:

% touch 0 A % echo [A-Z] 0 A <----------------BUG: why does it show the file named "0"? % echo [0-9] 0 % echo $version tcsh 6.21.00 (Astron) 2019-05-08 (x86_64-unknown-linux) options wide,nls,dl,al,kan,sm,rh,nd,color,filec

It appears to be fixed in 6.22.02 (?) but not 6.22.01

% touch 0 A % echo [A-Z] A % echo $version tcsh 6.22.02 (Astron) 2019-12-04 (x86_64-unknown-linux) options wide,nls,dl,al,kan,sm,rh,color,filec

oldpink commented 4 years ago

I think the following is the same bug:

% touch 0 A % echo [A-Z] 0 A <----------------BUG: why does it show the file named "0"? % echo $version tcsh 6.21.00 (Astron) 2019-05-08 (x86_64-unknown-linux) options wide,nls,dl,al,kan,sm,rh,nd,color,filec

It appears to be fixed in 6.22.02 (?) but not 6.22.01

% touch 0 A % echo [A-Z] A % echo $version tcsh 6.22.02 (Astron) 2019-12-04 (x86_64-unknown-linux) options wide,nls,dl,al,kan,sm,rh,color,filec

You are correct. Slackware upgraded to version 6.22.02 on 22MAR2020, and pattern matching now works as it should again. Thanks for the reply.

reikred commented 4 years ago

@oldpink, do you know which commits broke and then fixed again the wildcard expansions? I can't seem to find them. Granted, I not a github power user.

oldpink commented 4 years ago

@oldpink, do you know which commits broke and then fixed again the wildcard expansions? I can't seem to find them. Granted, I not a github power user.

I wouldn't know which commits. I only use release versions, and that's only once Slackware-Current pushes out new builds of those. At least the problem is fixed.

zoulasc commented 4 years ago

This sounds like: https://bugs.astron.com/view.php?id=81 https://bugs.astron.com/view.php?id=81, It was broken by:

commit 0c8d1b46d902dffb41b81fec459b22a0b5e87bbd Author: zoulasc christos@zoulas.com Date: Fri Apr 28 09:18:03 2017 -0400

Use backtracking instead of recursion to expand '*' to avoid exponential
behavior: https://research.swtch.com/glob

and fixed by:

commit 4679bde3e1ceca63d6eb4de5ce41c996405e61aa Author: Christos Zoulas christos@zoulas.com Date: Mon Jul 29 09:03:40 2019 -0400

PR/81: oldping: Fix range matching issue where we were comparing with the
range character instead of the start of range.

christos

On Jul 7, 2020, at 12:10 PM, oldpink notifications@github.com wrote:

@oldpink https://github.com/oldpink, do you know which commits broke and then fixed again the wildcard expansions? I can't seem to find them. Granted, I not a github power user.

I wouldn't know which commits. I only use release versions, and that's only once Slackware-Current pushes out new builds of those. At least the problem is fixed.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tcsh-org/tcsh/issues/13#issuecomment-654968140, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAENP5LABOG3TLMNT6RS36TR2NCHLANCNFSM4HXASP6A.

[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/tcsh-org/tcsh/issues/13#issuecomment-654968140", "url": "https://github.com/tcsh-org/tcsh/issues/13#issuecomment-654968140", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]