Skip to content

Replace YAJL with yyjson for JSON parsing and generation#170

Open
giuseppe wants to merge 5 commits intocontainers:mainfrom
giuseppe:use-yyjson
Open

Replace YAJL with yyjson for JSON parsing and generation#170
giuseppe wants to merge 5 commits intocontainers:mainfrom
giuseppe:use-yyjson

Conversation

@giuseppe
Copy link
Copy Markdown
Member

No description provided.

giuseppe added a commit to giuseppe/crun that referenced this pull request Apr 15, 2026
Switch from the unmaintained YAJL library to yyjson for all JSON
operations.  Update the build system (configure.ac, Makefile.am) to
use yyjson, and update the libocispec submodule to the version with
yyjson support.

gitmodules is pointing to my git repo for now.

Needs: containers/libocispec#170

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
giuseppe added a commit to giuseppe/crun that referenced this pull request Apr 15, 2026
Switch from the unmaintained YAJL library to yyjson for all JSON
operations.  Update the build system (configure.ac, Makefile.am) to
use yyjson, and update the libocispec submodule to the version with
yyjson support.

gitmodules is pointing to my git repo for now.

Needs: containers/libocispec#170

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
giuseppe added a commit to giuseppe/crun that referenced this pull request Apr 15, 2026
Switch from the unmaintained YAJL library to yyjson for all JSON
operations.  Update the build system (configure.ac, Makefile.am) to
use yyjson, and update the libocispec submodule to the version with
yyjson support.

gitmodules is pointing to my git repo for now.

Needs: containers/libocispec#170

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
giuseppe added a commit to giuseppe/crun that referenced this pull request Apr 15, 2026
Switch from the unmaintained YAJL library to yyjson for all JSON
operations.  Update the build system (configure.ac, Makefile.am) to
use yyjson, and update the libocispec submodule to the version with
yyjson support.

gitmodules is pointing to my git repo for now.

Needs: containers/libocispec#170

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
giuseppe added a commit to giuseppe/crun that referenced this pull request Apr 15, 2026
Switch from the unmaintained YAJL library to yyjson for all JSON
operations.  Update the build system (configure.ac, Makefile.am) to
use yyjson, and update the libocispec submodule to the version with
yyjson support.

gitmodules is pointing to my git repo for now.

Needs: containers/libocispec#170

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
giuseppe added a commit to giuseppe/crun that referenced this pull request Apr 15, 2026
Switch from the unmaintained YAJL library to yyjson for all JSON
operations.  Update the build system (configure.ac, Makefile.am) to
use yyjson, and update the libocispec submodule to the version with
yyjson support.

gitmodules is pointing to my git repo for now.

Needs: containers/libocispec#170

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
giuseppe added a commit to giuseppe/crun that referenced this pull request Apr 15, 2026
Switch from the unmaintained YAJL library to yyjson for all JSON
operations.  Update the build system (configure.ac, Makefile.am) to
use yyjson, and update the libocispec submodule to the version with
yyjson support.

gitmodules is pointing to my git repo for now.

Needs: containers/libocispec#170

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
giuseppe added a commit to giuseppe/crun that referenced this pull request Apr 15, 2026
Switch from the unmaintained YAJL library to yyjson for all JSON
operations.  Update the build system (configure.ac, Makefile.am) to
use yyjson, and update the libocispec submodule to the version with
yyjson support.

gitmodules is pointing to my git repo for now.

Needs: containers/libocispec#170

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
giuseppe added a commit to giuseppe/crun that referenced this pull request Apr 16, 2026
Switch from the unmaintained YAJL library to yyjson for all JSON
operations.  Update the build system (configure.ac, Makefile.am) to
use yyjson, and update the libocispec submodule to the version with
yyjson support.

gitmodules is pointing to my git repo for now.

Needs: containers/libocispec#170

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
@giuseppe giuseppe marked this pull request as ready for review April 16, 2026 10:27
@giuseppe giuseppe changed the title [WIP] Replace YAJL with yyjson for JSON parsing and generation Replace YAJL with yyjson for JSON parsing and generation Apr 16, 2026
@giuseppe giuseppe mentioned this pull request Apr 17, 2026
@giuseppe giuseppe linked an issue Apr 17, 2026 that may be closed by this pull request
@xw19
Copy link
Copy Markdown

xw19 commented Apr 18, 2026

@giuseppe will we keep yyjson statically linked?

@giuseppe
Copy link
Copy Markdown
Member Author

we need to support both ways, statically and dynamically linked

giuseppe added a commit to giuseppe/crun that referenced this pull request Apr 23, 2026
Switch from the unmaintained YAJL library to yyjson for all JSON
operations.  Update the build system (configure.ac, Makefile.am) to
use yyjson, and update the libocispec submodule to the version with
yyjson support.

gitmodules is pointing to my git repo for now.

Needs: containers/libocispec#170

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
giuseppe added a commit to giuseppe/crun that referenced this pull request Apr 23, 2026
Switch from the unmaintained YAJL library to yyjson for all JSON
operations.  Update the build system (configure.ac, Makefile.am) to
use yyjson, and update the libocispec submodule to the version with
yyjson support.

gitmodules is pointing to my git repo for now.

Needs: containers/libocispec#170

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
giuseppe added a commit to giuseppe/crun that referenced this pull request Apr 24, 2026
Switch from the unmaintained YAJL library to yyjson for all JSON
operations.  Update the build system (configure.ac, Makefile.am) to
use yyjson, and update the libocispec submodule to the version with
yyjson support.

gitmodules is pointing to my git repo for now.

Needs: containers/libocispec#170

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
giuseppe added a commit to giuseppe/crun that referenced this pull request Apr 24, 2026
Switch from the unmaintained YAJL library to yyjson for all JSON
operations.  Update the build system (configure.ac, Makefile.am) to
use yyjson, and update the libocispec submodule to the version with
yyjson support.

gitmodules is pointing to my git repo for now.

Needs: containers/libocispec#170

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
giuseppe added a commit to giuseppe/crun that referenced this pull request Apr 24, 2026
Switch from the unmaintained YAJL library to yyjson for all JSON
operations.  Update the build system (configure.ac, Makefile.am) to
use yyjson, and update the libocispec submodule to the version with
yyjson support.

gitmodules is pointing to my git repo for now.

Needs: containers/libocispec#170

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
@giuseppe
Copy link
Copy Markdown
Member Author

@jnovy what do you think of this change?

@giuseppe
Copy link
Copy Markdown
Member Author

giuseppe commented May 6, 2026

@jnovy @kolyshkin are you OK to move forward with this?

It is a quite significant change, that needs to happen in crun too, but we will finally get rid of the unmaintained libyajl dependency

@jnovy
Copy link
Copy Markdown

jnovy commented May 7, 2026

@giuseppe it's a similar trap like yajl we are about to introduce merging this. yyjson doesn't exist in RHEL so we need claim its maintenance and go through the painful new package process. Alternatively to stick it in the code directly and maintain it. What is wrong with just json-c which is available everywhere?

@giuseppe
Copy link
Copy Markdown
Member Author

giuseppe commented May 7, 2026

When I compared them, json-c does not have support for uint64 (https://github.com/json-c/json-c/blob/master/json_types.h#L62-L73), anything above INT64_MAX will overflow. This is a blocker for us.

@jnovy
Copy link
Copy Markdown

jnovy commented May 7, 2026

I see - LGTM then if we vendor this in on RHEL and use OS variant in Fedora and other distros containing yyjson.

@giuseppe
Copy link
Copy Markdown
Member Author

giuseppe commented May 7, 2026

thanks for the review!

I'll merge once we are also fine with containers/crun#2068

@jnovy
Copy link
Copy Markdown

jnovy commented May 7, 2026

@giuseppe just digged into json-c more and it actually does have uint64 support since version 0.14 (2020). The json_type enum you linked doesn't show it because json-c uses json_type_int as the public type with an internal subtype discriminator. The public API includes json_object_new_uint64(), json_object_get_uint64(), etc. RHEL 9 ships json-c 0.14 and RHEL 10 ships 0.18, both with full uint64 support.

giuseppe and others added 5 commits May 7, 2026 12:16
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Remove the honggfuzz HF_ITER code path that caused undefined reference
errors when building with -DFUZZER. Wrap main() in #ifndef FUZZER so
LibFuzzer can provide its own entry point.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Test parsing and round-trip generation of int64 and uint64 fields
with boundary values: INT64_MAX, INT64_MIN, UINT64_MAX, values
exceeding 32-bit range, negative values, and zero.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Expand the fuzzer from a single-mode runtime config parser to 7 modes
covering all OCI spec parsers with round-trip testing (parse, generate,
re-parse). Add honggfuzz-based CI fuzzing with Docker, matching the
pattern used by crun.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Migrate the entire JSON backend from YAJL to yyjson. This is a big-bang
replacement with no side-by-side support.

Closes: containers#138

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
@giuseppe
Copy link
Copy Markdown
Member Author

giuseppe commented May 7, 2026

thanks, I'll play with it and we can compare once I get something working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace yajl

3 participants