bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

getcwd() issues on VMS / canonicalize-lgpl.c


From: John Malmberg
Subject: getcwd() issues on VMS / canonicalize-lgpl.c
Date: Tue, 6 Jun 2017 08:43:24 -0500
User-agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1

Summary:

1. The VMS CRTL getcwd() will not pass configure tests and will be marked for replacement from gnulib.

2. The replacement from gnulib causes canonicalize-lgpl.c to fail because the replacement only has 2 parameters, not three.

3. The replacement from gnulib also does not fix all the known ills in VMS getcwd().

I do not have fixes here for all of these issues, however this VMS specific code in canonicalize-lgpl.c probably should just be removed.

--- /src_root/gnulib/lib/canonicalize-lgpl.c    2017-06-01 07:48:41 -0500
+++ /vms_root/gnulib/lib/canonicalize-lgpl.c    2017-06-06 08:01:11 -0500
@@ -59,12 +59,7 @@
      */
 #   undef getcwd
 #  endif
-#  ifdef VMS
-    /* We want the directory in Unix syntax, not in VMS syntax.  */
-#   define __getcwd(buf, max) getcwd (buf, max, 0)
-#  else
-#   define __getcwd getcwd
-#  endif
+#  define __getcwd getcwd
 # else
 #  define __getcwd(buf, max) getwd (buf)
 # endif

This code is not needed anymore on VMS.

TL:DR:

At VMS 5.5-2, VMS switched from VAXC/VAXCRTL to DECC/DECCRTL. GCC/VAX can also use the DECCRTL non-prefixed shared library.

For the DECCRTL having the routines like getcwd() to return results in Unix syntax instead of VMS syntax was a run time setting that the program could do. Unfortunately there are two APIs for setting this based on the version of VMS, which can be hidden with a macro.

Because some of these settings must be made before main() is called, they are typically placed in a "lib$initialize" object module that linked with the program. Typically this lib$initialize module is common to a lot of programs, so application source code does not need to be modified.

The DECCRTL getcwd() has two known bugs.
  1. If buffer is NULL and size is 0, it access violates,
     so a wrapper must detect this and allocate 4097 bytes on non-VAX
     and 256 bytes on VAX.
  2. If the directory is too long to fit into 4097 bytes, it must
     be returned in VMS format, and then translated to Unix syntax.

Because of that, VMS is not currently using the GNULIB replacement getcwd.

At this time, I have not worked out what would be needed for GNULIB to support replacing the DECCRTL getcwd, or providing a suitable "lib$initialize" source module.

Regards,
-John



reply via email to

[Prev in Thread] Current Thread [Next in Thread]