diff options
author | Victor Borja <vic@users.noreply.github.com> | 2018-09-04 21:10:16 -0700 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2018-09-05 12:10:16 +0800 |
commit | ec5f843aa2a53fc8e24f3366f483db6c971ba85b (patch) | |
tree | 749f009642f64d77ed890ecb5b97c1b3e25342f2 /main/core | |
parent | a6efead6bafd34a7c55a58e3dc5d6267345672f1 (diff) | |
download | mill-ec5f843aa2a53fc8e24f3366f483db6c971ba85b.tar.gz mill-ec5f843aa2a53fc8e24f3366f483db6c971ba85b.tar.bz2 mill-ec5f843aa2a53fc8e24f3366f483db6c971ba85b.zip |
Make sure files are readable when traversing source files. (#423)
Mill was trying to read all files found under the source directory to
create a digest for each of them. This was causing an error for broken
symlinks.
At first I believed temporary files should be ignored to avoid this problem,
and asked at the gitter channel how to go about this, but overriding the `sources`
task as [suggested](https://gitter.im/lihaoyi/mill?at=5ad6cd801130fe3d36eb7655)
by @lihaoyi didn't actually help.
on a simple scala project, editing a file with Emacs, creates a link file, like:
```
vic@oeiuwq ~/h/foo> ls -la foo/src/
total 8
drwxr-xr-x 4 vic staff 128 Sep 1 12:23 .
lrwxr-xr-x 1 vic staff 22 Sep 1 12:23 .#hello.scala -> vic@oeiuwq.local.10748
drwxr-xr-x 3 vic staff 96 Sep 1 12:22 ..
-rw-r--r-- 1 vic staff 12 Sep 1 12:22 hello.scala
```
So this patch only makes sures that the files (or the symlink here) is actually
readable before trying to digest it.
Fixes #402
Diffstat (limited to 'main/core')
-rw-r--r-- | main/core/src/mill/eval/PathRef.scala | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/main/core/src/mill/eval/PathRef.scala b/main/core/src/mill/eval/PathRef.scala index 118d98fe..4983f040 100644 --- a/main/core/src/mill/eval/PathRef.scala +++ b/main/core/src/mill/eval/PathRef.scala @@ -43,7 +43,7 @@ object PathRef{ digest.update((value >>> 16).toByte) digest.update((value >>> 8).toByte) digest.update(value.toByte) - }else { + } else if (jnio.Files.isReadable(file)) { val is = jnio.Files.newInputStream(file) IO.stream(is, digestOut) is.close() |