Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Fixed Something Weird with @Files Function with File Exclusion Range

Jun
1,092
48
I have been running into a problem with the @FILES function that results in various problems that are quite confusing. Sometimes in files seeming to disappear or causing the TCC session to pop out of TCMD and becomes a standalone session. (If I do these tests in a standalone session, it just terminates.)

Code:
[TCC36.50.71 (55704) C:\temp]
->*dir /[!*.mp3 *.x*] ra*

 Volume in drive C is Windows      Serial number is a879:820d
 Directory of  C:\temp\ra*

 2/25/2025   0:24         <DIR>    Raytheon_Msg_to_Jay_in_Japan
 5/08/2016  19:21           8,380  Raff.txt
 2/25/2016  15:14         616,728  Raff_Family_Generations_Report.pdf
 2/25/2016  15:14          87,211  Raff_Family_Outline_Descendant_Report.pdf
             712,319 bytes in 3 files and 1 dir    720,896 bytes allocated
     295,763,648,512 bytes free

[TCC36.50.71 (55704) C:\temp]
->echo %@files[/[!*.mp3 *.x*] ra*,-d]
3

[TCC36.50.71 (50088) C:\temp]
->echo %@files[/[!*.mp3 *.x*] ra*,-d]

The first ECHO command worked, but when I recalled it from the history and ran it again, TCC crashed and a new standalone TCC session started.

The issue seems to have something to do with the exclusion range. Here's a simpler command sequence.

Code:
[TCC36.50.71 (57780) C:\temp]
->echo %@files[/[!*.mp3] ra*]
5

[TCC36.50.71 (57780) C:\temp]
->echo %@files[/[!*.mp3] ra*]
[TCC36.50.71 (57780) C:\temp]

This time the TCC tab did not crash, but the command no longer produce output. Hmmm, what's going on now? A command line with the @FILES function produces no output, but other commands do. It's as if the FILES function has been deleted from TCC.

Code:
[TCC36.50.71 (57780) C:\temp]
->echo number of files: %@files[/[!*.mp3] ra*]
[TCC36.50.71 (57780) C:\temp]
->echo test
test

I just ran through some of the same commands in TCC versiions 35 and 34, and they crash the same way. The FILES function works the first time, but when it is repeated, the TCC session crashes.

The simplest demonstration turns out to be a simple repeat of a command like echo %@files[[/[!*.mp3] *]. It runs the first time and crashes on repeat (or stops producing output).
 
For the script I'm working on, I've now switched to running DIR specs >& nul followed by using %_dir_files to get the number.
 
Confirmed here. echo number of files: %@files[/[!*.btm] *] worked once. TCC crashed the second time. In more tries sometimes it didn't crash but it did leave TCC in a useless state. When it crashes it leaves a DMP file; WInDbg and the event log say 0xc0000374 - A heap has been corrupted.
 
I see issues running this command repeatedly in earlier versions too: v35, v34, v33, v32 (the oldest version I happen to have installed at the moment.)

It does seem to work as intended in TCC/LE.
 
Back
Top