diff options
author | Craig A. Berry <craigberry@mac.com> | 2013-12-20 18:11:15 -0600 |
---|---|---|
committer | Craig A. Berry <craigberry@mac.com> | 2013-12-20 18:52:36 -0600 |
commit | 2e82b6ce46e012458b738a5c24d9ed52f5a54d3d (patch) | |
tree | 2426feaa30dba080f186d36737efb101da01ae54 /vms | |
parent | 8da0169c5cf5e6fd8ad2fceb04286b6a44ca381d (diff) | |
download | perl-2e82b6ce46e012458b738a5c24d9ed52f5a54d3d.tar.gz |
Fix unescaped first character in tovmsspec.
Passing a path to int_tovmsspec that contained an "extended"
character as the first character when converting a Unix filespec
to VMS format skipped escaping that character, but only when the
path spec had no directory component. The character that didn't
get escaped could then be passed to a native service that choked
or incorrectly processed it. For example ' foo.txt' remained,
after translation, ' foo.txt', but parsing that as a native spec
would squeeze out the leading space.
So we now make sure we don't eat the first character of the
filename component while processing the directory component and
also handle escaping the very first character. In the example
of ' foo.txt', it now gets correctly translated to '^_foo.txt'.
Diffstat (limited to 'vms')
-rw-r--r-- | vms/vms.c | 8 |
1 files changed, 2 insertions, 6 deletions
@@ -8537,9 +8537,6 @@ static char *int_tovmsspec } else *(cp1++) = '.'; } - else { - *(cp1++) = *cp2; - } for (; cp2 < dirend; cp2++) { if (*cp2 == '/') { if (*(cp2-1) == '/') continue; @@ -8597,8 +8594,7 @@ static char *int_tovmsspec } if (cp1 > rslt && *(cp1-1) == '.') cp1--; /* Unix spec ending in '/' ==> trailing '.' */ if (hasdir) *(cp1++) = ']'; - if (*cp2) cp2++; /* check in case we ended with trailing '..' */ - /* fixme for ODS5 */ + if (*cp2 && *cp2 == '/') cp2++; /* check in case we ended with trailing '/' */ no_type_seen = 0; if (cp2 > lastdot) no_type_seen = 1; @@ -8611,7 +8607,7 @@ static char *int_tovmsspec *(cp1++) = '?'; cp2++; case ' ': - if (cp2 > path && *(cp2-1) != '^') /* not previously escaped */ + if (cp2 >= path && (cp2 == path || *(cp2-1) != '^')) /* not previously escaped */ *(cp1)++ = '^'; *(cp1)++ = '_'; cp2++; |