Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dumpfile: Add some test code to convert to tar #328

Merged
merged 1 commit into from
Sep 10, 2024

Conversation

cgwalters
Copy link
Contributor

Add code to go from dumpfile -> tar (notably, ignoring non-inline regular file content). This is testing only code right now, though clearly mapping to/from tar would be very useful in general. I plan to use this code for various testing purposes especially to manually create tarballs from various dumpfiles to e.g. feed directly to mkfs.erofs for example.

But we at least get some sanity checking this way.

@cgwalters cgwalters force-pushed the rs-cfs-tar branch 4 times, most recently from a62554d to a6117e1 Compare September 6, 2024 13:11
Copy link
Collaborator

@jeckersb jeckersb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me, pretty straightforward, just a few nits from latest clippy (1.81), most important being the MSRV one:

warning: this import is redundant
  --> rust/composefs/examples/cfs-dumpfile2tar.rs:14:1
   |
14 | use composefs;
   | ^^^^^^^^^^^^^^ help: remove it entirely
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_component_path_imports
   = note: `#[warn(clippy::single_component_path_imports)]` on by default

warning: this expression creates a reference which is immediately dereferenced by the compiler
  --> rust/composefs/examples/cfs-dumpfile2tar.rs:66:36
   |
66 |                 pax_data.write_all(&value)?;
   |                                    ^^^^^^ help: change this to: `value`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
   = note: `#[warn(clippy::needless_borrow)]` on by default

warning: useless conversion to the same type: `u64`
  --> rust/composefs/examples/cfs-dumpfile2tar.rs:95:29
   |
95 |             let rdev: u64 = (*rdev).into();
   |                             ^^^^^^^^^^^^^^ help: consider removing `.into()`: `(*rdev)`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
   = note: `#[warn(clippy::useless_conversion)]` on by default

warning: current MSRV (Minimum Supported Rust Version) is `1.70.0` but this item is stable since `1.77.0`
   --> rust/composefs/examples/cfs-dumpfile2tar.rs:150:15
    |
150 |     let dst = File::create_new(dst)
    |               ^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#incompatible_msrv
    = note: `#[warn(clippy::incompatible_msrv)]` on by default

warning: `composefs` (example "cfs-dumpfile2tar") generated 4 warnings (run `cargo clippy --fix --example "cfs-dumpfile2tar"` to apply 3 suggestions)

Add code to go from dumpfile -> tar (notably, ignoring non-inline
regular file content). This is *testing* only code right now,
though clearly mapping to/from tar would be very useful in
general. I plan to use this code for various testing purposes
especially to *manually* create tarballs from various dumpfiles
to e.g. feed directly to `mkfs.erofs` for example.

But we at least get some sanity checking this way.

Signed-off-by: Colin Walters <walters@verbum.org>
@cgwalters
Copy link
Contributor Author

Good catch, I had to upgrade from 1.80 -> 1.81 to get that new clippy check.
Also the way it rewrote with "a".repeat() is way nicer.

@jeckersb jeckersb merged commit a482c6e into containers:main Sep 10, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants