Skip to content

feature request: atomic writes to (binary) files #233

@zhijie-yang

Description

@zhijie-yang

When chisel is called by a bash instance and installs bash_bins into --root /, it will encounter an ETXTBSY error: error: cannot extract from package "bash": open /usr/bin/bash: text file busy. This is because Chisel tries to open the running /usr/bin/bash file, which triggers this error.

We want Chisel to be able to handle such cases, just like how dpkg is handling rewriting the /usr/bin/bash binary file by writing to a temporary file, and move this temporary file to overwrite the previous one, such that we can safely overwrite the running binary files.

References:

  1. https://github.com/guillemj/dpkg/blob/0fa25abf11871c75de58e14743810609518e647e/src/main/unpack.c#L1471
  2. Log from inotifywait on dpkg -i bash:
/proc/942119/root/usr/bin/ MOVED_FROM bash.dpkg-new
/proc/942119/root/usr/bin/ MOVED_TO bash

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions