Skip to content

Tags: Context Free Subsets of the FS Tree

jmazanec15 edited this page Nov 30, 2018 · 2 revisions

Tags are a basekernel tool that is designed to replace the prefix of a traditional UNIX path. They function with a syntax similar to macros:

UNIX:

“$HOME/Documents” => /user/dsmith47/Documents

Basekernel:

“HOME:Documents” => /user/dsmith47/Documents

While most users will feel like they are working with macros when writing paths for tags, tags are implemented in a manner that make them diverge significantly from UNIX macros.

Tags do not map to a path string, they are associated with a file descriptor that the process holds. In other words, a tag is only valid if a file descriptor labeled with that tag is already associated with this process. This allows parent processes to instantiate child processes with a set of tagged directories that the children can operate in while giving the children no access or information about higher levels of the directory tree. Processes can now only operate in regions of the file system that they can “see,” allowing processes to be sandboxed much more tightly than in UNIX. A child with properly configured tags can learn nothing about any part of the file system that does not descend from its tagged directory.

Tagged Path Specifications

Paths utilizing tags are composed of two parts: a tag string and a path string, delimited by a colon(:) character.

Tag string specification:

A tag can be composed of ASCII characters representing numerals or upper and lower case alphabet characters. [0-9a-zA-Z]

Non-tag specification

Since tags are user-defined, a system exists for accessing file descriptors by something other than a string. Tags can be accessed by the value of their file descriptor by specifying #[fd]:<relative/path/to/file>. This syntax only accepts strings matching the regex \#[0-9] for its tag.

File path specification

File names may consist of:

  • Alphanumeric characters of any case: [0-9a-zA-Z]
  • Separator characters: the hyphen, underscore, or period: [-_\.]

The following file names are not allowed:

  • .
  • ..