[pve-devel] [PATCH v3 storage 2/3] Incorporate wipe_disks from PVE::Ceph::Tools

Dominik Csapak d.csapak at proxmox.com
Thu Apr 16 09:41:20 CEST 2020



On 4/16/20 9:35 AM, Thomas Lamprecht wrote:
> On 4/16/20 8:57 AM, Dominik Csapak wrote:
>>
>>>
>>>
>>> Thanks for clearing that up, I mostly poked at it as Dominic came to me
>>> asking what to do as you told him to use [0-9] and Fabian told him to go
>>> back again, not knowing about your suggestion.
>>>
>>> The question is, does the matching of other digit really matters at all?
>>>
>>> I mean it naturally depends on what happens whit the parsed data, but most
>>> of the time it should not really matter at all, or?
>>>
>>
>> no, most of the time it should not matter at all, but we do parse api
>> parameters with decode('utf8', $v) so there is probably some
>> path where this could happen...
>>
>> mostly i wanted to avoid introducing errors by copy/pasting regexes.
>> i really have no idea if this could hit us at all, but
>> we use regexes very often and are not very consistent
>> with \d and [0-9]
>>
>> this is something we should decide on and put it in the style guide
>>
>> bottom line: i guess both are ok when used right, but with
>> [0-9] there is no ambiguity as to what it matches
> 
> If the style guide clears the fact what \d can imply and when it matters
> I'd honestly personally prefer \d for all but those case where it really
> matters, i.e., where it can have security implications or produce a invalid
> config or setup. But I see where you coming from, and IMO it's also fine
> to go for [0-9] even if one cannot imagine any negative effect whatsoever.
> 
> For now I added a paragraph in the style guide:
> 
> https://pve.proxmox.com/wiki/Perl_Style_Guide#Matching_Digits_Fallacy
> 
> I hope it's worded OK, feel free to adapt and improve it.
> 

yeah that paragraph's fine :) thanks




More information about the pve-devel mailing list