HomePhabricator

refuse to overwrite an existing file with extract_xcode.py

Description

refuse to overwrite an existing file with extract_xcode.py

Summary:
It is really easy to mess up the command line when trying to process the xcode archive, and as a result delete the input file because the script treats it as the output file.

Example of bad command:

extract_xcode.py input_file.xip | cpio -d -i

This change prevents loss of gigabytes of data by simply refusing to overwrite the output file. The user can manually delete it before running the command, if overwriting is really he really intends to do.

Test Plan:
Check that this command refuses to delete the file.

touch input_file.xip
extract_xcode.py input_file.xip

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D13944

Details

Provenance
PiRKAuthored on May 26 2023, 13:23
PiRKPushed on May 26 2023, 14:29
Reviewer
Restricted Project
Differential Revision
D13944: refuse to overwrite an existing file with extract_xcode.py
Parents
rABC177174f173e3: Remove the mempool internal wellington upgrade latch
Branches
Unknown
Tags
Unknown