From d788af28b7c07bc8357a8d15d1d011540382d828 Mon Sep 17 00:00:00 2001 From: Luca Toniolo <10792599+grandixximo@users.noreply.github.com> Date: Wed, 10 Jun 2026 16:22:40 +0800 Subject: [PATCH] fix(scripts): report missing INI file before parse check inivalue parse check ran before the file-existence check, so a nonexistent INI file was reported as "The INI-file contains errors that need to be fixed". Move the existence check ahead of the parse check and drop the now-redundant later copy. --- scripts/linuxcnc.in | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/linuxcnc.in b/scripts/linuxcnc.in index 789b9de0eca..39b7718e2b4 100644 --- a/scripts/linuxcnc.in +++ b/scripts/linuxcnc.in @@ -406,6 +406,14 @@ function run_applications () { done } +# Make sure the INI file exists before trying to parse it. Otherwise a +# missing file would be reported as a file with errors. +if [ ! -f "$INIFILE" ] ; then + echo "Could not find INI file '$INIFILE'" + trap '' EXIT + exit 1 +fi + # Test whether we have a valid INI-file that can be parsed without error. # Running inivalue without section/variable filter should return the value of # the first variable in the first section of the file. If that fails, there is @@ -422,14 +430,6 @@ export PATH=$CONFIG_DIR/bin:$PATH [ -z "$RUNTESTS" ] && echo "Machine configuration directory is '$INI_DIR'" echo "Machine configuration file is '$INI_NAME'" -# make sure INI file exists (the tcl script just did this, so we could -# eliminate this test, but it does no harm) - -if [ ! -f "$INIFILE" ] ; then - echo "Could not find INI file '$INIFILE'" - trap '' EXIT - exit 1 -fi echo INIFILE="$INIFILE" >> "$PRINT_FILE" ################################################################################