QGIS-Mac-Packager icon indicating copy to clipboard operation
QGIS-Mac-Packager copied to clipboard

GDAL tools using bash scripts don't work when the path to QGIS.app has spaces

Open kidhanis opened this issue 1 year ago • 0 comments

QGIS version 3.32.2-Lima, running in MacOS 10.13.6. The app is installed in /Applications/My Tools/QGIS.app.

I'm trying to use Raster -> Miscellaneous -> Raster Information, which uses gdalinfo. Once I add an input layer and press Run, I get the following: /Applications/My Tools/QGIS.app/Contents/MacOS/bin/gdalinfo: line 3: /Applications/My: No such file or directory The path is stopping at the space in "My Tools". If I move QGIS to /Applications/QGIS.app then everything works fine.

The same error occurs if I run gdalinfo from /Applications/My Tools/QGIS.app/Contents/MacOS/bin/gdalinfo. In fact, the behavior seems to happen only with GDAL commands that first execute a bash script.

This is the script for gdalinfo, which might be created by QGIS-Mac-Packager/qgis_bundle/recipes/gdal/recipe.sh#L48-L50:

#!/bin/bash
THISDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
$THISDIR/run_gdal_binary.bash "gdalinfo" "$@"

The error can be fixed by adding quotes around $THISDIR in the last line.

kidhanis avatar Sep 17 '23 17:09 kidhanis