Repository: common-workflow-language/cwltool

Issue:
Some mounted docker paths are referenced as /var instead of /var/private in Mac Serina
Example: the 90th conformance test. When executing this actual command is executed without the quiet flag, the following happens:
```
$ /Users/th10/checkouts/cwltool/venv/bin/cwltool --outdir=/var/folders/5p/p6z8hhy174q_ctt3pn7mx5_c000h1t/T/tmpy3_of70y ../common-workflow-language/v1.0/v1.0/cat3-tool.cwl ../common-workflow-language/v1.0/v1.0/file-literal.yml
/Users/th10/checkouts/cwltool/venv/bin/cwltool 1.0.20180703025338
Resolved '../common-workflow-language/v1.0/v1.0/cat3-tool.cwl' to 'file:///Users/th10/checkouts/common-workflow-language/v1.0/v1.0/cat3-tool.cwl'
[job cat3-tool.cwl] /private/tmp/docker_tmpldgg2u5f$ docker \
    run \
    -i \
    --volume=/private/tmp/docker_tmpldgg2u5f:/private/var/spool/cwl:rw \
    --volume=/private/var/folders/5p/p6z8hhy174q_ctt3pn7mx5_c000h1t/T/tmpeuf451sm:/tmp:rw \
    --volume=/var/folders/5p/p6z8hhy174q_ctt3pn7mx5_c000h1t/T/tmpeuf451sm/tmpjsh0kge1:/private/var/lib/cwl/stg15c81a0c-99ab-4202-b300-953e76cfc7d8/21bdddd8-b055-41d7-b6c1-e57713e784c1:rw \
    --workdir=/private/var/spool/cwl \
    --read-only=true \
    --log-driver=none \
    --user=16442:1312 \
    --rm \
    --env=TMPDIR=/tmp \
    --env=HOME=/private/var/spool/cwl \
    debian:stretch-slim \
    cat \
    /private/var/lib/cwl/stg15c81a0c-99ab-4202-b300-953e76cfc7d8/21bdddd8-b055-41d7-b6c1-e57713e784c1 > /private/tmp/docker_tmpldgg2u5f/output.txt
docker: Error response from daemon: Mounts denied:
The path /var/folders/5p/p6z8hhy174q_ctt3pn7mx5_c000h1t/T/tmpeuf451sm/tmpjsh0kge1
is not shared from OS X and is not known to Docker.
You can configure shared paths from Docker -> Preferences... -> File Sharing.
See https://docs.docker.com/docker-for-mac/osxfs/#namespaces for more info.
.
ERRO[0000] error waiting for container: context canceled
[job cat3-tool.cwl] completed permanentFail
{
    "output_file": {
        "location": "file:///var/folders/5p/p6z8hhy174q_ctt3pn7mx5_c000h1t/T/tmpy3_of70y/output.txt",
        "basename": "output.txt",
        "class": "File",
        "checksum": "sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709",
        "size": 0,
        "path": "/var/folders/5p/p6z8hhy174q_ctt3pn7mx5_c000h1t/T/tmpy3_of70y/output.txt"
    }
}
Final process status is permanentFail
```

As you can see from the 3rd `--volume`, `/var` is not being expanded to `/var/private`


Discussion:
Conformance test number 96 also doesn't work for a slightly related reason - the `runtime.tmpdir` argument is set to be `/private/tmp` whilst `--env=TMPDIR` sets the tmpdir to `/tmp` (this is built in to the code):
```
$ /Users/th10/checkouts/cwltool/venv/bin/cwltool --outdir=/var/folders/5p/p6z8hhy174q_ctt3pn7mx5_c000h1t/T/tmp1qk5r8ji v1.0/envvar2.cwl v1.0/empty.json
/Users/th10/checkouts/cwltool/venv/bin/cwltool 1.0.20180703025338
Resolved 'v1.0/envvar2.cwl' to 'file:///Users/th10/checkouts/common-workflow-language/v1.0/v1.0/envvar2.cwl'
[job envvar2.cwl] /private/tmp/docker_tmpjjlwf885$ docker \
    run \
    -i \
    --volume=/private/tmp/docker_tmpjjlwf885:/private/var/spool/cwl:rw \
    --volume=/private/var/folders/5p/p6z8hhy174q_ctt3pn7mx5_c000h1t/T/tmps9ndru0i:/tmp:rw \
    --workdir=/private/var/spool/cwl \
    --read-only=true \
    --user=16442:1312 \
    --rm \
    --env=TMPDIR=/tmp \
    --env=HOME=/private/var/spool/cwl \
    debian:stretch-slim \
    /bin/sh \
    -c \
    'echo' "HOME=$HOME" "TMPDIR=$TMPDIR" && 'test' "$HOME" '=' '/private/var/spool/cwl' '-a' "$TMPDIR" '=' '/private/tmp'
HOME=/private/var/spool/cwl TMPDIR=/tmp
[job envvar2.cwl] completed permanentFail
{}
Final process status is permanentFail
```

Resolving patch:
diff --git a/cwltool/docker.py b/cwltool/docker.py
--- a/cwltool/docker.py
+++ b/cwltool/docker.py
@@ -256,8 +256,8 @@ def add_volumes(self, pathmapper, runtime, secret_store=None):
                     with os.fdopen(fd, "wb") as f:
                         f.write(contents.encode("utf-8"))
                     runtime.append(u"--volume=%s:%s:rw" % (
-                        docker_windows_path_adjust(createtmp),
-                        docker_windows_path_adjust(vol.target)))
+                        docker_windows_path_adjust(os.path.realpath(createtmp)),
+                        vol.target))
 
     def create_runtime(self, env, runtimeContext):
         # type: (MutableMapping[Text, Text], RuntimeContext) -> List
diff --git a/cwltool/process.py b/cwltool/process.py
--- a/cwltool/process.py
+++ b/cwltool/process.py
@@ -609,16 +609,12 @@ def _init_job(self, joborder, runtimeContext):
                         dockerReq.get("dockerOutputDirectory").startswith('/'):
                     outdir = dockerReq.get("dockerOutputDirectory")
                 else:
-                    outdir = fs_access.docker_compatible_realpath(
-                        dockerReq.get("dockerOutputDirectory") or
-                        runtimeContext.docker_outdir or "/var/spool/cwl")
+                    outdir = dockerReq.get("dockerOutputDirectory") or \
+                        runtimeContext.docker_outdir or "/var/spool/cwl"
             elif defaultDocker:
-                outdir = fs_access.docker_compatible_realpath(
-                    runtimeContext.docker_outdir or "/var/spool/cwl")
-            tmpdir = fs_access.docker_compatible_realpath(
-                runtimeContext.docker_tmpdir or "/tmp")
-            stagedir = fs_access.docker_compatible_realpath(
-                runtimeContext.docker_stagedir or "/var/lib/cwl")
+                outdir = runtimeContext.docker_outdir or "/var/spool/cwl"
+            tmpdir = runtimeContext.docker_tmpdir or "/tmp"
+            stagedir = runtimeContext.docker_stagedir or "/var/lib/cwl"
         else:
             outdir = fs_access.realpath(runtimeContext.outdir or
                 tempfile.mkdtemp(prefix=getdefault(runtimeContext.tmp_outdir_prefix,


Test patch: