glue-viz / glue-standalone-apps

Experimental building of standalone glue apps for various platforms
1 stars 2 forks source link

Issue with WWT in sandbox mode #11

Open astrofrog opened 1 year ago

astrofrog commented 1 year ago

If I enable sandbox mode in the entitlements file so that the .pkg installer is correctly validated, WWT no longer works:

Traceback (most recent call last):
  File "glue/app/qt/application.py", line 988, in _choose_new_data_viewer_nodata
  File "glue/app/qt/application.py", line 1009, in choose_new_data_viewer
  File "glue/core/application_base.py", line 261, in do
  File "glue/core/command.py", line 134, in do
  File "glue/core/command.py", line 235, in do
  File "glue/utils/matplotlib.py", line 191, in wrapper
  File "glue/app/qt/application.py", line 1013, in new_data_viewer
  File "glue/core/application_base.py", line 81, in new_data_viewer
  File "glue/viewers/common/qt/data_viewer.py", line 27, in __call__
  File "glue_wwt/viewer/qt_data_viewer.py", line 30, in __init__
  File "glue_wwt/viewer/data_viewer.py", line 21, in __init__
  File "glue_wwt/viewer/qt_data_viewer.py", line 43, in _initialize_wwt
  File "pywwt/qt.py", line 214, in __init__
  File "pywwt/data_server.py", line 102, in get_data_server
  File "mimetypes.py", line 339, in add_type
  File "mimetypes.py", line 362, in init
  File "mimetypes.py", line 203, in read
PermissionError: [Errno 1] Operation not permitted: '/etc/apache2/mime.types'

I need to investigate whether there is a way around this, or whether we would need to remove glue-WWT in order to produce a functional .pkg installer.

For now I have removed sandbox mode and disabled the .pkg validation: https://github.com/glue-viz/glue-standalone-apps/commit/70c601b4a93d743c006618e7f0bef46d05556180

dhomeier commented 1 year ago

If the file is not world-readable on the sandbox system or this is somehow running in a mode that cannot read the configuration files, pywwt might work around it by stripping the list of known config files before adding the type, e.g.

    mimetypes.knownfiles = ['/etc/mime.types']
    mimetypes.add_type('image/fits', '.fits')
    mimetypes.add_type('image/fits', '.fts')
    mimetypes.add_type('image/fits', '.fit')

but if permissions are that restricted, I am sceptical the next steps of starting the server would actually succeed.