From 819b0bab8f94f7071ef7f32dbb93b57a0f24b9e6 Mon Sep 17 00:00:00 2001 From: Taksh Date: Sun, 19 Jul 2026 10:40:47 +0300 Subject: [PATCH] fix: quote datadir for postgres load and wget check already handles spaces (#481/#2068); load still used unquoted datadir and \cd without quoting, so paths with spaces broke at import. Co-authored-by: Cursor --- mimic-iii/buildmimic/postgres/Makefile | 8 ++++---- mimic-iii/buildmimic/postgres/postgres_load_data.sql | 2 +- mimic-iii/buildmimic/postgres/postgres_load_data_7zip.sql | 2 +- mimic-iii/buildmimic/postgres/postgres_load_data_gz.sql | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mimic-iii/buildmimic/postgres/Makefile b/mimic-iii/buildmimic/postgres/Makefile index 17ea42e20..29953adbd 100644 --- a/mimic-iii/buildmimic/postgres/Makefile +++ b/mimic-iii/buildmimic/postgres/Makefile @@ -104,7 +104,7 @@ mimic-build-gz: @echo '------------------' @echo '' @sleep 2 - psql "$(DBSTRING)" -v ON_ERROR_STOP=1 -f postgres_load_data_gz.sql -v mimic_data_dir=${datadir} + psql "$(DBSTRING)" -v ON_ERROR_STOP=1 -f postgres_load_data_gz.sql -v "mimic_data_dir=$(DATADIR)" @echo '' @echo '--------------------' @echo '-- Adding indexes --' @@ -151,7 +151,7 @@ mimic-build: @echo '------------------' @echo '' @sleep 2 - psql "$(DBSTRING)" -v ON_ERROR_STOP=1 -f postgres_load_data.sql -v mimic_data_dir=${DATADIR} + psql "$(DBSTRING)" -v ON_ERROR_STOP=1 -f postgres_load_data.sql -v "mimic_data_dir=$(DATADIR)" @echo '' @echo '--------------------' @echo '-- Adding indexes --' @@ -184,7 +184,7 @@ ifeq ("$(physionetuser)","") @echo 'Call the makefile again with physionetuser=' @echo ' e.g. make eicu-download datadir=/path/to/data physionetuser=hello@physionet.org' else - wget --user $(physionetuser) --ask-password -P $(DATADIR) -A csv.gz -m -p -E -k -K -np -nd "$(PHYSIONETURL)" + wget --user $(physionetuser) --ask-password -P "$(DATADIR)" -A csv.gz -m -p -E -k -K -np -nd "$(PHYSIONETURL)" endif mimic-demo-download: @@ -192,7 +192,7 @@ mimic-demo-download: @echo '-- Downloading MIMIC-III from PhysioNet --' @echo '------------------------------------------' @echo '' - wget --user $(physionetuser) --ask-password -P $(DATADIR) -A csv.gz -m -p -E -k -K -np -nd "$(PHYSIONETDEMOURL)" + wget --user $(physionetuser) --ask-password -P "$(DATADIR)" -A csv.gz -m -p -E -k -K -np -nd "$(PHYSIONETDEMOURL)" #This is fairly inelegant and could be tidied with a for loop and an if to check for gzip, #but need to maintain compatibility with Windows, which baffling lacks these things diff --git a/mimic-iii/buildmimic/postgres/postgres_load_data.sql b/mimic-iii/buildmimic/postgres/postgres_load_data.sql index 3fe94c5e6..5245bac8d 100644 --- a/mimic-iii/buildmimic/postgres/postgres_load_data.sql +++ b/mimic-iii/buildmimic/postgres/postgres_load_data.sql @@ -9,7 +9,7 @@ -------------------------------------------------------- -- Change to the directory containing the data files -\cd :mimic_data_dir +\cd :'mimic_data_dir' -- If running scripts individually, you can set the schema where all tables are created as follows: -- SET search_path TO mimiciii; diff --git a/mimic-iii/buildmimic/postgres/postgres_load_data_7zip.sql b/mimic-iii/buildmimic/postgres/postgres_load_data_7zip.sql index c47799b58..36c27dca9 100644 --- a/mimic-iii/buildmimic/postgres/postgres_load_data_7zip.sql +++ b/mimic-iii/buildmimic/postgres/postgres_load_data_7zip.sql @@ -9,7 +9,7 @@ -------------------------------------------------------- -- Change to the directory containing the data files -\cd :mimic_data_dir +\cd :'mimic_data_dir' -- If running scripts individually, you can set the schema where all tables are created as follows: -- SET search_path TO mimiciii; diff --git a/mimic-iii/buildmimic/postgres/postgres_load_data_gz.sql b/mimic-iii/buildmimic/postgres/postgres_load_data_gz.sql index e993635e2..4cf2835cc 100644 --- a/mimic-iii/buildmimic/postgres/postgres_load_data_gz.sql +++ b/mimic-iii/buildmimic/postgres/postgres_load_data_gz.sql @@ -9,7 +9,7 @@ -------------------------------------------------------- -- Change to the directory containing the data files -\cd :mimic_data_dir +\cd :'mimic_data_dir' -- If running scripts individually, you can set the schema where all tables are created as follows: -- SET search_path TO mimiciii;