xproc / 3.0-steps

Repository for change requests to the standard step library and for official extension steps
10 stars 7 forks source link

File steps: Performance or state? #353

Closed xml-project closed 4 years ago

xml-project commented 4 years ago

At least for two steps (make directory and delete file) the specs are open to different interpretations: Suppose I want to create a folder but I can‘t because the folder is already there. (Error or not). Same with delete files: I might be unable to delete a file/folder because it does not exist. I propose to have a „state-interpretation“ saying: The author wants this folder to exist after the step finished, so it is not an error the call make-directory with an already existing Uri. In the same line: It is not an error to call p:delete-file with a uri of a non existing file. Do you agree?

gimsieke commented 4 years ago

I agree. It is the most hassle-free solution for users and pipeline authors. May I suggest that we add an attribute to the c:result output document to indicate that the action could not be performed but is nevertheless considered successful? This attribute can be different for each step and for each kind of circumstance.

xml-project commented 4 years ago

+1

xml-project commented 4 years ago

Any suggestion for attribute's name and type?

xml-project commented 4 years ago

Well, writing the prose for this I am not so sure anymore that this is a good idea. For p:file-delete the expectation is, that there is no resource with that URI after the step has performed. So that seems to work. However what is the expectation for p:mk-dir. If it is, that a folder with the given URI exists, it's ok. But what about the expectation that is folder is empty?

ndw commented 4 years ago

I think p:file-delete should work like HTTP DELETE (idempotently) and "rm -f". I think p:mkdir should work like "mkdir -p". It's not an error if the directory exists, even if it isn't empty. (I don't think mkdir needs to say that the created directory is empty.)