Follow temporary file + rename pattern for all files

Open
#280 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
c
Domain
embedded-iot

Research direction

Start by reviewing the existing special-case temporary-file and rename handling described in this issue and the discussion on issue #131. Identify every file-update path affected, then verify that all updates follow the temporary-file pattern without exposing partial or clobbered files.

Written by the indexing model from the issue text.

Description

enhancement

Checklist (Please check before submitting)

  • I reviewed the Contributing Guide.
  • I reviewed the CF README.md file to see if the feature is in the major future work.
  • I performed a cursory search to see if the feature request is relevant, not redundant, nor in conflict with other tickets.

Is your feature request related to a problem? Please describe.
Currently, there is a special case to handle situations where the MD PDU arrives out of order. A temporary file is opened, and then renamed once the MD packet does arrive.

However, because this is only done for off-nominal cases, it is likely not as well tested as other paths (see bug #131).

Describe the solution you'd like
This pattern of using a temp file should be standard operating procedure, not just something for special cases. Reasons/advantages for always doing it this way described in my comment here: https://github.com/nasa/CF/issues/131#issuecomment-1183239857

This improves atomicity of file updates, prevents clobbering files and avoids cases where other apps might see partial files or other bad content.

Describe alternatives you've considered
N/A

Additional context
As the fix for #131 strictly only fixed the issue described, this is a more general enhancement that would improve CF.

Requester Info
Joseph Hickey, Vantage Systems, Inc.

Dominant language
C
Stars
123
Forks
82
Avg merge
2d 22h
Merged PRs (30d)
2

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nasa/CF

All issues in nasa/CF

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.