Opened 9 years ago

Closed 9 years ago

#48054 closed defect (fixed)

py-obspy: Incorrect permissions on [..]/site-packages/obspy/taup/data

Reported by: anowacki (Andy Nowacki) Owned by: petrrr
Priority: Normal Milestone:
Component: ports Version: 2.3.3
Keywords: Cc:
Port: py-obspy

Description

ObsPy (as of trunk r137599) has a problem with file permissions. Specifically, the code requires read access to the following files and directories by a normal user, but they are currently set as readable only by root:wheel:

  1. ${prefix}/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy-0.10.2-py2.7.egg-info
    $ ls -l /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy-0.10.2-py2.7.egg-info/
    total 160
    -rw-------  1 root  wheel   2611 19 May 20:28 PKG-INFO
    -rw-------  1 root  wheel  47494 19 May 20:28 SOURCES.txt
    -rw-------  1 root  wheel      1 19 May 20:28 dependency_links.txt
    -rw-------  1 root  wheel   7552 19 May 20:28 entry_points.txt
    -rw-------  1 root  wheel      1 19 May 20:28 namespace_packages.txt
    -rw-------  1 root  wheel      1 15 May 19:36 not-zip-safe
    -rw-------  1 root  wheel    141 19 May 20:28 requires.txt
    -rw-------  1 root  wheel    166 19 May 20:28 top_level.txt
    

This directory sometimes itself lacks execution permission for all users, but I could not reliably reproduce this when uninstalling and installing ObsPy to test.

  1. ${prefix}/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy/taup/data
    $ ls -l /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy/taup/data
    total 616
    -rw-------  1 root  wheel      81 15 May 19:31 README.txt
    -rw-------  1 root  wheel  144910 15 May 19:31 ak135.npz
    -rw-------  1 root  wheel    6413 15 May 19:31 ak135.tvel
    -rw-------  1 root  wheel  145978 15 May 19:31 iasp91.npz
    -rw-------  1 root  wheel    5761 15 May 19:31 iasp91.tvel
    

The code below shows both the errors and my interim fix.

$ cat /tmp/test.py
from obspy.taup import TauPyModel
m = TauPyModel()
$ 
$ python2.7 /tmp/test.py && echo success
Traceback (most recent call last):
  File "/tmp/test.py", line 1, in <module>
    from obspy.taup import TauPyModel
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy/__init__.py", line 36, in <module>
    from obspy.core.utcdatetime import UTCDateTime  # NOQA
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy/core/__init__.py", line 107, in <module>
    from obspy.core.util.attribdict import AttribDict
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy/core/util/__init__.py", line 40, in <module>
    from obspy.core.util.obspy_types import (ComplexWithUncertainties, Enum,
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy/core/util/obspy_types.py", line 16, in <module>
    with standard_library.hooks():
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/future/standard_library/__init__.py", line 323, in __enter__
    install_hooks()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/future/standard_library/__init__.py", line 528, in install_hooks
    install_aliases()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/future/standard_library/__init__.py", line 482, in install_aliases
    import test
  File "/private/tmp/test.py", line 2, in <module>
    m = TauPyModel()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy/taup/tau.py", line 317, in __init__
    self.model = TauModel.from_file(model)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy/taup/tau_model.py", line 600, in from_file
    return TauModel.deserialize(filename)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy/taup/tau_model.py", line 520, in deserialize
    npz = np.load(filename)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/lib/npyio.py", line 369, in load
    fid = open(file, "rb")
IOError: [Errno 13] Permission denied: u'/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy/taup/data/iasp91.npz'
$ 
$ sudo chmod a+r /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy-0.10.2-py2.7.egg-info/*
$ python2.7 /tmp/test.py && echo success
Traceback (most recent call last):
  File "/tmp/test.py", line 1, in <module>
    from obspy.taup import TauPyModel
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy/__init__.py", line 36, in <module>
    from obspy.core.utcdatetime import UTCDateTime  # NOQA
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy/core/__init__.py", line 107, in <module>
    from obspy.core.util.attribdict import AttribDict
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy/core/util/__init__.py", line 40, in <module>
    from obspy.core.util.obspy_types import (ComplexWithUncertainties, Enum,
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy/core/util/obspy_types.py", line 16, in <module>
    with standard_library.hooks():
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/future/standard_library/__init__.py", line 323, in __enter__
    install_hooks()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/future/standard_library/__init__.py", line 528, in install_hooks
    install_aliases()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/future/standard_library/__init__.py", line 482, in install_aliases
    import test
  File "/private/tmp/test.py", line 2, in <module>
    m = TauPyModel()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy/taup/tau.py", line 317, in __init__
    self.model = TauModel.from_file(model)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy/taup/tau_model.py", line 600, in from_file
    return TauModel.deserialize(filename)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy/taup/tau_model.py", line 520, in deserialize
    npz = np.load(filename)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/lib/npyio.py", line 369, in load
    fid = open(file, "rb")
IOError: [Errno 13] Permission denied: u'/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy/taup/data/iasp91.npz'
$ 
$ sudo chmod a+x /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy/taup/data
$ sudo chmod a+r /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy/taup/data/*
$ python2.7 /tmp/test.py && echo success
success

My apologies for not presenting a patch to fix this, but I doubt that just adding the chmod commands would be a satisfactory fix.

Change History (4)

comment:1 Changed 9 years ago by mf2k (Frank Schima)

Cc: petr@… removed
Owner: changed from macports-tickets@… to petr@…

comment:2 Changed 9 years ago by petrrr

Summary: py-pbspy: Incorrect permissions on [..]/site-packages/obspy/taup/datapy-obspy: Incorrect permissions on [..]/site-packages/obspy/taup/data

comment:3 Changed 9 years ago by petrrr

This should be fixed by r137702. Please selfupdate and upgrade the port.

comment:4 Changed 9 years ago by petrrr

Resolution: fixed
Status: newclosed

And r137704 replaces the ugly construct due to my poor TCL knowledge. Thanks Lawrence!

Note: See TracTickets for help on using tickets.