From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Dominik Csapak <d.csapak@proxmox.com>, pbs-devel@lists.proxmox.com
Subject: applied: [PATCH proxmox-backup] fix #7303: tape: handle NUL bytes in SCSI strings better
Date: Fri, 13 Feb 2026 10:22:37 +0100 [thread overview]
Message-ID: <1770971489.nfmct3x39f.astroid@yuna.none> (raw)
In-Reply-To: <67209c23-4945-46f9-bd18-847652b2452d@proxmox.com>
On February 12, 2026 4:29 pm, Dominik Csapak wrote:
>
>
> On 2/12/26 4:13 PM, Fabian Grünbichler wrote:
>> On February 11, 2026 3:59 pm, Dominik Csapak wrote:
>>> When dealing with ASCII fields in answers from drives and changers, we
>>> assumed that the data is simply ascii characters padded by spaces, with
>>> potentially a NUL byte at the end. This is indicated for example by the
>>> IBM library documentation about the Primary Volume Tag Information[0]:
>>>
>>> ```
>>> This is a 36 byte ASCII field that contains the cartridge bar code
>>> label, left-adjusted and padded on the right with blanks.
>>> ```
>>
>> doesn't this clash with the trimming below (before and after this
>> patch), which will remove whitespace from both start and end?
>
> well, yes, but if the label is "invalid", there is probably something
> else wrong going on, so it shouldn't make much difference.
>
> i can of course change it to 'trim_end'
>
>>
>>> Some changers may reverse that though, and have a NUL terminated string
>>> followed by space padding (e.g. "FOO\0 ").
>>
>> what about "FOO\0BAR" ? this would now be truncated to "FOO" as well,
>> whereas before it was treated as "FOOBAR"?
>
> no, before it would be treated as 'FOO\0BAR' (since trim only removes it
> from beginning and end, not in the middle).
right, printing the str will omit the \0, but it is actually preserved
by from_utf8_lossy :)
> I sadly have no evidence this ever occurs, but seeing the issue in the
> bug, my assumption is that the hardware simply overwrites the buffer
> with it's internal string representation which might be NUL terminated.
>
> in that case i can imagine a codepath not prefilling the buffer with
> spaces, leading to e.g. first writing:
>
> 'FOOBAR\0'
>
> and afterwards
>
> 'FOO\0'
>
> which would lead to 'FOO\0AR\0'. in this case we should only use 'FOO'..
ack, I guess it makes sense (as much as things can make sense here ;))
Applied, thanks!
[1/1] fix #7303: tape: handle NUL bytes in SCSI strings better
commit: baa2077c4b867d686423c6b22be5cb2ee12cad7d
Best regards,
--
Fabian Grünbichler <f.gruenbichler@proxmox.com>
prev parent reply other threads:[~2026-02-13 9:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-11 14:59 Dominik Csapak
2026-02-12 15:13 ` Fabian Grünbichler
2026-02-12 15:29 ` Dominik Csapak
2026-02-13 9:22 ` Fabian Grünbichler [this message]
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=1770971489.nfmct3x39f.astroid@yuna.none \
--to=f.gruenbichler@proxmox.com \
--cc=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