Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
Trac
Trac
  • Project overview
    • Project overview
    • Details
    • Activity
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Operations
    • Operations
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Create a new issue
  • Issue Boards

GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

  • Legacy
  • TracTrac
  • Issues
  • #1376

Closed (moved)
Open
Opened Apr 28, 2010 by Nick Mathewson@nickm🐙

router_rebuild_store() uses a needless tmp file

In router_rebuild_store(), we use write_chunks_to_file() to build cached_descriptors.tmp, and if that is successful, we rename cached_descriptors.tmp to cached_descriptors.

But write_chunks_to_file() already uses a tmpfile to make sure that it doesn't trash the file it's writing to, so we wind up with the following situation:

router_rebuild_store() calls write_chunks_to_file(), which does: open("cached_descriptors.tmp.tmp") write rename("cached_descriptors.tmp.tmp","cached_descriptors.tmp") munmap("cached_descriptors") rename("cached_descriptors.tmp", "cached_descriptors") mmap("cached_descriptors")

One imaginable fix would be to have router_rebuild_store() tell write_chunks_to_file to write into cached_descriptors directly, so that it would write into c-d.tmp then rename it to c-d. That won't work so easily, though: on Windows, you're not allowed to replace a mapped file while it's still mapped.

A better fix would be to add a flag to write_chunks_to_file() so that it takes a flag that decides whether to use a tmpfile or not.

Found by grarpamp on or-talk: http://archives.seul.org/or/talk/Mar-2010/msg00173.html

This bug isn't actually hurting anything by doing an extra rename(), so it isn't urgent to fix.

To upload designs, you'll need to enable LFS and have admin enable hashed storage. More information
Assignee
Assign to
Tor: 0.2.5.x-final
Milestone
Tor: 0.2.5.x-final
Assign milestone
Time tracking
None
Due date
None
Reference: legacy/trac#1376