crisptrutski / boot-cljs-test

Boot task to run ClojureScript tests.
53 stars 18 forks source link

Reverted to symlinks #63

Closed kalouantonis closed 7 years ago

kalouantonis commented 7 years ago

Hard symlinks are causing the tests to fail: https://circleci.com/gh/crisptrutski/boot-cljs-test/97 and break release 0.3.1.

Adding: ([org.clojure/clojurescript "1.7.228"] [adzerk/boot-cljs "1.7.228-2"] [doo "0.1.7"]) to :dependencies
Compiling ClojureScript...
• cljs_test/generated_test_suite.js

;; ======================================================================
;; Testing with Phantom:

                              java.lang.Thread.run                  Thread.java:  748
java.util.concurrent.ThreadPoolExecutor$Worker.run      ThreadPoolExecutor.java:  617
 java.util.concurrent.ThreadPoolExecutor.runWorker      ThreadPoolExecutor.java: 1142
               java.util.concurrent.FutureTask.run              FutureTask.java:  266
                                               ...                                   
               clojure.core/binding-conveyor-fn/fn                     core.clj: 1938
                                 boot.core/boot/fn                     core.clj: 1029
                               boot.core/run-tasks                     core.clj: 1019
      crisptrutski.boot-cljs-test/eval477/fn/fn/fn           boot_cljs_test.clj:  190
      crisptrutski.boot-cljs-test/eval297/fn/fn/fn           boot_cljs_test.clj:   97
                adzerk.boot-cljs/eval1394/fn/fn/fn                boot_cljs.clj:  135
                adzerk.boot-cljs/eval1446/fn/fn/fn                boot_cljs.clj:  208
      crisptrutski.boot-cljs-test/eval367/fn/fn/fn           boot_cljs_test.clj:  169
            crisptrutski.boot-cljs-test/run-tests!           boot_cljs_test.clj:  139
       crisptrutski.boot-cljs-test/link-resources!           boot_cljs_test.clj:  111
                               boot.file/hard-link                     file.clj:  165
                    java.nio.file.Files.createLink                   Files.java: 1086
      sun.nio.fs.UnixFileSystemProvider.createLink  UnixFileSystemProvider.java:  476
     sun.nio.fs.UnixException.rethrowAsIOException           UnixException.java:  102
   sun.nio.fs.UnixException.translateToIOException           UnixException.java:   91
java.nio.file.FileSystemException: /home/slacker/.boot/cache/tmp/home/slacker/Programming/sandbox/boot-cljs-test/example/6wb/u2qisy/cljs_test/resources -> resources: Operation not permitted
         file: "/home/slacker/.boot/cache/tmp/home/slacker/Programming/sandbox/boot-cljs-test/example/6wb/u2qisy/cljs_test/resources"
    otherFile: "resources"
       reason: "Operation not permitted"
       clojure.lang.ExceptionInfo: /home/slacker/.boot/cache/tmp/home/slacker/Programming/sandbox/boot-cljs-test/example/6wb/u2qisy/cljs_test/resources -> resources: Operation not permitted
    file: "/tmp/boot.user2271963516212482929.clj"
    line: 33
kentfredric commented 7 years ago

Hard symlinks

Well, just hardlinks. But hardlinking directories is forbidden, at least on linux.

mkdir a
ln a b
# ln: a: hard link not allowed for directory
    -d, -F, --directory
              allow  the superuser to attempt to hard link directories (note: will probably fail due to system restrictions, even
              for the superuser)
ln -F a b
# ln: failed to create hard link 'b' => 'a': Operation not permitted
sudo ln -F a b
# ln: failed to create hard link 'b' => 'a': Operation not permitted

Apparently, OSX Timemachine supports it though (see last para)

crisptrutski commented 7 years ago

Both types of links seem to cause issues in certain environments, and I merged far too quickly on top of "works for me" thinking (OSX). I'll deploy 0.3.2-SNAPSHOT with this change now.

Thanks for pressing the issue and submitting the PR

kentfredric commented 7 years ago

If you're doing recursive traversal, what you might want to do instead is create a hardlink-tree.

That is ( pseudocode )

linktree[ src, dest ]:
  src.file ?
       hardlink src -> dest
  src.dir ?
        mkdir dest
        src.children.each |child|:
              linktree src + '/' + child, dest + '/' + child

This is basically mimicking what

cp --link --recursive src dest

Does.

mkdir test
cd test
mkdir -p src/l1/l2/l3
touch src/{l1,l1/l2,l1/l2/l3}/something 
cp --verbose --link --recursive src dest
# 'src' -> 'dest'
# 'src/l1' -> 'dest/l1'
# 'src/l1/something' -> 'dest/l1/something'
# 'src/l1/l2' -> 'dest/l1/l2'
# 'src/l1/l2/something' -> 'dest/l1/l2/something'
# 'src/l1/l2/l3' -> 'dest/l1/l2/l3'
# 'src/l1/l2/l3/something' -> 'dest/l1/l2/l3/something'
find -ls 
#  15016033      4 drwxr-xr-x   4  kent     kent         4096 Jun 23 19:27 .
#  15016040      4 drwxr-xr-x   3  kent     kent         4096 Jun 23 19:27 ./dest
#  15016042      4 drwxr-xr-x   3  kent     kent         4096 Jun 23 19:27 ./dest/l1
#  15016043      4 drwxr-xr-x   3  kent     kent         4096 Jun 23 19:27 ./dest/l1/l2
#  15016044      4 drwxr-xr-x   2  kent     kent         4096 Jun 23 19:27 ./dest/l1/l2/l3
#  14759827      0 -rw-r--r--   2  kent     kent            0 Jun 23 19:27 ./dest/l1/l2/l3/something
#  14759806      0 -rw-r--r--   2  kent     kent            0 Jun 23 19:27 ./dest/l1/l2/something
#  14759805      0 -rw-r--r--   2  kent     kent            0 Jun 23 19:27 ./dest/l1/something
#  15016035      4 drwxr-xr-x   3  kent     kent         4096 Jun 23 19:26 ./src
#  15016036      4 drwxr-xr-x   3  kent     kent         4096 Jun 23 19:27 ./src/l1
#  15016038      4 drwxr-xr-x   3  kent     kent         4096 Jun 23 19:27 ./src/l1/l2
#  15016039      4 drwxr-xr-x   2  kent     kent         4096 Jun 23 19:27 ./src/l1/l2/l3
#  14759827      0 -rw-r--r--   2  kent     kent            0 Jun 23 19:27 ./src/l1/l2/l3/something
#  14759806      0 -rw-r--r--   2  kent     kent            0 Jun 23 19:27 ./src/l1/l2/something
#  14759805      0 -rw-r--r--   2  kent     kent            0 Jun 23 19:27 ./src/l1/something

You'll note the inode numbers of the files are the same in both trees, but the directory inode numbers are different.

kentfredric commented 7 years ago

Though, you'll possibly also need to consider the possibilities that: