bluesky / ophyd

hardware abstraction in Python with an emphasis on EPICS
https://blueskyproject.io/ophyd
BSD 3-Clause "New" or "Revised" License
51 stars 79 forks source link

Allow write path template on FileStoreBase to include . #1147

Closed callumforrester closed 10 months ago

callumforrester commented 1 year ago

Fixes #1146

FileStoreBase "validates" its write path template (unless a read path template is also supplied). In this context that means it checks if the store's root is an ancestor of the template, but does not allow . as the write path.

The use case for this is making a file store write to its own root.

Changes in this PR to address this:

Note: If we decide that . should be explicitly disallowed, then the first point is easily reversible and the others are hopefully still useful.

callumforrester commented 1 year ago

Paging @tacaswell and @DiamondJoseph

tacaswell commented 10 months ago

The refactoring seems good and I think I'm sold on this. The requirement to include the root twice was never great (if I recall correctly, there was a path dependency is that we had read_path and write_path for a while and then we added the notion of root so added it in a way that would not break stuff on the floor).


A different API that we talked about at the time was a root level integer to say how many levels to consider as part of the root but we (incorrectly) judged that was more likely to end up with incorrect values than including the part of the path that was the root directly.

tacaswell commented 10 months ago

We do not seem to check that self.reg_root is actually absolute which leaves the thing we are actually trying to prevent (which is relative paths leaking out into the documents).