[pbs-devel] [PATCH v8 proxmox-backup 35/69] pxar: cover listing for split archives

Fabian Grünbichler f.gruenbichler at proxmox.com
Mon Jun 3 15:27:03 CEST 2024


On May 28, 2024 11:42 am, Christian Ebner wrote:
> Allows to list entries of split pxar archives. As the decoder skips
> over the file payloads, the corresponding payload file has to be
> provided. Otherwise the decoder would skip inside the metadata
> archive, leading to incorrect decoding.
> 
> Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
> ---
> changes since version 7:
> - no changes
> 
> changes since version 6:
> - not present in previous version
> 
>  pxar-bin/src/main.rs | 18 ++++++++++++++++--
>  1 file changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/pxar-bin/src/main.rs b/pxar-bin/src/main.rs
> index 903467c98..b64ae1d19 100644
> --- a/pxar-bin/src/main.rs
> +++ b/pxar-bin/src/main.rs
> @@ -454,12 +454,26 @@ async fn mount_archive(archive: String, mountpoint: String, verbose: bool) -> Re
>              archive: {
>                  description: "Archive name.",
>              },
> +            "payload-input": {
> +                description: "'ppxar' payload input data file for split archive.",
> +                optional: true,
> +            },

nit: this one is also missing completion

and I guess mount is missing split support entirely?

technically, we could also add it for the create part (without caching
logic of course)..

>          },
>      },
>  )]
>  /// List the contents of an archive.
> -fn dump_archive(archive: String) -> Result<(), Error> {
> -    for entry in pxar::decoder::Decoder::open(archive)? {
> +fn dump_archive(archive: String, payload_input: Option<String>) -> Result<(), Error> {
> +    if archive.ends_with(".mpxar") && payload_input.is_none() {
> +        bail!("Payload input required for split pxar archives");
> +    }
> +
> +    let input = if let Some(payload_input) = payload_input {
> +        pxar::PxarVariant::Split(archive, payload_input)
> +    } else {
> +        pxar::PxarVariant::Unified(archive)
> +    };
> +
> +    for entry in pxar::decoder::Decoder::open(input)? {
>          let entry = entry?;
>  
>          if log::log_enabled!(log::Level::Debug) {
> -- 
> 2.39.2
> 
> 
> 
> _______________________________________________
> pbs-devel mailing list
> pbs-devel at lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
> 
> 
> 




More information about the pbs-devel mailing list