Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: a75ec11a1cab411e092caa78634d2e759a3d74bf5224d39f05c2468f8c2291d1
Ticket: 1613456fffffffffffffffffffffffffffffffff
file readable lies with samba shared folder or file
User & Date: bll on 2018-03-22 09:51:51
Changes

  1. icomment:
    C Code:
    
    #include <tcl.h>
    #include <string.h>
    #include <windows.h>
    #include <io.h>
    
    int accessObjCmd (
      ClientData cd,
      Tcl_Interp* interp,
      int objc,
      Tcl_Obj * const objv[]
      )
    {
      int rc, lt1;
      const char* s1;
    
      if (objc != 2) {
        Tcl_WrongNumArgs(interp, 1, objv, "filename");
        return TCL_ERROR;
      }
      s1 = Tcl_GetStringFromObj(objv[1], &lt1);
      rc = _access_s (s1, R_OK);
      Tcl_SetObjResult (interp, Tcl_NewIntObj (rc));
      return TCL_OK;
    }
    
    int Access_Init (Tcl_Interp *interp)
    {
      if (!Tcl_InitStubs (interp,"8.3",0)) {
        return TCL_ERROR;
      }
      Tcl_CreateObjCommand (interp,"access", accessObjCmd, NULL, NULL);
      Tcl_PkgProvide (interp,"access","0.1");
    
      return TCL_OK;
    }
    
    
    Base test script (Tcl 8.6.8):
    
    try {
      load [pwd]/access[info sharedlibextension]
    } on error {err res} {
      puts $res
    }
    if { [info commands access] ne "access" } {
      exit 1
    }
    
    set ns [lindex $::argv 0]
    
    set dn [file join $ns testdir2]
    set fn [file join $dn xyzzy]
    file mkdir $dn
    set fh [open $fn w]
    close $fh
    
    puts "$dn [file readable $dn]"
    puts "$fn [file readable $fn]"
    puts "$dn [access $dn]"
    puts "$fn [access $fn]"
    
    C:\Users\bll\Desktop\BallroomDJ\test.dir>..\windows\64\tcl\bin\tclsh.exe t.tcl F
    :/
    F:/testdir2 0
    F:/testdir2/xyzzy 0
    F:/testdir2 0
    F:/testdir2/xyzzy 0
    
    C:\Users\bll\Desktop\BallroomDJ\test.dir>..\windows\64\tcl\bin\tclsh.exe t.tcl C
    :/
    C:/testdir2 1
    C:/testdir2/xyzzy 1
    C:/testdir2 0
    C:/testdir2/xyzzy 0
    
    Well, I wasn't expecting that result.
    If the virtualbox network share is buggy, there's nothing we can do about that.
    
  2. login: "bll"
  3. mimetype: "text/plain"