Skip to content

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

@kidhanis

Description

@kidhanis

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions