JuliaLang / JuliaLang/juliaup

Julia Installer Crash Report (Better Unix Base directories specifications )

Open
#308 3 comments 0 reactions 0 assignees View on GitHub
crash report help wanted
Dominant language
Rust
Stars
1.3k
Forks
116
Avg merge
12h 34m
Merged PRs (30d)
19

Description

Hello, I am on an M1 Mac.
I encountered this error report:
```
name = 'Juliainstaller'
operating_system = 'unix:OSX'
crate_version = '1.6.4'
explanation = '''
Panic occurred in file 'src/operations.rs' at line 534
'''
cause = '''
called `Result::unwrap()` on an `Err` value: Failed to open juliaup config file.

Caused by:
No such file or directory (os error 2)'''
method = 'Panic'
backtrace = '''

0: 0x102dd664c - juliaup::command_config_modifypath::run_command_config_modifypath::h22055a10e45fa8e4
1: 0x102d1d794 - juliainstaller::main::hec60d2626a25bbd4
2: 0x102d0c340 - std::sys_common::backtrace::__rust_begin_short_backtrace::h38b7456c5d856e39
3: 0x102d2085c - _main'''
```

The installer configuration which I selected was the following:
```
✔ Do you want to install with these custom configuration choices? · Customize installation
✔ Enter the folder where you want to install Juliaup · /Users/user/.juliaup
✔ Do you want to add the Julia binaries to your PATH by manipulating various shell startup scripts? · no
✔ Do you want to add channel specific symlinks? · no
✔ Enter minutes between check for new version at julia startup, use 0 to disable · 1440
✔ Enter minutes between check for new version by a background task, use 0 to disable · 0
```
Most notably, I requested not to automatically modify the .zshrc file to add julia to the PATH (I rather do it by hand).
The culprit seems to be
```
pub fn remove_binfolder_from_path_in_shell_scripts() -> Result<()> {
let paths = find_shell_scripts_to_be_modified()?;

paths.into_iter().for_each(|p| {
remove_path_from_specific_file(p).unwrap();
});

Ok(())
}
```
I don't know rust enough, but since I requested no config file modifications, the variable `paths` should be empty, but we still try to iterate through it, without checks. Maybe rusts handles this on his own and the issue is further up?

Actually, I notice also that the function `find_shell_scripts_to_be_modified()` assumes that the `.zshrc` file is in the home folder. But i keep my `.zshrc` file in the `~/.config/zsh` folder. This assumption most likely caused the crash.

If that is the case a possible fix could be: Instead of defaulting to the home directory, use the `$ZDOTDIR` env variable (which I use to set the dot dir for zsh to the previously mentioned non-default location). Quoting the zsh man pages shipped with the OS:

```
Commands are then read from $ZDOTDIR/.zshenv. If the shell is a login shell,
commands are read from /etc/zprofile and then $ZDOTDIR/.zprofile.
Then, if the shell is interactive, commands are read from /etc/zshrc and then $ZDOTDIR/.zshrc.
Finally, if the shell is a login shell, /etc/zlogin and $ZDOTDIR/.zlogin are read.
[...]
If ZDOTDIR is unset, HOME is used instead.
```

P.S.: I found rather strange that the code went trough these routines even after electing to not have any startup file modified.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with src/operations.rs at the reported line and inspect remove_binfolder_from_path_in_shell_scripts() and find_shell_scripts_to_be_modified(). Reproduce the custom installation on macOS with shell-file modification disabled and a non-default ZDOTDIR, then verify the installer no longer panics and handles the selected shell configuration correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.