At 3:52 PM -0500 8/11/07, John E. Malmberg wrote: >There has long been a bug in unixify() and readdir() on VMS that is requiring >a lot of code in perl to put in VMS specific checks to work around it. >unixpath() may also be affected as it is a wrapper around unixify. > >The behavior is that readdir() when opening a file in UNIX syntax and >unixify() are incorrectly returning the trailing ".DIR" on directories, and >the trailing "." on files that have no extension.
I think the dot you get by default unless you strip it off, so it's possible we were just never aggressive enough about stripping it off. Adding the .DIR extension was done for a reason, so we need to do our best to remember/infer that reason and make sure it no longer exists. >Some of the VMS specific tests are actually testing for this behavior as if it >were intentional and desired. > >This has always been an incorrect behavior, and has required special code to >wrap many of the CRTL routines to compensate for this. And there is a lot of >code in the core perl libraries and the dual lived modules that is also >compensating for it. It's not really a matter of correctness or incorrectness. It's a matter of trying to emulate something foreign in a way that gives the fewest surprises and does actually work. The behavior you are seeing came in with 5.003, which is to say over 10 years ago and the exact change that introduced it can't be determined because the detailed history before that is unavailable. I didn't get involved until the 5.005-era, but here's my understanding of why things were the way they were. At a time when the CRTL did not understand unix-style filespecs at all and CRTL functions that expected directory names did not work unless you provided the .DIR extension, it seemed like the best thing to do was always include the extension. If you have a perfectly valid foo directory but chdir 'foo' returns an error or silently sends you into never-never-land but chdir 'foo.DIR' works correctly, you're going to do the latter, and you're going to attempt to make sure everyone gets the latter whether they explicitly ask for it or not by making readdir() return directory names with the extension attached. So for me the question is whether all of the cases (and VMS versions) where this behavior was necessary can be consigned to the past. Quite possibly so, but I think we should solicit testing with 7.2 or earlier and try to think through any side effects of the change. >Most of the cases that I have seen would still work if this bug where >corrected, except for some VMS specific tests. > >As of VMS 8.3 with symbolic links, the problem is getting much worse, and >maintaining the code that compensates for this incorrect behavior is becoming >very difficult. > >I would like to write submit a patch that changes readdir() and unixify() to >behave properly and also remove all the hacks that are compensating for the >incorrect behavior. Patch away. There is a possibility I won't commit it before 5.10, or that I'll commit it and roll it back if it causes trouble. But it does seem like a direction we should be moving in the future. >Since the some of the VMS specific tests are actually testing for this >incorrect behavior, this indicates a possibility that such a change may break >existing code. Well, it wouldn't be the first time tests were written to correspond to whatever had been empirically observed to work rather than how things ought to work. -- ________________________________________ Craig A. Berry mailto:[EMAIL PROTECTED] "... getting out of a sonnet is much more difficult than getting in." Brad Leithauser