[pbs-devel] [PATCH proxmox-backup] tape: mam: actually enforcing the length when writing attributes

Thomas Lamprecht t.lamprecht at proxmox.com
Fri May 24 10:26:08 CEST 2024


Am 24/05/2024 um 10:19 schrieb Dominik Csapak:
> On 5/24/24 09:50, Thomas Lamprecht wrote:
>> Am 23/05/2024 um 12:08 schrieb Dominik Csapak:
>>> +    } else if data.len() > attribute.len as usize {
>>>           bail!("data to long");
>>
>> Can we extend this error with the attribute name, the length we got and
>> the defined max length to have some more info for when a user runs into
>> this?
>>
>> Something like:
>>
>> bail!("attribute '{}' length {} is over the maximum allowed length {}", ...);
>>
>> Or is this error already extended/concatenated with similar info somewhere
>> in the return chain (sorry, just doing a quick review directly in my MUA)
> 
> 
> it's logged with:
> 
> could not set MAM attribute {id}: {err}

OK, thanks for checking.

> and from the id we can infer the maximum length

It still is nice for the end user to get to see that, if some (description
or label) attribute would become more free form in the future, even if
we'd say that's unlikely it's IMO just way to cheap to even thinking about
not doing it..

> 
> but printing the expected/actual len probably make sense
> 

Yeah, please print both, got and expected.





More information about the pbs-devel mailing list