python-irodsclient icon indicating copy to clipboard operation
python-irodsclient copied to clipboard

Force flag not required for data_object.put( )

Open d-w-moore opened this issue 4 years ago • 3 comments

Running the following script

#!/usr/bin/python
# put.py
from __future__ import print_function
import  sys
from irods.test.helpers import make_session
import irods.keywords as kw 

if len(sys.argv[1:3])==2:
    s = make_session()
    c = s.data_objects.put (  
                               sys.argv[1],
                               sys.argv[2],)

in this manner:

$ touch file
$ for x in 1 2 ; do echo try $x >> file ; python put.py file `ipwd`/file ; done

should succeed on try 1 and fail on try 2 , because iRODS client/server convention requires a FORCE_FLAG_KW for overwrites. However, both tries succeed; and, moreover, looking at the contents of the 'file' data object :

$ iget file -
try 1
try 2

shows the data object was written a second time without the force flag.

d-w-moore avatar Jun 15 '21 12:06 d-w-moore

Presumably this is due to the open/write/close nature of the Python put() operation...

So, there are no warnings/errors... has this always been the case?

trel avatar Jun 15 '21 12:06 trel

Not even a warning, no ... and it's true back a couple of releases, ie 0.8.6

d-w-moore avatar Jun 15 '21 12:06 d-w-moore

alternate / later / duplicate discussion found at https://github.com/irods/python-irodsclient/issues/322

trel avatar Sep 21 '22 18:09 trel