ODS-5 issues: broken utime

Ben Armstrong BArmstrong at dymaxion.ca
Wed May 31 14:49:50 GMT 2006

I am working on several issues that prevent me from using the subversion 
client (either on Windows or Linux) on a VMS Samba ODS-5 fileshare.  I 
have two patches and one workaround so far*, but require more assistance 
to solve this one.

Samba's [.vms]utime.c seems to use the same ACP interface that Perl's 
vms.c does (apparently both derived from the old file.c utility).  Can 
we just use CRTL utime for 7.3 and later as proposed for VMS Perl?  
Also, I didn't see any response in that thread to Craig's suggestion 
that they enable DECC$EFS_FILE_TIMESTAMPS by default, and don't 
understand the ramifications if we were to do that, too.

Can anyone help?  John, I'd be particularly interested in your 
insights.  A patch, of course, would be ideal, or at least enough info 
so that I can make a robust patch of my own.

30-MAY-06, PM&CS&DV&BG&RR, 12=18489=DYADS,  Pr:3.0, CSM_C:Samba 
Subversion client support
   - TC5:        
     - Some files still cannot be renamed due to an "Input/output error"
         $ cd /dymc/t
         $ svn co svn://ntts/RubyDyLib/trunk RubyDyLib
         svn: In directory 'RubyDyLib'
         svn: Can't copy 'RubyDyLib/.svn/tmp/text-base/stub.rb.svn-base' to
              'RubyDyLib/stub.rb.tmp': Input/output error
     - Close examination of the logs showed that Samba is failing to set
       the access times on the file.  This bug only affects filenames with
       an extra dot in them, e.g.  
         ben at bgpc:/dymc/t/dymax/bg$ touch temp.tmp.tmp  
         touch: setting times of `temp.tmp.tmp': Permission denied
     - The problem seems to be that the [.vms]utime.c module in Samba  
       has issues with ODS-5 filenames.  This thread on the vmsperl at perl.org
       mailing list last month may be relevant:                     
       - http://www.mail-archive.com/vmsperl@perl.org/msg07714.html
         - John Malmberg>
           vms/vms.c - If DECC$_EFS_CHARSET enabled, use built in 
utime() function
           instead of emulation
       - http://www.mail-archive.com/vmsperl@perl.org/msg07748.html
         - Craig Berry>
           I've committed #27706, which uses the CRTL utime() for 7.3
           and later, but the existing ACP interface code for anything
           previous.  The presence of utime.h does not help, as it
           became available before the utime() function did.  It looks
           to me like the CRTL utime() does the same thing the old code
           does on ODS-2 or ODS-5 without access dates. On ODS-5 with
           access dates enabled, we'll get the same behavior any other C
           program calling utime() will get.  I think we may want to
           enable DECC$EFS_FILE_TIMESTAMPS by default in Perl, though
           that remains to be tested and checked for consistency with
           our stat() implementation.

* Here are the issues to date & patches:

   - TC2:
     - VMS Samba ODS-5 support issue #1: files in directories
       which begin with a dot (the hidden ".svn" directory on
       Unix systems) are not visible.
       - This is not expected semantics: only the directory itself
         should be considered invisible, not the files within the
       - JYC (jean-yves.collot at cofiroute.fr, VMS Samba maintainer)
         provided a patch for this issue 24-May-2006
         - The following patch was applied to the source in
           as directed by JYC and rebuilt:
           - The fix is quite easy. You just have to make a small change
             in the VMS_SUPPORT.C file. Namely, replace the following
               tmp = strstr(wrkfil,"/.");
               if (tmp != 0)
                      *tmp = 0;
               if (strcmp(&wrkfil[strlen(wrkfil) - 2], "/.") == 0)
                       wrkfil[strlen(wrkfil) - 2] = 0;
           - Then, as usual, you just have to execute
               $ @[.VMS]compile73 nodeb VMS_SUPPORT
               $ @[.VMS]link73 nodeb SMBD
               $ COPY [.BIN]SMBD.EXE samba_root:[bin]
         - As of 30-May-2006, we have confirmed this patch works
           on the DYMC test system, but are still working out
           additional issues before we deploy the patch on DYMA.
   - TC3:
     - Read-only files can't be deleted (not specific to ODS-5).
     - Here is an excerpt from BG's email to JYC on 29-May-2006
       about the issue, describing the problem and our workaround.
       - I have found that Samba removes "D" permission  (unique to VMS)
         when subversion tries to chmod a file to make it read-only
         (i.e. removing "W").  This leads to not normal Unix (or Windows
         for that matter) file semantics: if you make a file read-only,
         you cannot delete it.  So non-VMS apps operating on the VMS
         samba share break when they try to remove read-only files.
       - On non-VMS platforms, whether a file can be deleted or not
         depends solely upon whether or not the *directory* in which the
         file exists is deletable.  I propose, therefore, that VMS Samba
         be modified to leave the "D" bit alone, even when "W"
         permission is removed from the file.  Does that sound
         reasonable to you?
       - My workaround is to put a DEFAULT ACL on the parent directory
         to grant "D" permission to myself.  It is grubby, but it gets
         subversion working for me until Samba is fixed.  Would you
         please look into this, perhaps implementing my suggestion
   - TC4:
     - ODS-5 issue #2: extensionless files do not rename correctly
       when they exist within directories containing dots in them.
     - Here is an excerpt from BG's email to JYC on 29-May-2006
       about the issue, describing the problem and our patch for
       - I found I needed this patch:
         --- vms_support_jyc_1.c 2006-05-29 13:06:04.000000000 -0300
         +++ vms_support.c       2006-05-29 13:12:54.000000000 -0300
         @@ -1155,9 +1155,11 @@
               buf1 = malloc(strlen(buf2)+10);
               buf2 = vms_encode_filespec(newname,FALSE);
         -       if (strchr (buf1+1,'.') == 0)
         +       tmp = strrchr(buf1,'/');
         +       if (strchr (tmp+1,'.') == 0)
                       pstrcat (buf1,".");
         -       if (strchr (buf2+1,'.') == 0)
         +       tmp = strrchr(buf2,'/');
         +       if (strchr (tmp+1,'.') == 0)
                       pstrcat (buf2,".");
               DEBUG(3,("vms_rename: VMS: %s -> %s\n",buf1, buf2));
               sts = rename(buf1, buf2);
       - Without this patch, if you try to rename a file from, e.g.
         ".hidden/temp.tmp" -> ".hidden/temp" the rename will appear to
         succeed (i.e. it will not return an error) but the filename
         won't change because vms_rename() doesn't append the necessary
         trailing period, so the ".tmp" extension from the source
         filename is defaulted for the target filename.
       - Please apply this patch along with yours for the next release.

More information about the samba-vms mailing list