tlienart / FranklinTemplates.jl

Simple website templates for Franklin.jl

Home Page:https://tlienart.github.io/FranklinTemplates.jl/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`chmod` can fail, preventing other files files from having their modes changed.

Sean1708 opened this issue · comments

I use direnv and one of the things it does is create an immutable .direnv/ directory (or possibly it just creates links to the Nix store, which is immutable, I don't remember exactly) over which the current user does not have permissions. When newsite walks the file tree and tries to change the files' mode it fails on the first .direnv/ file it reaches

julia> newsite(".", template = "lanyon")
ERROR: IOError: chmod("/Users/<omitted>/.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa", 0o644): operation not permitted (EPERM)
Stacktrace:
 [1] uv_error
   @ Base ./libuv.jl:100 [inlined]
 [2] chmod(path::String, mode::UInt16; recursive::Bool)
   @ Base.Filesystem ./file.jl:1156
 [3] chmod
   @ ./file.jl:1154 [inlined]
 [4] newsite(topdir::String; template::String, changedir::Bool, verbose::Bool)
   @ FranklinTemplates ~/.julia/packages/FranklinTemplates/RnoKK/src/utils.jl:59
 [5] top-level scope
   @ REPL[15]:1

meaning that any files that are due to have their mode changed after that will be missed.

I think the "correct" fix here would be to only try to change the modes of files that are under Franklin's purview, but doing that properly in a way that is resilient to future changes is probably far more effort than it's worth. Instead I think a more pragmatic fix would be to either wrap the chmod call in a try or maybe allow the user to pass a list of paths to ignore when running it.

I also understand if you don't think this is a common enough problem to be worth maintaining a fix, since this is definitely a very niche issue.

Related to, but not quite the same as, #157.