On Thu, Feb 01, 2024 at 01:30:21PM -0500, Jason Andryuk wrote:
> same_vm is broken when the two main domains do not have targets.  otvm
> and targetvm are both missing, which means they get set to -1 and then
> converted to empty strings:
> 
> ++10697+ local targetvm=-1
> ++10697+ local otvm=-1
> ++10697+ otvm=
> ++10697+ othervm=/vm/cc97bc2f-3a91-43f7-8fbc-4cb92f90b4e4
> ++10697+ targetvm=
> ++10697+ local frontend_uuid=/vm/844dea4e-44f8-4e3e-8145-325132a31ca5
> 
> The final comparison returns true since the two empty strings match:
> 
> ++10697+ '[' /vm/844dea4e-44f8-4e3e-8145-325132a31ca5 = 
> /vm/cc97bc2f-3a91-43f7-8fbc-4cb92f90b4e4 -o '' = 
> /vm/cc97bc2f-3a91-43f7-8fbc-4cb92f90b4e4 -o 
> /vm/844dea4e-44f8-4e3e-8145-325132a31ca5 = '' -o '' = '' ']'
> 
> Replace -1 with distinct strings indicating the lack of a value and
> remove the collescing to empty stings.  The strings themselves will no
> longer match, and that is correct.
> 
> ++12364+ '[' /vm/844dea4e-44f8-4e3e-8145-325132a31ca5 = 
> /vm/cc97bc2f-3a91-43f7-8fbc-4cb92f90b4e4 -o 'No target' = 
> /vm/cc97bc2f-3a91-43f7-8fbc-4cb92f90b4e4 -o 
> /vm/844dea4e-44f8-4e3e-8145-325132a31ca5 = 'No other target' -o 'No target' = 
> 'No other target' ']'
> 
> Signed-off-by: Jason Andryuk <[email protected]>

Reviewed-by: Anthony PERARD <[email protected]>

Thanks,

-- 
Anthony PERARD

Reply via email to