Skip to content

Conversation

@tomerdbz
Copy link
Collaborator

Description

Migrate the json-c library from version 0.13.1 to 0.17.0 to gain access to newer features and bug fixes. The new version uses Meson build system which is incompatible with the existing Autotools-based libxlio project.

To maintain compatibility, convert the Meson build system to Autotools:

  • Create configure.ac with comprehensive feature detection for threads, atomic operations, and system headers
  • Add Makefile.am with proper source file management and libtool support
  • Generate pkg-config files (json-c.pc, json-c-uninstalled.pc) for proper library linking
  • Add json_compat.h for backward compatibility with renamed functions

The new json-c 0.17.0 uses doca_third_party_ prefix for all exported functions to avoid symbol conflicts. Update all callers:

  • src/core/config/descriptor_providers/json_descriptor_provider.cpp
  • src/core/config/descriptor_providers/schema_analyzer.cpp
  • src/core/config/json_object_handle.cpp
  • src/core/config/json_utils.cpp
  • src/core/config/loaders/json_loader.cpp
  • tests/unit_tests/config/schema_analyzer.cpp

Configuration changes:

  • Update configure.ac to build json-c subdirectory
  • Modify config/m4/json.m4 to point to new library paths
  • Update third_party/Makefile.am with proper subdirectory handling

All 94 unit tests pass. Main project builds successfully with full backward compatibility maintained.

What

json-c: migrate from 0.13.1 to 0.17.0 with Autotools build system

Why ?

Fixes 4634244. fixes many bugs in the parser.

How ?

It is optional but for complex PRs please provide information about the design,
architecture, approach, etc.

Change type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Tests
  • Other

Check list

  • Code follows the style de facto guidelines of this project
  • Comments have been inserted in hard to understand places
  • Documentation has been updated (if necessary)
  • Test has been added (if possible)

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR migrates the json-c library from version 0.13.1 to 0.17.0, incorporating numerous bug fixes and improvements from the newer version. The main challenge addressed is converting the Meson build system in json-c 0.17.0 to Autotools to maintain compatibility with the existing libxlio project infrastructure.

Key changes include:

  • Converting Meson build system to Autotools with comprehensive configure.ac and Makefile.am
  • Adding doca_third_party_ prefix to all exported functions to avoid symbol conflicts
  • Creating backward compatibility layer through json_compat.h

Reviewed Changes

Copilot reviewed 82 out of 171 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
json_types.h Newly added core type definitions for json-c 0.17
json_tokener.h/.c Updated tokenizer with enhanced UTF-8 validation and improved error handling
json_object.h/.c Major overhaul with support for uint64 types and improved memory management
json_pointer.h/.c Enhanced JSON pointer functionality with better error handling
json_patch.h/.c Newly added JSON patch implementation (RFC 6902)
json_object_iterator.h/.c Updated iterator interface with doca_third_party_ prefixes
json_config.h Expanded configuration with comprehensive feature detection
json_c_version.h/.c Version information updated to 0.17.0 with prefix updates
json.h Main header reorganized with conflict detection and compatibility layer
Build files pkg-config and symbol export files for proper library integration

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

/* clang-format on */

/**
* validete the utf-8 string in strict model.
Copy link

Copilot AI Sep 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in comment: 'validete' should be 'validate' and 'model' should be 'mode'.

Suggested change
* validete the utf-8 string in strict model.
* validate the utf-8 string in strict mode.

Copilot uses AI. Check for mistakes.
return doca_third_party_json_object_object_add(parent, path, value);

/* Getting here means that we tried to "dereference" a primitive JSON type
* (like string, int, bool).i.e. add a sub-object to it
Copy link

Copilot AI Sep 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space in comment: 'bool).i.e.' should be 'bool). i.e.' with proper spacing around the abbreviation.

Suggested change
* (like string, int, bool).i.e. add a sub-object to it
* (like string, int, bool). i.e. add a sub-object to it

Copilot uses AI. Check for mistakes.
@tomerdbz
Copy link
Collaborator Author

bot:retest

@tomerdbz tomerdbz force-pushed the 4583810_config_parser_update branch 5 times, most recently from 3166e66 to 18e0170 Compare September 21, 2025 11:59
@tomerdbz
Copy link
Collaborator Author

bot:retest

@galnoam
Copy link
Collaborator

galnoam commented Sep 21, 2025

Hi @NirWolfer, again the CI is stuck and we have many PRs like that.
Its a huge problem, we are not able to merge issues and we are close to code freeze.

CC: @DanielLibenson , @dpressle

@tomerdbz tomerdbz force-pushed the 4583810_config_parser_update branch 2 times, most recently from 63aab7a to 9816197 Compare September 25, 2025 09:30
@tomerdbz tomerdbz requested a review from pasis September 25, 2025 10:11
@galnoam
Copy link
Collaborator

galnoam commented Nov 10, 2025

@AlexanderGrissik , can you review?

@tomerdbz tomerdbz force-pushed the 4583810_config_parser_update branch from 9816197 to 5a08c29 Compare November 10, 2025 12:28
@greptile-apps
Copy link

greptile-apps bot commented Nov 10, 2025

Skipped: This PR changes more files than the configured file change limit: (170 files found, 100 file limit)

Migrate the json-c library from version 0.13.1 to 0.17.0 to gain access
to newer features and bug fixes. The new version uses Meson build system
which is incompatible with the existing Autotools-based libxlio project.

To maintain compatibility, convert the Meson build system to Autotools:

* Create configure.ac with comprehensive feature detection for threads,
  atomic operations, and system headers
* Add Makefile.am with proper source file management and libtool support
* Generate pkg-config files (json-c.pc, json-c-uninstalled.pc) for
  proper library linking
* Add json_compat.h for backward compatibility with renamed functions

The new json-c 0.17.0 uses doca_third_party_ prefix for all exported
functions to avoid symbol conflicts. Update all callers:

* src/core/config/descriptor_providers/json_descriptor_provider.cpp
* src/core/config/descriptor_providers/schema_analyzer.cpp
* src/core/config/json_object_handle.cpp
* src/core/config/json_utils.cpp
* src/core/config/loaders/json_loader.cpp
* tests/unit_tests/config/schema_analyzer.cpp

Configuration changes:
* Update configure.ac to build json-c subdirectory
* Modify config/m4/json.m4 to point to new library paths
* Update third_party/Makefile.am with proper subdirectory handling

All 94 unit tests pass. Main project builds successfully with full
backward compatibility maintained.

Signed-off-by: Tomer Cabouly <[email protected]>
@tomerdbz tomerdbz force-pushed the 4583810_config_parser_update branch from 5a08c29 to 88dd316 Compare November 18, 2025 18:47
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.

2 participants