Skip to content

Commit f1f3775

Browse files
feat: Add POLARS_ALLOW_UNSECURED_TEMP_DIR environment variable (#21137)
1 parent 875829b commit f1f3775

File tree

1 file changed

+7
-3
lines changed
  • crates/polars-io/src/path_utils

1 file changed

+7
-3
lines changed

crates/polars-io/src/path_utils/mod.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pub static POLARS_TEMP_DIR_BASE_PATH: Lazy<Box<Path>> = Lazy::new(|| {
8080
{
8181
use std::os::unix::fs::PermissionsExt;
8282

83-
(|| {
83+
let result = (|| {
8484
std::fs::set_permissions(path.as_ref(), std::fs::Permissions::from_mode(0o700))?;
8585
let perms = std::fs::metadata(path.as_ref())?.permissions();
8686

@@ -102,7 +102,11 @@ pub static POLARS_TEMP_DIR_BASE_PATH: Lazy<Box<Path>> = Lazy::new(|| {
102102
path.as_ref()
103103
),
104104
)
105-
})?
105+
});
106+
107+
if std::env::var("POLARS_ALLOW_UNSECURED_TEMP_DIR").as_deref() != Ok("1") {
108+
result?;
109+
}
106110
}
107111

108112
std::io::Result::Ok(path)
@@ -112,7 +116,7 @@ pub static POLARS_TEMP_DIR_BASE_PATH: Lazy<Box<Path>> = Lazy::new(|| {
112116
e.kind(),
113117
format!(
114118
"error initializing temporary directory: {} \
115-
consider explicitly setting POLARS_TEMP_DIR ",
119+
consider explicitly setting POLARS_TEMP_DIR",
116120
e
117121
),
118122
)

0 commit comments

Comments
 (0)