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.39k stars 2.98k forks source link

QGIS Windows installer creates shortcuts pointing to user who did installation #52357

Open KimmoHop opened 1 year ago

KimmoHop commented 1 year ago

What is the bug or the crash?

QGIS Windows installer creates folder of shortcuts on desktop. Shortcuts have "Start in" path, which points to home directory of the user who did installation.

When some module uses scipy Python module, it tries to access cwd (current working directory, but why ?) - which seems to be "Start in" path of the shortcut. cwd can be tested in QGIS Python console, see below. This can become a problem in multi-user environments, where other users don't have access rights to home directory of the user who did installation. scipy crashes.

Error from scipy:

File "C:\PROGRA~1\QGIS32~1.16\apps\Python39\lib\site-packages\scipy\_distributor_init.py", line 63, in 
os.chdir(owd)
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\XXXX\\Documents'

Checking cwd in Python console:

import os
print(os.getcwd())

Steps to reproduce the issue

  1. user A installs QGIS for all users on Windows
  2. user B, who does not have rights to home directory of user A, runs QGIS from shortcuts created in desktop folder
  3. user B starts operation in QGIS that imports scipy
  4. scipy crashes

Versions

QGISin versio 3.22.16-Białowieża QGIS-koodin versio 6f08e4d7 Qt:n versio 5.15.3 Python-versio 3.9.5 GDAL/OGR:n versio 3.6.2 PROJ-versio 9.1.1 EPSG-rekisteritietokannan versio v10.076 (2022-08-31) GEOS-versio 3.11.1-CAPI-1.17.1 SQLite-versio 3.39.4 PDAL-versio 2.4.3 PostgreSQL:n asiakkaan versio 14.3 SpatiaLite-versio 5.0.1 QWT-versio 6.1.6 QScintilla2-versio 2.13.1 Käyttöjärjestelmän versio Windows Server 2012 R2 Version 6.3 (Build 9600)

Aktiiviset python-lisäosat db_manager 0.1.20 grassprovider 2.12.99 MetaSearch 0.3.5 processing 2.12.99 sagaprovider 2.12.99

Supported QGIS version

New profile

Additional context

No response

agiudiceandrea commented 1 year ago

See also https://trac.osgeo.org/osgeo4w/ticket/759#comment:4 for another side effect of having the user "home" directory as "Start in" path in the shortcut link.

KimmoHop commented 1 year ago

@agiudiceandrea maybe the installer should not set "start in" path at all? I'll check on Monday which installer we use, but it's more QGIS installer (with OSGEO4W) than OSGEO4W installer (with QGIS) :)

In our case, desktop folder shortcuts (created by the installer for every user, or do they come from default etc. ? The server looks like it maps user directories from network drive or something like that) have "clean" paths. QGIS runs fine until scipy tries to access "start in" directory.

Redoute commented 1 year ago

While you're at it: The msi installer, at least the current LTR version 3.28.4, also creates a shortcut "Setup", but the linked bin\osgeo4w-setup-work.exe is not installed. Because the shortcut uses bgspawn.exe, the error dialog is hidden and the shortcut results in a sound only.

agiudiceandrea commented 1 year ago

While you're at it: The msi installer, at least the current LTR version 3.28.4, also creates a shortcut "Setup", but the linked bin\osgeo4w-setup-work.exe is not installed. Because the shortcut uses bgspawn.exe, the error dialog is hidden and the shortcut results in a sound only.

@Redoute, that issue will not allegedly occur with the next all-in-one standalone MSI installers. Please see https://github.com/qgis/QGIS/issues/51771 and https://github.com/jef-n/OSGeo4W/commit/edf7e7dd4a3c39fb6b4118874f4b16cd7d48d6d9.