Skip to content

Releases: zen-fs/core

2.2.3

12 May 19:54
v2.2.3
20e70f8
Compare
Choose a tag to compare
  • Fixed resolveMount incorrectly resolving / when the context root and mount point are the same (#226)
  • Updated to @types/node v22.15.17 (#223)
  • rotateMetadata now correctly aligns the new metadata block's offset to 4 bytes. (#224)
  • Updated Memium (#225)
  • Added credentialsAllowRoot utility function

2.2.2

08 May 18:33
v2.2.2
c3adde2
Compare
Choose a tag to compare

crypto.randomUUID is now polyfilled when it is missing. This will emit a warning.

2.2.1

05 May 17:59
v2.2.1
ad9c7c8
Compare
Choose a tag to compare
  • The SingleBuffer check for a SharedArrayBuffer no longer depends on the global (#220)
  • Added version to the __zenfs__ global
  • Updated dependencies (only for the lock file)
  • Updated the readme
    • Removed "experimental" from readme devices section
    • Fixed spelling: Nodejs -> Node.js

2.2.0

26 Apr 21:39
v2.2.0
7b3793a
Compare
Choose a tag to compare

Added support for Node v23

  • Added a [Symbol.dispose] method to readline.Interface.
  • Add support for glob patterns for exclude in glob.
  • Added internal globToRegex utility.
  • Added path.matchesGlob.
  • Updated @types/node.

Updates to configuration

  • Added support for case folding at the VFS level (#212). This includes the addition of the optional shared caseFold config option and the case_fold FS attribute. If provided, the value can be lower or upper.
  • FileSystem's toString() method now wraps the label in quotes.
  • Added configureFileSystem, which updates a file system's configuration and attributes.
  • Calling configure multiple times will no longer create a new /dev each call.
  • Calling configure with only shared option will correctly update the configuration of already mounted file systems.
  • Changed FileSystemAttributes to an interface so it can be modified.

Updates to the Async mixin

  • _patchAsync now only patches FileSystem methods.
  • Fixed the anti-loop check in _patchAsync not handling async methods.
  • Added another anti-loop check to _pathAsync in the sync error handler.
  • Deprecated the done and queueDone methods (use sync instead).

Other changes

  • Fixed nlink being 0 for inodes created in IndexFS's create method.
  • Updated Kerium.

2.1.1

26 Apr 01:00
v2.1.1
28535ce
Compare
Choose a tag to compare
  • Fixed the path export incorrectly pointing to dist/vfs/path.js, it now correctly points to dist/path.js (#217)
  • Changed the hashbang in tests/fetch/run.sh to #!/usr/bin/env bash for better compatiblity.

2.1.0

22 Apr 05:25
v2.1.0
28d1586
Compare
Choose a tag to compare

This release took much longer that planned due to #210— more details below.

Memory

How ZenFS handles linear memory has been significantly changed. First off, everything linear memory related was split off from Utilium into a new package called Memium. A number of changes were made, like structs becoming "live" views, rather than the buffers and values only changing at (de)serialization. The "live" structs change was made in order to fix #210, since prior to the change, SingleBuffer would not update when changes were made in another realm. Numerous parts of ZenFS have also been rewritten in order to work with the new behavior. This includes Inode being changed to a fixed size of 4096 bytes and changes to the Port backend's serialization and deserialization logic. The inode format is now version 5.

Errors and Logging

Since Memium has some error handling and logging, the error and logging code has been split off into the Kerium package, which allows for multiple packages to work with the log and share similar errors. Additionally, many ZenFS errors now have the same behavior and messages as libuv errors on Linux, better emulating native behavior. You can read more about changes to exceptions and logging in Kerium's release notes. Some other changes to errors include a fix for readlink not throwing EINVAL if the path was not a symlink (#215) and a fix for rename not throwing EISDIR/ENOTDIR correctly.

Flags and FS Attributes

This release changes InodeFlags to follow S_* instead of FS_*_FL, since this better follows on things are done on Linux. The FS_*_FL-style flags have been added to ioctl.ts as the FileFlag enum.

FileSystem attributes have also had some minor changes:

  • Removed no_buffer_resize (unused)
  • Renamed no_async to no_async_preload
  • Added no_atime
  • Added no_suid
  • Added sync (immediate changes)

Also, the no_id_tables attribute has been added to StoreFS. This forces all inode lookups to use the file system instead of the ID tables. This is much slower, but required for cross-realm file systems.

Tests

  • Tests have been cleaned up a lot.
  • A new SingleBuffer test has been added for use with SharedArrayBuffer (#211)
  • The short verbose flag for zenfs-test has been changed from -w to -v
    • Originally, -v wasn't used to allow for a potential short version option or to alleviate confusion. -v ended up being less ambiguous.
  • Slightly improved the read tests
  • Missing awaits have been added to assert.rejects calls
  • The default log level for tests has been changed to ERR

Misc

  • The sync and syncSync methods of FileSystem weren't actually changed in 2.0. This release fixes that.

  • Calls to touch in xattr functions used pick to only change attributes. This had a bad side effect and was removed.

  • IndexFS now checks if directories are empty before removing them. If not, ENOTEMPTY is thrown.

  • CopyOnWrite would change the mode of files stated or copied to the writable file system to be writable by everyone (i.e. |= 0o222). This behavior was removed.

  • The long argument to MetadataEntry's toString method has been removed, since it was only used by MetadataBlock and had special behavior.

  • The timeout created for Port RPC requests is now cleared when the request is settled.

  • A check for whether a directory is being renamed to a file inside itself has been added to the VFS.

  • CreationOptions now extends Partial<InodeLike>, which reflects the actual behavior of StoreFS.

  • A use-after-free style overwrite in SingleBuffer has been fixed.

  • The ordering of paths in mkdirSync has been fixed.

  • Incorrect path string slicing in mkdir and mkdirSync was fixed.

  • Incorrect usage of Atomics.wait was fixed.

2.0.0

14 Mar 15:49
v2.0.0
9594207
Compare
Choose a tag to compare

2.0 is finally here! The main reason for a semver-major release is that a lot of cleanup was needed that involved breaking changes (like removing deprecated APIs). This release does include some big features though!

How many downloads?

Before getting into the details of this release, I wanted to thank the users of ZenFS. ZenFS and Utilium have now received over 1,000,000 downloads (yes, one million). I'm proud of what ZenFS has matured into, and I couldn't have done this without the community. So, thank you all for supporting the project, even if just by downloading it.

Extended attributes / xattr

This release adds full support for extended attributes (a.k.a xattr), which behave the same as on Linux. Node.js doesn't even have an API for this yet! This allows you to store arbitrary metadata on files, though a limit of 1 KiB per attribute value is imposed for performance and sanity. Like Linux, xattr names are namespaced— you will need to use the user namespace. See #189 for the initial issue.

ioctl and inode flags

With the new ioctl and ioctlSync functions, you can do a few cool things:

1. Inode flags

Using the IOC.GetFlags and IOC.SetFlags commands, the flags on an file can be changed. At the moment, these are the flags that affect VFS behavior:

  • NoAtime: When set, the atime of files will not be updated. This replaces the experimental disableUpdateOnRead configuration flag.
  • Sync: When set, files will be synced to the file system immediately following any changes. This is off by default, meaning any changes will only be synced once the file is closed. This replaces the experimental onlySyncOnClose configuration flag.

These flags are currently only available on a per-file basis, though support for FS-wide flags will likely be added to mount in a minor release in the near future.

2. File "versions"

IOC.GetVersion and IOC.SetVersion manipulate the version field of inodes. While this field isn't used internally, it could be useful for some use cases— go crazy!

3. File system commands

Note

Other than IOC.GetLabel/IOC.SetLabel, the FS-level ioctl commands only exist for completeness and should not be used.

  • IOC.GetLabel and IOC.SetLabel can be used to read and write the label of a file system.
  • IOC.GetUUID will retrieve the UUID of a file system. At the moment, each file system instance is assigned a random UUID when instantiated. Only SingleBuffer persists the UUID.
  • IOC.GetSysfsPath just gives you /sys/fs/${fs.name}/${fs.uuid}. sysfs is very complicated and has not be implemented.
  • IOC.GetXattr/IOC.SetXattr are not related to extend attributes. These are for working with a struct fsxattr. This structure has not been fully implemented, you should not use it.

As of this release, there is not mechanism for file systems to register ioctl command handlers. This is planned for a future minor release.

Contexts

This release makes contexts more powerful by introducing context ids, parent/children tracking, context-dependent working directories, and context-dependent file descriptors. The exported boundContexts Map can be used to access all of the bound contexts (a notable use case is /proc). You can create a child of a BoundContext using its bind method.

Also, this release fixed CredentialsInit not being plural, improves the types of BoundContext, and changes chroot to always be in-place and perform more anti-escape checks. mounts is no longer accessible on the fs namespace export, since this could be used to escape a context.

Internally, a "default" context is used for unbound operations. This absorbs the old "default"/unbound credentials.

Internal API changes: metadata, synchronization, and files

This release significantly improves how metadata and synchronization is handled internally.

  • The internal File class has been completely absorbed into the VFS. This comes with some nice performance and maintainability benefits. You can look at SyncHandle for the synchronous logic from File.
  • The id property of FileSystem has been renamed to type, since it is used to identify the class rather than the instance, which was ambiguous.
  • A new touch method has been added to FileSystem. touch only updates metadata. All of the internal metadata updates now go through this new method.
  • FileSystem.sync no longer takes any parameters. It is a no-op for current backends, though it can likely be used as a barrier for asynchronous operations in the future.
  • All of the internal APIs for passing around metadata now use InodeLike or Inode instead of StatsLike.
  • Whenever an inode is updated, its ctime is now changed automatically.
  • The upgrade path for format 1-3 inodes has been completely removed. These are from much older versions of ZenFS, if you are using one of these versions, please upgrade to 1.11 first.
  • The createFile and mkdir methods of FileSystem have had their mode parameter merged into CreationOptions. (PureCreationOptions has been removed).
  • File open flags are now represented using numbers instead of strings internally, which improved performance and simplified some checks and imports.
  • Added an internal hasAccess function, so permissions can be checked without copying an inode and creating a new Stats instance, significantly improving performance.

Configuration and logging

  • Passing a boolean-returning function for the type of an option is now supported.
  • The MountConfiguration used for a backend is now passed to that backend's isAvailable function. (#196)
  • Improved backend options type.
  • Configuration.log is no longer experimental.
  • The built-in log formatting has been overhauled. Read the documentation on log.fancy for more information.
  • The error thrown when sync preloading is disabled is no longer written to the log.
  • Logging in tests has been improved.

Other changes

  • The readLines method of FileHandle has finally been implemented. This actually involved implementing most of the node:readline module, which can be imported from @zenfs/core/readline.js.
  • src/vfs/path.ts has been moved to src/path.ts. You can import from @zenfs/core/path.js.
  • Added support for opening files with the synchronous flag (s).
  • File descriptor numbers now start at 4.
  • Access Control Lists (ACLs) have been implemented, though they are not checked for now. (#194)
  • Device inode data can now be customized by the device driver.
  • Fixed device reads and writes not working correctly with device sizes.
  • Fixed multiple problems with ReadStream. (#193)
  • All of the code for the Port backend has been consolidated into src/backends/port.ts.
  • The prefix in Passthrough is no longer normalized. (#203)
  • Refactored vfs/config.ts for performance.
  • Fixed the metadata offset not being set on fresh super blocks for SingleBuffer. (#205, thanks @tbrockman)
  • Fixed streaming methods not checking if the file was closed.
  • Fixed symlinkSync not closing the file it opened.
  • Fixed an access check missing in statSync.
  • The RPC code used for Port has been refactored.
  • The encode/decode``UTF8/Raw functions and Concrete type have been moved to Utilium.

1.11.4

24 Feb 20:10
v1.11.4
d5f493d
Compare
Choose a tag to compare

Add streamRead and streamWrite to File (#192, thanks @mcandeia)

1.11.3

23 Feb 20:05
v1.11.3
b4776b6
Compare
Choose a tag to compare
  • emitChange now works correctly when watching the file itself (fixes #191)
  • Tweaked watch test to prevent regression
  • Some internal function no longer open files and read directly instead, which should improve performance.

1.11.2

18 Feb 21:17
v1.11.2
d46bf21
Compare
Choose a tag to compare

This release adds an explicit reference to @types/node, which ensures the ambient types will always be loaded before the ambient declaration for readable-stream. This should fix edge cases where Typescript fails to include @types/node even though it is installed.