<feed xmlns='http://www.w3.org/2005/Atom'>
<title>libubox/tests, branch master</title>
<subtitle>C utility functions for OpenWrt</subtitle>
<id>https://git.openwrt.org/project/libubox/atom?h=master</id>
<link rel='self' href='https://git.openwrt.org/project/libubox/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/libubox/'/>
<updated>2026-05-03T20:17:39Z</updated>
<entry>
<title>blobmsg_json: fix double format string to avoid truncation and data loss</title>
<updated>2026-05-03T20:17:39Z</updated>
<author>
<name>Hauke Mehrtens</name>
</author>
<published>2026-04-16T20:16:42Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/libubox/commit/?id=23c6618a5b9088644bb6b509c83f4f88ee8998d3'/>
<id>urn:sha1:23c6618a5b9088644bb6b509c83f4f88ee8998d3</id>
<content type='text'>
Using %lf (= %f) with the default precision of 6 fractional decimal
digits requires up to 317 characters for negative values close to
-DBL_MAX (1 sign + 309 integer digits + 1 decimal point + 6 fraction
digits + NUL), but buf[] only holds 317 bytes, leaving no room for the
NUL terminator — snprintf truncates the last digit silently.

Additionally, 6 fractional digits do not give round-trip accuracy for
IEEE 754 doubles; 17 significant digits (%.17g) are required.

Switch to %.17g which uses scientific notation for very large or small
values, keeping the output well within the buffer, and guarantees
round-trip accuracy for all finite doubles.

Update the cram fixtures test_blobmsg.t and test_blobmsg_types.t to
match the new output. The previous fixtures encoded the buggy
behaviour: DBL_MIN serialised as "0.000000" and was silently flattened
to zero on the JSON round-trip, while DBL_MAX produced a 309-digit
decimal string.

Link: https://github.com/openwrt/libubox/pull/42
Co-Authored-By: Claude Sonnet 4.6 &lt;noreply@anthropic.com&gt;
Signed-off-by: Hauke Mehrtens &lt;hauke@hauke-m.de&gt;
</content>
</entry>
<entry>
<title>libubox: add anonymous strings, ints, et al in arrays</title>
<updated>2026-02-12T15:57:28Z</updated>
<author>
<name>Philip Prindeville</name>
</author>
<published>2023-09-15T18:35:31Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/libubox/commit/?id=8c7b489daa029b3841584f6ac76e2a0b68d74ef3'/>
<id>urn:sha1:8c7b489daa029b3841584f6ac76e2a0b68d74ef3</id>
<content type='text'>
You can have a "name" in an array member without an associated value.

Signed-off-by: Philip Prindeville &lt;philipp@redfish-solutions.com&gt;
Link: https://github.com/openwrt/libubox/pull/12
Signed-off-by: Robert Marko &lt;robimarko@gmail.com&gt;
</content>
</entry>
<entry>
<title>libubox: Add ability to find ordinal position inside a table</title>
<updated>2025-12-08T13:59:11Z</updated>
<author>
<name>Philip Prindeville</name>
</author>
<published>2025-11-14T19:04:01Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/libubox/commit/?id=7928f1711703767b0ac5ce916c7231d0e1af1ca2'/>
<id>urn:sha1:7928f1711703767b0ac5ce916c7231d0e1af1ca2</id>
<content type='text'>
When adding anonymous objects to an array, the only way to select
those objects (as in "json_select", i.e. moving the cursor) is to
select them via their ordinality.

This function returns a selectable index to those objects.

Signed-off-by: Philip Prindeville &lt;philipp@redfish-solutions.com&gt;
Link: https://github.com/openwrt/libubox/pull/33
Signed-off-by: Álvaro Fernández Rojas &lt;noltari@gmail.com&gt;
</content>
</entry>
<entry>
<title>tests: shunit2: add test for _jshn_append via JSON script</title>
<updated>2025-11-17T18:31:02Z</updated>
<author>
<name>Petr Štetiar</name>
</author>
<published>2025-11-13T11:56:15Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/libubox/commit/?id=a3ff29ef93df3ec6e40447f6f4e029ebd07a29f1'/>
<id>urn:sha1:a3ff29ef93df3ec6e40447f6f4e029ebd07a29f1</id>
<content type='text'>
Add another test which verifies _jshn_append leading space fix in commit
82cb5fd66af9 ("libubox: Drop extraneous space when appending values to
variable") by appending keys to JSON objects, making sure there is no
leading space on the first key when adding second key.

  test_jshn_append_via_json_script
  ASSERT:expected:&lt;first&gt; but was:&lt; first&gt;
  ASSERT:expected:&lt;first second&gt; but was:&lt; first second&gt;

Tests: #16
Signed-off-by: Petr Štetiar &lt;ynezz@true.cz&gt;
Link: https://github.com/openwrt/libubox/pull/30
Signed-off-by: Álvaro Fernández Rojas &lt;noltari@gmail.com&gt;
</content>
</entry>
<entry>
<title>tests: shunit2: add dump and setters coverage</title>
<updated>2025-11-17T18:07:04Z</updated>
<author>
<name>Philip Prindeville</name>
</author>
<published>2025-11-17T17:10:40Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/libubox/commit/?id=440b4e988f39ecb7371fe36fd85f96a0eef23465'/>
<id>urn:sha1:440b4e988f39ecb7371fe36fd85f96a0eef23465</id>
<content type='text'>
Exercise json_dump and json_add_* functions.

Signed-off-by: Philip Prindeville &lt;philipp@redfish-solutions.com&gt;
Link: https://github.com/openwrt/libubox/pull/35
Signed-off-by: Álvaro Fernández Rojas &lt;noltari@gmail.com&gt;
</content>
</entry>
<entry>
<title>tests: shunit2: add test for _jshn_append leading space fix</title>
<updated>2025-11-13T10:47:22Z</updated>
<author>
<name>Petr Štetiar</name>
</author>
<published>2025-11-13T10:38:41Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/libubox/commit/?id=240d2d5ef58b7d5637604c0f687d1efbff549f2e'/>
<id>urn:sha1:240d2d5ef58b7d5637604c0f687d1efbff549f2e</id>
<content type='text'>
Verifies the fix in commit 2065c3909935 ("libubox: Drop extraneous space
when appending values to variable") that prevents leading spaces when
appending to empty variables.

 test_jshn_append_no_leading_space
 ASSERT:expected:&lt;foo&gt; but was:&lt; foo&gt;
 ASSERT:expected:&lt;first second&gt; but was:&lt; first second&gt;

References: #16
Signed-off-by: Petr Štetiar &lt;ynezz@true.cz&gt;
</content>
</entry>
<entry>
<title>tests: add blob-buffer overflow test</title>
<updated>2021-04-29T13:34:21Z</updated>
<author>
<name>Zefir Kurtisi</name>
</author>
<published>2021-04-23T17:48:00Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/libubox/commit/?id=a0dbcf8b8f966ce8a358afe555bb75401ef1e9be'/>
<id>urn:sha1:a0dbcf8b8f966ce8a358afe555bb75401ef1e9be</id>
<content type='text'>
The blob buffer has no limitation in place
to prevent buflen to exceed maximum size.

This commit adds a test to demonstrate how
a blob increases past the maximum allowd
size of 16MB. It continuously adds chunks
of 64KB and with the 255th one blob_add()
returns a valid attribute pointer but the
blob's buflen does not increase.

The test is used to demonstrate the
failure, which is fixed with a follow-up
commit.

Signed-off-by: Zefir Kurtisi &lt;zefir.kurtisi@gmail.com&gt;
[adjusted test case for cram usage]
Signed-off-by: Petr Štetiar &lt;ynezz@true.cz&gt;
</content>
</entry>
<entry>
<title>libubox: tests: add more blobmsg/json test cases</title>
<updated>2021-03-09T20:53:14Z</updated>
<author>
<name>Peter Seiderer</name>
</author>
<published>2021-03-06T10:54:50Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/libubox/commit/?id=551d75b5662cccd0466b990d58136bdf799a804d'/>
<id>urn:sha1:551d75b5662cccd0466b990d58136bdf799a804d</id>
<content type='text'>
* add mixed int/double tests
 * add blobmsg_cast_u64/blobmsg_cast_s64 tests

Signed-off-by: Peter Seiderer &lt;ps.report@gmx.net&gt;
</content>
</entry>
<entry>
<title>tests: cram: test_base64: really fix failing tests</title>
<updated>2021-03-03T17:26:52Z</updated>
<author>
<name>Petr Štetiar</name>
</author>
<published>2021-03-03T14:37:52Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/libubox/commit/?id=4d8995e91d56ee7629842afee2194bfe4c89854c'/>
<id>urn:sha1:4d8995e91d56ee7629842afee2194bfe4c89854c</id>
<content type='text'>
Remove the checks for 'Aborted (core dumped)' message altogether as it's
not reliable and not portable.

References: https://gitlab.com/openwrt/project/libubox/-/jobs/1070226897
Signed-off-by: Petr Štetiar &lt;ynezz@true.cz&gt;
</content>
</entry>
<entry>
<title>tests: cram: test_base64: fix failing tests</title>
<updated>2021-03-03T13:37:09Z</updated>
<author>
<name>Petr Štetiar</name>
</author>
<published>2021-03-03T12:49:27Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/libubox/commit/?id=870acee325fe61267ac4ec1f0c6cba80b954cce5'/>
<id>urn:sha1:870acee325fe61267ac4ec1f0c6cba80b954cce5</id>
<content type='text'>
Seems like latest version of llvm compiler/sanitizer has changed
behaviour during crash so `Aborted (core dumped)` is now printed to
stdout.

Fixes following issue:

 --- /builds/openwrt/project/libubox/tests/cram/test_base64.t
 +++ /builds/openwrt/project/libubox/tests/cram/test_base64.t.err
 @@ -49,9 +49,7 @@
    b64_encode: Assertion `dest &amp;&amp; targsize &gt; 0' failed.

    $ test-b64_decode-san 2&gt; output.log; check
 -  Aborted (core dumped)
    b64_decode: Assertion `dest &amp;&amp; targsize &gt; 0' failed.

    $ test-b64_encode-san 2&gt; output.log; check
 -  Aborted (core dumped)
    b64_encode: Assertion `dest &amp;&amp; targsize &gt; 0' failed.

References: https://gitlab.com/openwrt/project/libubox/-/jobs/1069840314
Signed-off-by: Petr Štetiar &lt;ynezz@true.cz&gt;
</content>
</entry>
</feed>
