Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Tmpdir Symbolic Links #610

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions boot/pod/src/boot/tmpdir.clj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
(:import
[java.io File]
[java.util Properties]
[java.nio.file Path Files SimpleFileVisitor]))
[java.nio.file Path Files SimpleFileVisitor]
[java.nio.file.attribute BasicFileAttributes]))

(set! *warn-on-reflection* true)

Expand Down Expand Up @@ -91,16 +92,17 @@
[^Path root ^File blob tree link]
(let [m {:dir (.toFile root) :bdir blob}]
(proxy [SimpleFileVisitor] []
(visitFile [^Path path attr]
(visitFile [^Path path ^BasicFileAttributes attr]
(with-let [_ fs/continue]
(let [p (str (.relativize root path))]
(try (let [h (digest/md5 (.toFile path))
t (.toMillis (Files/getLastModifiedTime path fs/link-opts))
i (str h "." t)]
(when-not (.isSymbolicLink attr)
(try (let [h (digest/md5 (.toFile path))
t (.toMillis (Files/getLastModifiedTime path fs/link-opts))
i (str h "." t)]
(add-blob! blob path i link)
(swap! tree assoc p (map->TmpFile (assoc m :path p :id i :hash h :time t))))
(catch java.nio.file.NoSuchFileException _
(util/dbug* "Tmpdir: file not found: %s\n" (.toString p)))))))
(util/dbug* "Tmpdir: file not found: %s\n" (.toString p))))))))
(visitFileFailed [^Path path ^java.io.IOException e]
(with-let [_ fs/skip-subtree]
(util/dbug* "Tmpdir: failed to visit: %s\n" (str (.relativize root path))))))))
Expand Down