public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup] tools/sgutils2: improve error messages
Date: Mon, 26 Apr 2021 15:01:27 +0200	[thread overview]
Message-ID: <20210426130127.12330-1-d.csapak@proxmox.com> (raw)

include the expected and unexpected sizes in the error message,
so that it's easier to debug in case of an error

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/tools/sgutils2.rs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/tools/sgutils2.rs b/src/tools/sgutils2.rs
index 5273173f..06506896 100644
--- a/src/tools/sgutils2.rs
+++ b/src/tools/sgutils2.rs
@@ -759,18 +759,18 @@ pub fn scsi_mode_sense<F: AsRawFd, P: Endian>(
         let head: ModeParameterHeader = unsafe { reader.read_be_value()? };
 
         if (head.mode_data_len as usize + 2) != data.len() {
-            bail!("wrong mode_data_len");
+            bail!("wrong mode_data_len: {}, expected {}", head.mode_data_len, data.len() - 2);
         }
 
         if disable_block_descriptor && head.block_descriptior_len != 0 {
-            bail!("wrong block_descriptior_len");
+            bail!("wrong block_descriptior_len: {}, expected 0", head.block_descriptior_len);
         }
 
         let mut block_descriptor: Option<ModeBlockDescriptor> = None;
 
         if !disable_block_descriptor {
             if head.block_descriptior_len != 8 {
-                bail!("wrong block_descriptior_len");
+                bail!("wrong block_descriptior_len: {}, expected 8", head.block_descriptior_len);
             }
 
             block_descriptor = Some(unsafe { reader.read_be_value()? });
-- 
2.20.1





                 reply	other threads:[~2021-04-26 13:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210426130127.12330-1-d.csapak@proxmox.com \
    --to=d.csapak@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