The patch included at the end of this message corrects two long-standing
problems with Perl on VMS:
1) Flushing an empty file returns success but sets an end-of-file error
condition that will cause problems the next time ferror() is called.
Clearing the error takes care of this. ftmp-posix.t turned up this bug
because it enables autoflushing on a file that has not yet been written to.
2) Device names come in many flavors on VMS, and the one used in
Perl_cando() is a logical name set at mount time. Since a user can (though
shouldn't) redefine that logical name to point elsewhere, it's safer to use
the physical device name, which we already have in a stat buffer.
This plus Peter's latest configure.com patch get me passing all tests except
st-store.t and st-retrieve.t with Compaq C 6.2-007 on OpenVMS Alpha 7.2-1.
The following snippet of Storable debug output suggests that the problem is
probably with network order, though it's too durn late in my time zone to
mess with that further tonight (shouldn't the retrieve detect a type of 1,
not 128?):
(#6) item
store (0x31ddb4)
storing 0x31ddb4 tag #7, type 1...
store_scalar (0x31ddb4)
using network order
ok (integer 0x31ddb4, value = 456)
ok (stored 0x31ddb4, refcnt=1, SCALAR)
(#6) item
retrieve
retrieve type = 128
Corrupted storable file (binary v2.1) at ../../lib/storable.pm (autosplit into
[--.lib.auto.Storable]retrieve.al) line 198, at [.lib
]st-retrieve.t line 51
%SYSTEM-F-ABORT, abort
and the patch to vms.c:
--- vms/vms.c;-0 Wed Aug 30 16:53:17 2000
+++ vms/vms.c Fri Sep 1 00:20:49 2000
@@ -1,9 +1,12 @@
/* vms.c
*
* VMS-specific routines for perl5
+ * Version: 5.7.0
*
- * Last revised: 20-Aug-1999 by Charles Bailey [EMAIL PROTECTED]
- * Version: 5.5.60
+ * August 2000 tweaks to vms_image_init, my_flush, my_fwrite, cando_by_name,
+ * and Perl_cando by Craig Berry
+ * 29-Aug-2000 Charles Lane's piping improvements rolled in
+ * 20-Aug-1999 revisions by Charles Bailey [EMAIL PROTECTED]
*/
#include <acedef.h>
@@ -4726,6 +4729,13 @@
#endif
res = fsync(fileno(fp));
}
+/*
+ * If the flush succeeded but set end-of-file, we need to clear
+ * the error because our caller may check ferror(). BTW, this
+ * probably means we just flushed an empty file.
+ */
+ if (res == 0 && vaxc$errno == RMS$_EOF) clearerr(fp);
+
return res;
}
/*}}}*/
@@ -5587,7 +5597,16 @@
&namdsc,&namdsc.dsc$w_length,0,0);
if (retsts & 1) {
fname[namdsc.dsc$w_length] = '\0';
- return cando_by_name(bit,effective,fname);
+/*
+ * lib$fid_to_name returns DVI$_LOGVOLNAM as the device part of the name,
+ * but if someone has redefined that logical, Perl gets very lost. Since
+ * we have the physical device name from the stat buffer, just paste it on.
+ */
+ char fname_phdev[NAM$C_MAXRSS+1];
+ strcpy( fname_phdev, statbufp->st_devnam );
+ strcat( fname_phdev, strrchr(fname, ':') );
+
+ return cando_by_name(bit,effective,fname_phdev);
}
else if (retsts == SS$_NOSUCHDEV || retsts == SS$_NOSUCHFILE) {
Perl_warn(aTHX_ "Can't get filespec - stale stat buffer?\n");
[end of patch]
_______________________________________________
Craig A. Berry
mailto:[EMAIL PROTECTED]