qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.63k stars 3.01k forks source link

Settings Append or Prepend custom PATH variable will overwrite the environment variable in QGIS 3.28.15 #56128

Open PhilippeD31 opened 9 months ago

PhilippeD31 commented 9 months ago

What is the bug or the crash?

After upgrading from 3.28.13 to QGIS 3.28.15, I encountered issues with the PATH variable.

Without custom PATH, the current PATH is: C:\PROGRA~1\QGIS3.28\apps\qgis-ltr\bin;C:\PROGRA~1\QGIS3.28\apps\grass\grass83\lib;C:\PROGRA~1\QGIS3.28\apps\grass\grass83\bin;C:\PROGRA~1\QGIS3.28\apps\qt5\bin;C:\PROGRA~1\QGIS3.28\apps\Python39\Scripts;C:\PROGRA~1\QGIS3.28\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBem

With custom variable PATH: Apply: Append -- Variable: PATH -- Value: C:\ExifTool12.67 The current PATH is overwritten to: C:\ExifTool12.67

Steps to reproduce the issue

  1. Settings > Options > System:
  2. In Environment, add a custom variable PATH with Apply method "Append" or "Prepend"
  3. restart QGIS and check the current variable PATH.

Versions

QGIS version | 3.28.15-Firenze | QGIS code revision | 252ad49ddc -- | -- | -- | -- Qt version | 5.15.3 Python version | 3.9.18 GDAL/OGR version | 3.8.3 PROJ version | 9.3.1 EPSG Registry database version | v10.098 (2023-11-24) GEOS version | 3.12.1-CAPI-1.18.1 SQLite version | 3.41.1 PDAL version | 2.6.0 PostgreSQL client version | unknown SpatiaLite version | 5.1.0 QWT version | 6.1.6 QScintilla2 version | 2.13.4 OS version | Windows 10 Version 2009   |   |   |   Active Python plugins 031_donnees | 1.0.0 controler_PPR | 0.3.1 corriger_PCI_par_BDP | 1.1.0 creer_menus | 3.9.6 csv_helper | 0.9.0 ff31 | 2024.1 localiserparcelle | 3.6.0 multi_user | 1.0.0 nettoyeur | 3.4.0 outils_GPU | 1.1.3 simple_tools | 1.2.0 autofiltre3 | 3.1.2 mask | 1.10.2 MemoryLayerSaver | 5.0.1 plugin_reloader | 0.9.3 db_manager | 0.1.20 grassprovider | 2.12.99 processing | 2.12.99 QGIS version 3.28.15-Firenze QGIS code revision [252ad49ddc](https://github.com/qgis/QGIS/commit/252ad49ddc) Qt version 5.15.3 Python version 3.9.18 GDAL/OGR version 3.8.3 PROJ version 9.3.1 EPSG Registry database version v10.098 (2023-11-24) GEOS version 3.12.1-CAPI-1.18.1 SQLite version 3.41.1 PDAL version 2.6.0 PostgreSQL client version unknown SpatiaLite version 5.1.0 QWT version 6.1.6 QScintilla2 version 2.13.4 OS version Windows 10 Version 2009 Active Python plugins 031_donnees 1.0.0 controler_PPR 0.3.1 corriger_PCI_par_BDP 1.1.0 creer_menus 3.9.6 csv_helper 0.9.0 ff31 2024.1 localiserparcelle 3.6.0 multi_user 1.0.0 nettoyeur 3.4.0 outils_GPU 1.1.3 simple_tools 1.2.0 autofiltre3 3.1.2 mask 1.10.2 MemoryLayerSaver 5.0.1 plugin_reloader 0.9.3 db_manager 0.1.20 grassprovider 2.12.99 processing 2.12.99 ### Supported QGIS version - [X] I'm running a supported QGIS version according to [the roadmap](https://www.qgis.org/en/site/getinvolved/development/roadmap.html#release-schedule). ### New profile - [X] I tried with a new [QGIS profile](https://docs.qgis.org/latest/en/docs/user_manual/introduction/qgis_configuration.html#working-with-user-profiles) ### Additional context Windows 10 pro
agiudiceandrea commented 9 months ago

Hi @PhilippeD31, thanks for reporting. Are you sure the issue didn't occur using QGIS 3.28.13 while it does occur using QGIS 3.28.15? I've done some tests and it seems to me the described issue occurs, only for the PATH variable, on Windows using all QGIS 3.34 and QGIS 3.28 versions and also using previous versions like QGIS 3.22. There are also previous issue reports about the same issue: https://github.com/qgis/QGIS/issues/34054 and https://github.com/qgis/QGIS/issues/34550.

To workaround the issue, you need to specify Path (which is the actual name used on Windows) as the variable's name instead of PATH (which is the name incorrectly displayed in Settings -> Options -> System -> Current environment variables...). Obviously you also need to specify the value ;C:\ExifTool12.67 and not C:\ExifTool12.67 in order for the path to be correctly appended to the Path.

PhilippeD31 commented 9 months ago

Hi @agiudiceandrea. Thanks for the workaround. I was using a plugin that calls psql.exe (in the Path). It was working just fine with QGIS 3.28.13 (and previous versions). Then after upgrading, psql was "not found". Eventually I noticed the issue with the PATH variable. And disabling my custom PATH is resolving the problem of my plugin.

M-Rick commented 1 month ago

Same here under macOS.