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

Bug: crashes in setup-environment-commands due to misbehaving ecosystems causes sources/environment.* to be empty #235

Closed
oscarvarto opened this issue Jul 11, 2024 · 12 comments
Labels
bug Broken or unexpected

Comments

@oscarvarto
Copy link
Contributor

oscarvarto commented Jul 11, 2024

I am working on macOS Sonoma 14.5.

I tried doing a reinstall of Dorothy after removing ~/.local/share/dorothy and ~/.config/dorothy. After running the install command from the README.md:

bash -ic "$(curl -fsSL https://dorothy.bevry.me/install)"

from my terminal (no matter if I use nu/fish) I get a problem in fish shell. The sourcing of:

source '/Users/oscarvarto/.local/share/dorothy/init.fish' # Dorothy

is added at the end of my config.fish and then whenever I open fish, I get a lot of error messages:

fish: Unknown command: get-terminal-theme
~/.local/share/dorothy/sources/login.fish (line 37): 
get-terminal-theme --clear-cache
^~~~~~~~~~~~~~~~~^
from sourcing file ~/.local/share/dorothy/sources/login.fish
	called on line 11 of file ~/.local/share/dorothy/init.fish
from sourcing file ~/.local/share/dorothy/init.fish
	called on line 126 of file ~/.config/fish/config.fish
from sourcing file ~/.config/fish/config.fish
	called during startup
fish: Unknown command: command-exists
~/.local/share/dorothy/sources/ssh.fish (line 10): 
if command-exists gpg
   ^~~~~~~~~~~~~^
from sourcing file ~/.local/share/dorothy/sources/ssh.fish
	called on line 12 of file ~/.local/share/dorothy/sources/interactive.fish
from sourcing file ~/.local/share/dorothy/sources/interactive.fish
	called on line 13 of file ~/.local/share/dorothy/init.fish
from sourcing file ~/.local/share/dorothy/init.fish
	called on line 126 of file ~/.config/fish/config.fish
from sourcing file ~/.config/fish/config.fish
	called during startup
fish: Unknown command: command-exists
~/.local/share/dorothy/sources/ssh.fish (line 15): 
if command-exists ssh-agent
   ^~~~~~~~~~~~~^
from sourcing file ~/.local/share/dorothy/sources/ssh.fish
	called on line 12 of file ~/.local/share/dorothy/sources/interactive.fish
from sourcing file ~/.local/share/dorothy/sources/interactive.fish
	called on line 13 of file ~/.local/share/dorothy/init.fish
from sourcing file ~/.local/share/dorothy/init.fish
	called on line 126 of file ~/.config/fish/config.fish
from sourcing file ~/.config/fish/config.fish
	called during startup
fish: Unknown command: command-exists
~/.local/share/dorothy/sources/autocomplete.fish (line 14): 
if test "$AUTOCOMPLETE_TEA" != 'no' && command-exists tea
                                       ^~~~~~~~~~~~~^
from sourcing file ~/.local/share/dorothy/sources/autocomplete.fish
	called on line 13 of file ~/.local/share/dorothy/sources/interactive.fish
from sourcing file ~/.local/share/dorothy/sources/interactive.fish
	called on line 13 of file ~/.local/share/dorothy/init.fish
from sourcing file ~/.local/share/dorothy/init.fish
	called on line 126 of file ~/.config/fish/config.fish
from sourcing file ~/.config/fish/config.fish
	called during startup
fish: Unknown command: command-exists
~/.local/share/dorothy/sources/autocomplete.fish (line 25): 
if command-exists carapace
   ^~~~~~~~~~~~~^
from sourcing file ~/.local/share/dorothy/sources/autocomplete.fish
	called on line 13 of file ~/.local/share/dorothy/sources/interactive.fish
from sourcing file ~/.local/share/dorothy/sources/interactive.fish
	called on line 13 of file ~/.local/share/dorothy/init.fish
from sourcing file ~/.local/share/dorothy/init.fish
	called on line 126 of file ~/.config/fish/config.fish
from sourcing file ~/.config/fish/config.fish
	called during startup
fish: Unknown command: command-exists
~/.local/share/dorothy/sources/interactive.fish (line 16): 
if command-exists shuf
   ^~~~~~~~~~~~~^
from sourcing file ~/.local/share/dorothy/sources/interactive.fish
	called on line 13 of file ~/.local/share/dorothy/init.fish
from sourcing file ~/.local/share/dorothy/init.fish
	called on line 126 of file ~/.config/fish/config.fish
from sourcing file ~/.config/fish/config.fish
	called during startup
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish

