Skip to content

nix-store --register-validity --reregister modifies mtime of symlinks in store #146

Closed

Description

@rickynils

It seems the logic in canonicaliseTimestampAndPermissions in local-store.cc is a bit off. In the lutimes case the mtime is set before the check for symlink is done, but in the utimes case, the path symlink check is done first and only if the path is not a symlink, the mtime is set.

I discovered this on a system with a read-only store where I re-registered some already valid paths. The operation failed because nix-store tried to set mtime on the symlinks in the store (the symlinks didn't have 1970-01-01 mtime).

Activity

  1. edolstra commented on Feb 26, 2014

    @edolstra
    Member

    The check for symlinks is only because utimes() doesn't work on symlinks. On a system with lutimes(), if the mtime is incorrect, we want to use it unconditionally.

  2. added a commit that references this issue on Feb 26, 2025
    166c04a
  3. added a commit that references this issue on Jul 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions