-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(fsx): introduce RealPathMapper, OverlayFS (#21)
This diff modifies how fsx works by introducing two new concepts: 1. the `OverlayFS`, which encapsulates the common logic used by `ChdirFS` and `ContainedFS` into a single codebase; 2. the `RealPathMapper`, which implements the path mapping policies used by `ChdirFS` and `ContainedFS`. As a result, we can re-implement (and deprecate) `ChdirFS` and `ContainedFS` in light of these two new concepts. More in detail: 1. the `ChdirFS` path mapping policy is implemented by the new `ChdirPathMapper` type; 2. the `ContainedFS` by the new `ContainedDirPathMapper` type. This change is important because it allows us to clarify the semantics of the base path used by a `RealPathMapper` in terms of whether such a base directory is relative or absolute. For `ChdirPathMapper` and `ContainedDirPathMapper`, we define two constructors: one of them ensures the base directory is absolute, while the other one does not bother with that. In turn, this is important because of Unix domain sockets, where there are limitations on the maximum socket name (i.e., file path) length. Thus, when using absolute paths in `rbmk sh`, it is easier to hit the limit and not being able to create the sockets. This seems to suggest that we could switch to use relative paths *iff* we guarantee that `rbmk COMMAND` would not `chdir` for any `COMMAND` in `rbmk` except the `sh` command itself. However, baking this assumption in `fsx` would have been quite optimistic and backward, and made `fsx` itself harder to reuse. On the contrary, by making the choice explicit in the constructors, we clearly document (with code that one needs to invoke) what are the expectations in terms of changing paths and, all in all, it seems explicit is generally better than implict.
- Loading branch information
1 parent
dc5ccc6
commit c799866
Showing
7 changed files
with
1,075 additions
and
291 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.