In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/155f4c250a9701391303ae7e38650ccff6f43b78?hp=1ebd3007591c91215bcc334318e0485e73e6f13f>
- Log ----------------------------------------------------------------- commit 155f4c250a9701391303ae7e38650ccff6f43b78 Author: Craig A. Berry <[email protected]> Date: Fri Aug 10 21:25:09 2012 -0500 pp_require thread safety for VMS. When we translate path names of required modules into Unix format, we haven't (recently) been using the optional second argument to the translation routines,[1] an argument that supplies a buffer for the translation. That causes them to use a static buffer. Which means that if two or more different threads are doing a require operation at the same time, they will be blindly sharing the same buffer. So allocate buffers as we need them and make them mortal so they will go away at the next state transition. [1] Use of an automatic variable for the buffer was removed way back in 46fc3d4c69a0ad. ----------------------------------------------------------------------- Summary of changes: pp_ctl.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pp_ctl.c b/pp_ctl.c index cb549fa..55d9c89 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -3580,6 +3580,9 @@ PP(pp_require) STRLEN unixlen; #ifdef VMS int vms_unixname = 0; + char *unixnamebuf; + char *unixdir; + char *unixdirbuf; #endif const char *tryname = NULL; SV *namesv = NULL; @@ -3665,7 +3668,9 @@ PP(pp_require) * To prevent this, the key must be stored in UNIX format if the VMS * name can be translated to UNIX. */ - if ((unixname = tounixspec(name, NULL)) != NULL) { + + if ((unixnamebuf = SvPVX(sv_2mortal(newSVpv("", VMS_MAXRSS-1)))) + && (unixname = tounixspec(name, unixnamebuf)) != NULL) { unixlen = strlen(unixname); vms_unixname = 1; } @@ -3840,8 +3845,8 @@ PP(pp_require) } #ifdef VMS - char *unixdir; - if ((unixdir = tounixpath(dir, NULL)) == NULL) + if (((unixdirbuf = SvPVX(sv_2mortal(newSVpv("", VMS_MAXRSS-1)))) == NULL) + || ((unixdir = tounixpath(dir, unixdirbuf)) == NULL)) continue; sv_setpv(namesv, unixdir); sv_catpv(namesv, unixname); -- Perl5 Master Repository