I realized that moving the line:

source '/Users/oscarvarto/.local/share/dorothy/init.fish' # Dorothy

at the beginning of my config.fish gets rid of the error messages, but I think the first time I installed dorothy this wasn't a problem. So, I think I haven't found a way to do a complete uninstall of Dorothy to get the things the way they were at the beginning to start over. This is not good 🫤.

Why there is no easy way to completely uninstall Dorothy and possibly start from scratch?

===
On the other hand, Dorothy injects a lot of entries to my PATH, which I find very inconvenient, because I loose control of the expected behavior of my programs. E.g. it injected the path to XCode stuff, but then the compilation process for vterm in Emacs (needing a C compiler) failed to find stdlib.h. I had to remove the sourcing of Dorothy, make emacs read my original PATH again, and do the compiling process correctly.

@oscarvarto
Copy link
Contributor Author

Now I will try to find the places where dorothy is referenced for several shells in my system and delete them. Maybe they are not in the right place?? Don't know for sure.

@balupton
Copy link
Member

I'll be home in two hours. If you are available then, I could remote in and find out what is going on.

@oscarvarto
Copy link
Contributor Author

oscarvarto commented Jul 11, 2024 via email

@balupton
Copy link
Member

balupton commented Jul 11, 2024

Okay, grab anytime on https://cal.com/balupton/call and we'll arrange a time. Sleep well

@balupton
Copy link
Member

Join Zoom Meeting
https://us05web.zoom.us/j/9855647764?pwd=Mll2RWc0M3M4NzhnOTdIck5oVHNYZz09

Meeting ID: 985 564 7764
Passcode: liberty53k

@balupton
Copy link
Member

Actually, zoom just booted me and wants me to wait 6 minutes before starting a new meeting.

@balupton
Copy link
Member

Okay, back in zoom

@oscarvarto
Copy link
Contributor Author

I had some internet connectivity issues. Like I said in the call, my mother's in law service is bad :(

@balupton
Copy link
Member

balupton commented Jul 17, 2024

So it was definitely zoom hitting the 40m mark originally, then updating to v6 of the zoom client on my end caused me to have to wait 10 minutes or so before starting a zoom meeting. But now def internet connection issues.

So it was yarn not following standard conventions that caused the setup-environment-commands to fail, in which environment.fish was not detecting that failure and proceeding as if everything was okay, which it was not.

You can send a PR with those changes ~/.local/share/dorothy and I'll get them merged, as well as look into better error detection and handling so such failures are not silent.

For where you are at now, you can start moving things from ~/.config/fish/config.fish that ~/.local/share/dorothy/commands/setup-environment-commands doesn't already handle into your Dorothy User Config ~/.config/dorothy/config/interactive.fish file, e.g. https://github.com/bevry/dorothy/blob/master/config/interactive.fish and https://github.com/edmcman/dotfiles/blob/main/config/interactive.fish

If you want your environment changes to be cross-shell compatible, put them in /.config/dorothy/config/environment.bash instead (which is sourced by setup-environment-commands which converts it to a cross-shell compatible format), e.g. https://github.com/bevry/dorothy/blob/master/config/environment.bash and https://github.com/balupton/dotfiles/blob/main/config/environment.bash

Lastly, you'll want to git init and setup a repo for your ~/.config/dorothy directory, which is your Dorothy User Config. I will need to update Dorothy's install script to detect repository renames, and if so, prompt the user if they want to follow the direct or setup a new repo, as was the case for you where dotfiles became old-dot-files

So my todos:

@oscarvarto
Copy link
Contributor Author

Thanks, @balupton for your help and patience. I'll try to do the MR soon.

@balupton balupton changed the title Dorothy reinstall fails on fish Bug: crashes in setup-environment-commands due to misbehaving ecosystems causes sources/environment.* to be empty Jul 17, 2024
balupton pushed a commit that referenced this issue Jul 17, 2024
…es to stderr

Yarn outputs its failures to stdout, and included a non-zero exit status, this causes `setup-environment-commands` to crash. This PR fixes it by checking the exit status for success, and if successful then calls again and captures stdout.

/pr #236 
/ref #235
@balupton
Copy link
Member

Merged! Will get to the other tasks over the coming weeks.

@balupton
Copy link
Member

balupton commented Aug 8, 2024

Note the push fix for this, the detection of the crash and its human readable advice, is only applicable to posix shells and fish. Other shells will need someone experienced with those shells to implement the necessary support in their environment.* files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Broken or unexpected
Development

No branches or pull requests

2 participants