Comments (5)
The immediate fix is to delete the directory /tmp/zsh-abbr/jobs and then reload the shell (exec zsh). When the plugin initializes it will recreate the directory.
Yep did just that yesterday.
Instead I think we can work around it with user configuration: in your .zshrc before loading the plugin, customize ABBR_TMPDIR to use a directory that can be read and written to by root and your other user(s):
# ~/.zshrc ABBR_TMPDIR=some/directory/root-and-nonroot/can-write/to # and then load zsh-abbr
Let me know if that works!
That's an interesting approach. Will test, thanks!
Edit: I need some more help on setting that variable as I'm not entirely sure where that directory should be such that, when root operates on it, it doesn't chown it.
/dev/nvme0n1p5 on / type ext4 (rw,relatime)
/dev/nvme0n1p1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,size=4026120k,nr_inodes=1048576,inode64)
/dev/nvme0n1p3 on /mnt/win type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096,x-gvfs-show)
/dev/sda2 on /mnt/data type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096,x-gvfs-show)
/dev/nvme0n1p6 on /home type ext4 (rw,relatime)
These are my current available partitions. Had some trouble with the ntfs partitions so I changed the ntfs3
driver to ntfs
, that's probably why I have fuseblk
there. Does the uid=0 and gid=0 mean that I can't use the /mnt/data
? Can I use just my $HOME/.cache
?
2nd edit:
Could I create a root and user folder in temp and point the respective zsh config to the right folder?
3rd edit xDD:
┌──(ervin@archnet)-[~]
└─$ echo $ABBR_TMPDIR
/tmp/zsh-abbr-user/
┌──(root@archnet)-[/home/ervin]
└─# echo $ABBR_TMPDIR
/tmp/zsh-abbr-root/
This seems to work. It also fixes a bug I've been having, the abbreviations were inconsistent when switching from user to root and back:
abbr p="pacman" (root)
abbr p="sudo pacman" (user)
I'm going to close this.
from zsh-abbr.
Hi @olets, that sounds great and all, but I really don't think that's needed, the solution for this was mostly driven by you, so I am good with staying in the shadows :)
Thanks for the proposal though!
from zsh-abbr.
Solved... I've used the same plugin with the root account and apparently the tmp folder has been modified/created as root.
I don't think this is the best practice tho. Do I have to source a different zsh-abbr.zsh
?
from zsh-abbr.
Thanks for the report!
I've used the same plugin with the root account and apparently the tmp folder has been modified/created as root
Aha. That makes sense I think.
The immediate fix is to delete the directory /tmp/zsh-abbr/jobs
and then reload the shell (exec zsh
). When the plugin initializes it will recreate the directory.
Would be nice if the zsh-abbr handled this case, but my gut says it would be tricky to implement well. Some sort of per-permission-level file, and each session tracks down the right one? Don't want to do anything with changing file permissions, feels like that could open attack vectors.
Instead I think we can work around it with user configuration: in your .zshrc
before loading the plugin, customize ABBR_TMPDIR to use a directory that can be read and written to by root and your other user(s):
# ~/.zshrc
ABBR_TMPDIR=some/directory/root-and-nonroot/can-write/to
# and then load zsh-abbr
Let me know if that works!
from zsh-abbr.
Hi @ervinpopescu I revisited this, and built a separate-directories solution in v5.6.0.
Lmk if you'd like to be added to https://github.com/olets/zsh-abbr#community and https://zsh-abbr.olets.dev/community/ for the bug report and thinking through the solution. If so I'll have the all-contributors bot open a pull request. I'll tag you in it, and you'll need to review before I merge to make sure the bot pulled the right info.
from zsh-abbr.
Related Issues (20)
- `zsh-abbr` not working when the `viins` keymap is selected HOT 5
- abbr command completion
- [Bug report] bad math expression: operator expected at `Jan 1 03:...' HOT 4
- [feature] abbreviations may place the cursor anywhere in the expansion, instead of only at the end HOT 1
- [Bug report] Cannot programmatically delete abbreviations containing certain characters HOT 5
- fast-syntax-highlighting highlighting of multi-word abbreviations
- [Bug report] Terminal "freezes" when there is no abbreviations and highlights for user abbreviations are used with zsh-syntax-highlighting HOT 4
- Using zi/zinit's `sbin'**/eza -> ls'` to replace `ls` with `eza` breaks zsh-abbr initialization HOT 4
- [Feature] Prefixes 1/n: Ignored string prefixes
- [Feature] Prefixes 2/n: Ignored glob prefixes
- [Feature] Prefixes 3/n: linear combinations of prefixes
- [Bug] unexpected behavior when `ABBR_EXPANSION_CURSOR_MARKER` set to caret HOT 3
- acknowledge committers
- allcontributors 1/ HOT 2
- acknowledge bug reporters HOT 1
- `!` is escaped in v5, but wasn’t in v4 HOT 12
- `abbr c` does not clear abbreviations created with the pattern `abbr x=y` HOT 3
- Teach `add` about `--force`
- [Bug report] involuntary history filtering possible in combination with zsh-autosuggestions and v5.x HOT 11
- Conflict warning logged in all new sessions when adding an abbreviation in zshrc HOT 1
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 zsh-abbr.