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

Failed to initialize logging on read-only HOME #48

Closed
mennthor opened this issue Jun 2, 2021 · 13 comments · Fixed by #50
Closed

Failed to initialize logging on read-only HOME #48

mennthor opened this issue Jun 2, 2021 · 13 comments · Fixed by #50
Labels
E-easy Call for participation: Experience needed to fix: Easy / not much

Comments

@mennthor
Copy link

mennthor commented Jun 2, 2021

I'm on Debian Jessie but the HOME is read-only atm.
So I set CARGO_HOME to a writable location and installed helix from source as specified in the README.
The runtime folder was copied to $CARGO_HOME/bin.
I tested this setup on another machine (OSX) with writable home and it works properly there.
On the Debian however, I get

Error: failed to initialize logging

Caused by:
    Read-only file system (os error 30)

when starting hx.

@archseer
Copy link
Member

archseer commented Jun 2, 2021

Good point, we should probably log into config_dir() (usually ~/.config/helix)

pub fn config_dir() -> std::path::PathBuf {
// TODO: allow env var override
use etcetera::base_strategy::{choose_base_strategy, BaseStrategy};
let strategy = choose_base_strategy().expect("Unable to find the config directory!");
let mut path = strategy.config_dir();
path.push("helix");
path
}

Right now it just always uses home:

.chain(fern::log_file(home.join("helix.log"))?);

@archseer archseer added the E-easy Call for participation: Experience needed to fix: Easy / not much label Jun 2, 2021
@vv9k
Copy link
Contributor

vv9k commented Jun 2, 2021

Changing the path to config_dir still doesn't resolve the issue of $HOME being read-only. I'm wondering if perhaps the result of setup_logging should be ignored so users can still operate without the logging mechanism?

@archseer archseer reopened this Jun 2, 2021
@archseer
Copy link
Member

archseer commented Jun 2, 2021

I reopened this since it doesn't fully resolve your issue; is ~/.config/``~/.local/ etc. completely unwritable? I find that a bit surprising.

@pickfire
Copy link
Contributor

pickfire commented Jun 2, 2021

The weirdest thing I find is it logs (at first to home, then to ~/.config which it shouldn't) by default, I thought log should be opt-in? If not we can just log to /tmp right? See #64

@mennthor
Copy link
Author

mennthor commented Jun 4, 2021

Is config_dir settable via ENVVAR? Then I could choose a suitable path myself.
And yes, all of ~ is read-only atm (I had to reroute basically all settings, vim, pip, jupyter, etc.).

@pickfire
Copy link
Contributor

pickfire commented Jun 4, 2021

What if we do like -u <config> or -u none? none to disable config.

@coldpure9ev
Copy link

it's just the log function, we shouldn't just disable the config. Maybe we can make it /tmp by default or spare, and when the log file unwriteable , the editor should be useable, and don't forget the warning info

@archseer
Copy link
Member

archseer commented Jun 5, 2021

We follow the XDG specification on Linux/macOS, so if you set XDG_CACHE_HOME it'll look for a helix folder there. I think that should be the preferred solution, since that way you're able to fix all applications that rely on XDG.

I think we don't need a separate flag to disable this because we'll be leveraging the cache even more in the future (to store :command history, /search history, persist undo states & document positions across restarts etc)

@mennthor
Copy link
Author

mennthor commented Jun 7, 2021

We follow the XDG specification on Linux/macOS, so if you set XDG_CACHE_HOME it'll look for a helix folder there.

Not sure I get that correctly. I already have XDG_CACHE_HOME, XDG_STATE_HOME and XDG_CACHE_HOME set to writable and existing directories (and also added a helix folder in each, just to be sure), but the logging error is still there.
Am I overlooking a setting / flag I need to give at startup?

@archseer
Copy link
Member

archseer commented Jun 7, 2021

This is on the latest release (0.0.10), and the error is still "Read-only file system"? It's supposed to log to XDG_CACHE_HOME/helix/helix.log now.

@mennthor
Copy link
Author

mennthor commented Jun 7, 2021

Sorry, that was my fault. It does indeed log to XDG_CACHE_HOME/helix/helix.log now.
Thanks :)

@pickfire
Copy link
Contributor

pickfire commented Jun 7, 2021

@mennthor Ah, no. Thanks for sending in the issue request. It was only since 0.0.10 doing that but 0.0.9 doesn't have this. Closing this as it isn't an issue, it was also shown in -h.

@pickfire pickfire closed this as completed Jun 7, 2021
@Siilwyn
Copy link
Contributor

Siilwyn commented Jun 14, 2021

Maybe it would be nice to use the new XDG_STATE_HOME for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Call for participation: Experience needed to fix: Easy / not much
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants