Re: [PATCH 4/5] libmultipath tests: fix strerror() difference between musl and glibc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2020-11-02 at 13:58 -0600, Benjamin Marzinski wrote:
> On Tue, Oct 27, 2020 at 11:45:35PM +0100, mwilck@xxxxxxxx wrote:
> > 
> >  	check_expected(prio);
> >  	va_start(ap, fmt);
> >  	vsnprintf(buff, MAX_MSG_SIZE, fmt, ap);
> >  	va_end(ap);
> > -	assert_string_equal(buff, mock_ptr_type(char *));
> > +	expected = mock_ptr_type(char *);
> > +	assert_memory_equal(buff, expected, strlen(expected));
> 
> This looks fine. I'm just wondering the purpose. Is it just to deal
> with
> bad,non-null terminated strings? 

No. In the case at hand, the error strings returned by the C library,
which are at the tail of the log message in this case, were different.
We're looking at an errno==0 case, where glibc returns "Success",
whereas musl returned something else (like "undefined error" or so, I
forgot the exact wording).

The downside of this patch is that if a mismatch occurs,
assert_string_equal() prints the two different strings, whereas
assert_memory_equal() prints differing offsets and values in hex, which
makes it more difficult to assess the cause of the mismatch.

Regards,
Martin


--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux