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

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

Open
Sean1708 opened this issue Feb 2, 2024 · 1 comment

Comments

@Sean1708
Copy link

Sean1708 commented Feb 2, 2024

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.

@Sean1708
Copy link
Author

Sean1708 commented Feb 2, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant