public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox Backup Server development discussion
	<pbs-devel@lists.proxmox.com>,
	Gabriel Goller <g.goller@proxmox.com>
Subject: Re: [pbs-devel] [PATCH proxmox-backup] fix #3921: client: confusing backup reader error
Date: Fri, 1 Sep 2023 13:51:22 +0200	[thread overview]
Message-ID: <321e5633-e35b-4dd5-8c0a-4e6eba33ca06@proxmox.com> (raw)
In-Reply-To: <20230901080210.26336-1-g.goller@proxmox.com>

Am 01/09/2023 um 10:02 schrieb Gabriel Goller:
> When using the catalog shell command, a common error is that user pass
> "./files.pxar" instead of "files.pxar". This will result in a cryptic error
> "... value does not match regex pattern ...". Added some context to the
> error according to suggestions here [1].

adding error context can be good in general, but the specific case
mentioned could be also solved explicitly by either stripping ./
or handling it explicitly. How does it handle multiple consecutive
slashes in paths? Like "foo///bar"? As that would need similar
normalizing so, if that works, then we maybe got already some place
where we can add handling for ./, and otherwise it might make sense
to start thinking about adding such things.

As when multiple users run into some issue it might be warranted
to check if them "holding it wrong" should be actually a valid way
to hold it.

> 
> [1]: https://bugzilla.proxmox.com/show_bug.cgi?id=3921
> 
> Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
> ---
>  pbs-client/src/backup_reader.rs | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/pbs-client/src/backup_reader.rs b/pbs-client/src/backup_reader.rs
> index 2cd4dc27..138e836a 100644
> --- a/pbs-client/src/backup_reader.rs
> +++ b/pbs-client/src/backup_reader.rs
> @@ -98,7 +98,10 @@ impl BackupReader {
>      pub async fn download<W: Write + Send>(&self, file_name: &str, output: W) -> Result<(), Error> {
>          let path = "download";
>          let param = json!({ "file-name": file_name });
> -        self.h2.download(path, Some(param), output).await
> +        self.h2
> +            .download(path, Some(param), output)
> +            .await
> +            .map_err(|err| format_err!("http2 file download '{}' failed: \n{}", file_name, err))

please use captured identifiers for new format!/format_err! et al.
calls, e.g., here:

.map_err(|err| format_err!("http2 file download '{file_name}' failed - {err}"))

We also normally do not use a newline to separate prefix from actual
error, or would there be a good reason to deviate from the norm here?

>      }
>  
>      /// Execute a special GET request and send output to a writer





  reply	other threads:[~2023-09-01 11:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-01  8:02 Gabriel Goller
2023-09-01 11:51 ` Thomas Lamprecht [this message]
2023-09-01 15:03   ` Gabriel Goller
2023-12-15 12:34 ` Gabriel Goller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=321e5633-e35b-4dd5-8c0a-4e6eba33ca06@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=g.goller@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal