-
-
Notifications
You must be signed in to change notification settings - Fork 627
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
Make xonsh tolerant to inaccessible xonsh data paths #5319
Comments
We need to avoid stopping the work in this case and show the warning about setting |
It seems whether to use cache is not checked before updating cache on boot, but is checked in The warning should be given directly from the BTW, I found some bad practice here. |
@inmaldrerah thanks for open this! UPD: let's implement simpler solution with mitigations. I see this bigger: make xonsh tolerant to inaccessible xonsh data paths starting from So for achieving this awesome thing I have in mind this draft:
|
…che (#5430) Closes #5319 ### Before ```xsh mkdir -p /tmp/noaccess chmod 000 /tmp/noaccess echo 'print(1)' > /tmp/1.xsh xonsh --no-rc --no-env -DXONSH_DATA_DIR='/tmp/noaccess' # Json History error xonsh --no-rc --no-env -DXONSH_DATA_DIR='/tmp/noaccess' /tmp/1.xsh # Script cache error ``` ### After ```xsh mkdir -p /tmp/noaccess chmod 000 /tmp/noaccess echo 'print(1)' > /tmp/1.xsh xonsh --no-rc --no-env -DXONSH_DATA_DIR='/tmp/noaccess' # Error during load <class 'xonsh.history.json.JsonHistory'>: [Errno 13] Permission denied: '/tmp/noaccess/history_json' # Set $XONSH_HISTORY_BACKEND='dummy' to disable history. # History disabled. # @ xonsh --no-rc --no-env -DXONSH_DATA_DIR=/tmp/noaccess /tmp/1.xsh # xonsh: For full traceback set: $XONSH_SHOW_TRACEBACK = True # update_cache: Cache file is not writable: /tmp/noaccess/xonsh_script_cache/private/tmp/1_.xsh.cpython-311 # Set $XONSH_CACHE_SCRIPTS=0, $XONSH_CACHE_EVERYTHING=0 to disable cache. # 1 ``` And no warnings when everything is switched off: ```xsh xonsh % python -m xonsh --no-rc --no-env -DXONSH_DATA_DIR=/tmp/noaccess -DXONSH_HISTORY_BACKEND=dummy # @ xonsh --no-rc --no-env -DXONSH_DATA_DIR=/tmp/noaccess -DXONSH_CACHE_SCRIPTS=0 -DXONSH_CACHE_EVERYTHING=0 /tmp/1.xsh # 1 ``` ## For community ⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍 comment** --------- Co-authored-by: a <1@1.1> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
xonfig
My distro is actually NixOS.
Expected Behavior
Xonsh runs, though giving up logging command history to file.
People need a shell for data rescue if they mess up their filesystem and can only mount it read only.
Current Behavior
Xonsh keeps throwing errors on an
open(...)
call and I cannot input anything except pressing <c-C> to exit the shell.Traceback (if applicable)
I havn't yet tried readonly
~/.local/share/xonsh
, but I set$XONSH_DATA_DIR
top"~/ro"
where I build up a readonly overlayfs, and got the following output (and now I understand why it is generating infinite logs: I set xonsh as my login shell and it keeps falling back to itself on error)Steps to Reproduce
For community
⬇️ Please click the 👍 reaction instead of leaving a
+1
or 👍 commentThe text was updated successfully, but these errors were encountered: