vcs icon indicating copy to clipboard operation
vcs copied to clipboard

VTK problems attempting to write to directories with rw- (no execute)

Open durack1 opened this issue 7 years ago • 0 comments

I've encountered a nasty error that occurs when target directories do not have execute permissions for the user.

The code below will replicate the issue:

import os,vcs,shutil,stat
import numpy as np
np.warnings.filterwarnings('ignore') ; # Turn off warnings

# Change to tmp dir
os.chdir('/export/duro/tmp')

data = np.random.rand(10,10)
x = vcs.init(bg=True,geometry=(100,100))
x.plot(data)
if os.path.exists('test'):
    shutil.rmtree('test') ; # Remove existing directory
os.mkdir('test') ; # Default perms 700
mode = stat.S_IMODE(os.stat('test').st_mode)
print mode
x.png('test/test1.png')
print 'png written'
os.chmod('test',600) # Mode from rwx to rw-
mode = stat.S_IMODE(os.stat('test').st_mode)
print mode
x.png('test/test2.png')

The error is:

ERROR: In /export/dout/miniconda2/conda-bld/vtk-cdat_1503063744037/work/IO/Image/vtkPNGWriter.cxx, line 276
vtkPNGWriter (0x2f5dcc0): Unable to open file test/test2.png                                                     

ERROR: In /export/dout/miniconda2/conda-bld/vtk-cdat_1503063744037/work/IO/Image/vtkImageWriter.cxx, line 527
vtkPNGWriter (0x2f5dcc0): Ran out of disk space; deleting file(s) already written

And leads to the directory getting garbled with very weird permissions (that require root perms to change/delete) after the error is thrown. The permissions go from

drwx------  2 duro clim 4.0K Nov 30 16:21 test

to

d--x-wx--T  2 duro clim 4.0K Nov 30 16:21 test

@doutriaux1 @danlipsa @aashish24

durack1 avatar Dec 01 '17 00:12 durack1