Discussion:
[perl.git] branch blead, updated. GitLive-blead-353-g98c7875
(too old to reply)
Craig A. Berry
2009-01-15 19:58:00 UTC
Permalink
In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/98c7875d3485f5c773ff1976f4197e346535dabc?hp=6fb6c61459e9cc9e8f46103f192d73975cf22ea1>

- Log -----------------------------------------------------------------
commit 98c7875d3485f5c773ff1976f4197e346535dabc
Author: Craig A. Berry <***@mac.com>
Date: Thu Jan 15 13:46:02 2009 -0600

Fix handling of DECC$DISABLE_POSIX_ROOT feature on VMS.

The nomenclature is confusing and the CRTL docs even moreso, and
the CRTL implementation seems not to do what the docs say. The
documented default setting is on, which I take to mean that
processing of SYS$POSIX_ROOT is disabled unless you have asked
for it. I've followed this behavior even though the CRTL seems
to report the feature off by default.

Also corrected yet another length error in a related call to
simple_trnlnm.
-----------------------------------------------------------------------

Summary of changes:
vms/vms.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/vms/vms.c b/vms/vms.c
index b8ac795..ba47da4 100644
--- a/vms/vms.c
+++ b/vms/vms.c
@@ -9454,7 +9454,6 @@ void
vms_image_init(int *argcp, char ***argvp)
{
int status;
- char val_str[10];
char eqv[LNM$C_NAMLENGTH+1] = "";
unsigned int len, tabct = 8, tabidx = 0;
unsigned long int *mask, iosb[2], i, rlst[128], rsz;
@@ -9475,16 +9474,18 @@ vms_image_init(int *argcp, char ***argvp)

/* This was moved from the pre-image init handler because on threaded */
/* Perl it was always returning 0 for the default value. */
- status = simple_trnlnm("SYS$POSIX_ROOT", val_str, sizeof(val_str));
+ status = simple_trnlnm("SYS$POSIX_ROOT", eqv, LNM$C_NAMLENGTH);
if (status > 0) {
int s;
s = decc$feature_get_index("DECC$DISABLE_POSIX_ROOT");
if (s > 0) {
int initial;
initial = decc$feature_get_value(s, 4);
- if (initial >= 0) {
- /* initial is -1 if nothing has set the feature */
- /* initial is 1 if the logical name is present */
+ if (initial > 0) {
+ /* initial is: 0 if nothing has set the feature */
+ /* -1 if initialized to default */
+ /* 1 if set by logical name */
+ /* 2 if set by decc$feature_set_value */
decc_disable_posix_root = decc$feature_get_value(s, 1);

/* If the value is not valid, force the feature off */
@@ -9494,7 +9495,7 @@ vms_image_init(int *argcp, char ***argvp)
}
}
else {
- /* Traditionally Perl assumes this is off */
+ /* Nothing has asked for it explicitly, so use our own default. */
decc_disable_posix_root = 1;
decc$feature_set_value(s, 1, 1);
}

--
Perl5 Master Repository
Craig A. Berry
2009-01-16 04:54:46 UTC
Permalink
Post by Craig A. Berry
In perl.git, the branch blead has been updated
<http://perl5.git.perl.org/perl.git/commitdiff/98c7875d3485f5c773ff1976f4197e346535dabc?hp=6fb6c61459e9cc9e8f46103f192d73975cf22ea1
- Log
-----------------------------------------------------------------
commit 98c7875d3485f5c773ff1976f4197e346535dabc
Date: Thu Jan 15 13:46:02 2009 -0600
Fix handling of DECC$DISABLE_POSIX_ROOT feature on VMS.
SYS$POSIX_ROOT processing needs to be disabled by default in
applications because some products incorrectly set the logical name
in the system table instead of their local table.
Sounds right, and that's what we have now. We may have had it by
accident before you moved the check into vms_image_init.
Post by Craig A. Berry
Also corrected yet another length error in a related call to
simple_trnlnm.
What made this issue visible?
I did some testing with SYS$POSIX_ROOT defined and got some test
failures. In tracking them down I stepped through things in the
debugger and saw what was happening.
Was the short length causing the translation to return an error? As
we where throwing the value away, I was not worried about the having
a large buffer, and this was working on my system both with and with
out the feature enabled.
If the supplied output buffer length is less than it needs, the call
to SYS$TRNLNM returns SS$_BUFFEROVF, which is a success status. Since
it is successful, simple_trnlnm attempts to null terminate the result
before returning it, which is guaranteed to stomp on the byte just
past the end of the supplied buffer. Classic C fubar. I had earlier
changed all the calls to simple_trnlnm to pass a length one less than
the actual buffer length, but had missed this one. It was also easier
to just reuse an existing buffer.



________________________________________
Craig A. Berry
mailto:***@mac.com

"... getting out of a sonnet is much more
difficult than getting in."
Brad Leithauser
John Malmberg
2009-01-15 23:36:01 UTC
Permalink
Post by Craig A. Berry
In perl.git, the branch blead has been updated
<http://perl5.git.perl.org/perl.git/commitdiff/98c7875d3485f5c773ff1976f4197e346535dabc?hp=6fb6c61459e9cc9e8f46103f192d73975cf22ea1>
- Log -----------------------------------------------------------------
commit 98c7875d3485f5c773ff1976f4197e346535dabc
Date: Thu Jan 15 13:46:02 2009 -0600
Fix handling of DECC$DISABLE_POSIX_ROOT feature on VMS.
The nomenclature is confusing and the CRTL docs even moreso, and
the CRTL implementation seems not to do what the docs say. The
documented default setting is on, which I take to mean that
processing of SYS$POSIX_ROOT is disabled unless you have asked
for it. I've followed this behavior even though the CRTL seems
to report the feature off by default.
SYS$POSIX_ROOT processing needs to be disabled by default in
applications because some products incorrectly set the logical name in
the system table instead of their local table.

If SYS$POSIX_ROOT is not present, then the value of
DECC$DISABLE_POSIX_ROOT does not matter.

I think that the CRTL reports the DECC$DISABLE_POSIX_ROOT feature as off
if the logical name SYS$POSIX_ROOT is not present, but I do not remember
the exact results of my tests.

The CRTL behavior may also vary with the version of the CRTL/ECO present.
Post by Craig A. Berry
Also corrected yet another length error in a related call to
simple_trnlnm.
What made this issue visible?

Was the short length causing the translation to return an error? As we
where throwing the value away, I was not worried about the having a
large buffer, and this was working on my system both with and with out
the feature enabled.

-John
***@gmail.com
Personal Opinion Only

Loading...