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

on linux if TZ env var set and starts with ':', use as timezone #144

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

astraw
Copy link
Member

@astraw astraw commented Nov 24, 2024

This is an idea to address #118 on linux. What do folks think? @lopopolo @Kijewski

@@ -1,6 +1,17 @@
use std::fs::{read_link, read_to_string};

pub(crate) fn get_timezone_inner() -> Result<String, crate::GetTimezoneError> {
if let Some(tz) = std::env::var_os("TZ") {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that env::var_os is due to be made unsafe in Rust 2024, I'm not comfortable with this. If we do support reading from the TX env var, I'd rather it be gated by a feature and exposed via a new entry point.

At least in Artichoke, I'd not use this as is since my application must run its own hooks on env accesses and e.g. allow disabling all env accesses via a feature for sandboxing.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd make the same argument. Interacting with environment variables is IMHO out-of-scope of this library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants