Comments (2)
It's possible I could work on a proof-of-concept to evaluate viability of this feature, if you would be interested.
Yes, I would be interested, but bear in mind that this is likely to be a significant amount of work and require deep changes to chezmoi's internals. Please describe how you propose to modify chezmoi to support this before starting significant work.
Fundamentally, this will require changes to how chezmoi performs updates, where the target state does not match the destination state. Specifically, currently chezmoi changes the permissions on each directory at most once. To implement the functionality requested in this PR, if a readonly_
directory requires changes then chezmoi would have to modify the directory to allow writes, update the directory's children, and then modify the directory to disallow writes. i.e., chezmoi would have to be modified to visit directories twice, not once.
Another consideration is that if the update phase is interrupted then the directory may be left in the wrong state.
from chezmoi.
For convenience, here is a Dockerfile that will quickly demonstrate the issue:
FROM debian:12-slim
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y curl && apt-get clean
RUN sh -c "$(curl -fsLS get.chezmoi.io)"
RUN useradd -m user
USER user
RUN :\
&& export source="$(chezmoi source-path)" \
&& chezmoi init \
&& mkdir "$source/readonly_test_dir" \
&& echo foo >"$source/readonly_test_dir/foo" \
&& chezmoi apply \
&& echo bar >"$source/readonly_test_dir/bar" \
&& chezmoi apply
# Output: chezmoi: open /home/user/test_dir/.foo8977729695619710040: permission denied
To run:
docker build --no-cache --progress=plain -t chezmoi-issue-3441 . && docker run -it --rm chezmoi-issue-3441
from chezmoi.
Related Issues (20)
- Ignore files when doing chezmoi add? HOT 2
- Implementing Declarative Syntax for Streamlined Package Installation HOT 2
- How can I manage chezmoi configuration with chezmoi? HOT 6
- Support symlinks in mackup command HOT 6
- Wrong hostname in chezmoi data HOT 2
- chezmoiexternals conflict HOT 4
- `chezmoi cd` errors with `chezmoi: already in a chezmoi subshell` when in a different subshell HOT 5
- Chezmoi confused with `exact_` and externals inside it HOT 5
- Unable to call templates in `.chezmoi.toml.tmpl` HOT 5
- `run_onchange_` scripts are not re-executed after `chezmoi state delete-bucket --bucket=scriptState` HOT 4
- Documentation HOT 3
- secret keyring panics, "no annotations"
- rbw: pass additional arguments HOT 2
- Ignore files between multiple devices not working HOT 3
- Switching to chezmoi feels confusing HOT 1
- use 'open' KeepassXC-cli command HOT 3
- Chezmoi does not correctly process templates that combine the `include` and `split` functions HOT 2
- chezmoi status different from chezmoi git status HOT 2
- `chezmoi secret keyring get` dumps a stack trace HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chezmoi.