It may have
seemed like there was a good reason for the change. The issue has to do with how to interpret filespecs as either being AMOS-style filespecs or native filespecs.
The first change occurred in
6.3.1509.0.1 , when it came to our attention that certain perfectly-legal native filespecs were getting truncated due to the false assumption that they were actually AMOS-style, as in the example you cite. But as it turned out, that change didn't break your code, because of an obscure bit of logic that decided that if spaces in the filename were followed by a character deemed to be a terminator (i.e. illegal) within an otherwise legal AMOS filespec, e.g.
/<>(){};=, \t\n\r then we would terminate the filespec there, strip the trailing blank(s), and convert from AMOS to native.
Then, a year later, another developer submitted a complaint similar to yours, except where the spaces were prior to the extension. For example, lookup("CASH .DAT") was no longer finding the file CASH.DAT, whereas prior to 6.3.1509.1, and under AMOS, it did. (The idea here is that since spaces are illegal in AMOS filespecs, the name part of the spec be truncated at space, i.e. at "CASH", and then the extension is applied.
We decided to revert to the old behavior for the case where there were trailing spaces between the end of the name part of the spec and the extension, under the theory that even though legal in Windows and UNIX, no one in their right mind would actually want to respect such trailing spaces in a file name. (That was
6.4.1550.1 )
Unfortunately for your case, the 1550.1 fix also tinkered with the logic deciding which characters should be considered terminators, which had the side effect of allowing characters such as "(", which would be illegal in AMOS filespecs, to instead force the interpretation of the filespec as native. So, under that rule, the "(" in your "TEXT.TXT (602)" has the effect of forcing the filespec to be treated as native, where the embedded spaces are perfectly legal. (Unlike the AMOS case where every file has an extension of between zero and three character, in Windows and UNIX, the "." is just another character and thus filename extensions are not inherently part of the filename framework. It is left to the application to decide whether to interpret filespecs as having extensions and if so what semantics to assign to them.)
That's a reasonably defensible position, i.e., that as A-Shell evolves beyond its AMOS origins, it makes less and less sense to limit filespec syntax based on some obscure legacy AMOS rules. (Many A-Shell developers have no real knowledge of AMOS and code around the native directory system and filespecs rather than the AMOS framework.)
On the other hand, because the preservation of backward compatibility is so important (even in rather squirrelly cases like the ones at issue here), I'm inclined to try to split the baby so as to maintain compatibility while not unnecessarily constraining the capabilities going forward. So, I propose restoring the original rule involving the AMOS-illegal characters
/<>(){};=, \t\n\r such that we terminate the filespec there, and then removing any trailing blanks, before deciding if the filespec should be converted from AMOS-style to native.
To illustrate the before and after effects, I've created the following files, shown with sizes in bytes, followed by (blocks)...
cash.ccc 1203899 (2352)
cash.ccc (1) 203 (1)
cash.ccc xx 105256 (206)
cash.ccc(1) 129296 (253)
cash(1).fff 1199 (3)
cash (1).fff 591 (2)
cash xx.fff 1991 (4)
cash.fff 121274 (237)
lookup.run 348 (1)
And here are the results of LOOKUP(fspec$) for the four version variations (with the proposed patch being 1551.7)
Before After After After
1509.1 1509.1 1550.1 1551.7
lookup.run(602) * 1 * 1 * 1 * 1
lookup.run (602) * 1 * 1 + 0 * 1
cash.ccc 2352 2352 2352 2352
cash.ccc(1) * 2352 * 2352 * 2352 * 2352
cash.ccc (1) * 2352 * 2352 + 1 * 2352
cash.ccc xx * 2352 + 206 * 2352 + 206
cash.fff 237 237 237 237
cash(1).fff = 0 = 0 = 0 = 0
cash (1).fff = 0 = 0 + 2 = 0
cash xx.fff = 0 + 4 = 0 + 4
Footnotes:
* filespec treated as AMOS; illegal characters truncated; converted to <path>\<name>.<ext> (10.3) format
= filespec treated as AMOS; illegal characters truncated; converted to <path>\<name> (no extension)
(note that if cash.dat existed, it would have been used due to default extension)
+ filespec treated as-is (native)
All others treated as normal AMOS; converted to <path>\cash.???
The issue you reported is shown in the 2nd line, where up until the 1550.1 patch, "lookup.run (602)" was treated as "lookup.run". Then it was treated as a raw native, and the proposed 1551.7 would put it back (based on the wobbly idea that "(" doesn't belong in a filename?)
The other variations show the differences in handling a space in either the file name or extension, depending on whether followed by a quasi illegal char (e.g. "(") or by a normal char ("cash.ccc xx" and "cash xx.fff").
Note that the proposed patch would not completely revert everything back to the pre-1509 behavior. The two deviations are the space followed by normal character cases ("cash xx.fff" and "cash.ccc xx"). Under the original (and AMOS rules), the former would somehow be translated to "cash.dat" and latter to "cash.ccc", whereas in the context of modern native filespecs, both seem so perfectly acceptable that it seems crazy not to accept them as valid native specs.
Nor do any of the 4 behaviors make perfect sense. Is there any reason to treat "cash(1).fff" as "cash" under quirky AMOS rules, yet treat "cash (1).fff" as native under the current rules? Should we handle the non-AMOS-conforming oddities differently depending on whether they occur in the filename vs the extension? Similarly, given that "(" is not an illegal character in a native filespec, is there any reason to treat it differently than any other, i.e. "cash (1).fff" shouldn't be treated the same way as "cash xx.fff"?
Given how confusing this has become, perhaps we should let it percolate for bit for making any further changes. Maybe we need a switch to emulate these archaic AMOS quirks, and otherwise treat any filespec which doesn't match the AMOS rules as native. But that would definitely be new behavior and thus not a good candidate for 6.4.
One other detail which shouldn't be lost in the confusion: in all cases, you can force the filespec to be treated as native by prefixing it with "./" (works for both Windows and UNIX).