public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/libfyaml] rawhide: Modernize spec file
@ 2026-11-12 23:47 Neal Gompa
0 siblings, 0 replies; only message in thread
From: Neal Gompa @ 2026-11-12 23:47 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/libfyaml
Branch : rawhide
Commit : 3f03c39deae8c29f6e98e04c4fade50daee882ea
Author : Neal Gompa <ngompa@fedoraproject.org>
Date : 2026-11-12T18:47:23-05:00
Stats : +583/-16 in 10 file(s)
URL : https://src.fedoraproject.org/rpms/libfyaml/c/3f03c39deae8c29f6e98e04c4fade50daee882ea?branch=rawhide
Log:
Modernize spec file
- Backport various fixes from upstream
- Use new location for source tarball
---
diff --git a/0001-utf8-Guard-against-NULL-pointer-in-fy_utf8_split_pos.patch b/0001-utf8-Guard-against-NULL-pointer-in-fy_utf8_split_pos.patch
new file mode 100644
index 0000000..066e2d8
--- /dev/null
+++ b/0001-utf8-Guard-against-NULL-pointer-in-fy_utf8_split_pos.patch
@@ -0,0 +1,37 @@
+From 600c93bbff40b939d19de3776da97a7579758776 Mon Sep 17 00:00:00 2001
+From: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
+Date: Sun, 15 Mar 2026 16:59:04 +0200
+Subject: [PATCH 01/10] utf8: Guard against NULL pointer in fy_utf8_split_posix
+
+Do not crash when passed a NULL pointer.
+
+Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
+---
+ src/util/fy-utf8.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/util/fy-utf8.c b/src/util/fy-utf8.c
+index 218509f..08e4cf2 100644
+--- a/src/util/fy-utf8.c
++++ b/src/util/fy-utf8.c
+@@ -624,7 +624,7 @@ void *fy_utf8_split_posix(const char *str, int *argcp, const char * const *argvp
+ const char *s, *e;
+ enum split_state ss;
+ int c, w, val, tmp, outc, i;
+- size_t arg_alloc = strlen(str) + 1, tmplen;
++ size_t arg_alloc, tmplen;
+ char *arg = NULL, *args, *arge, *tmparg;
+ int argv_alloc = 64, argv_count = 0;
+ char **argv = NULL, **tmpargv;
+@@ -633,6 +633,8 @@ void *fy_utf8_split_posix(const char *str, int *argcp, const char * const *argvp
+ if (!str || !argcp || !argvp)
+ return NULL;
+
++ arg_alloc = strlen(str) + 1;
++
+ /* the temporary is guaranteed to fit one split */
+ arg = alloca(arg_alloc);
+ args = arg;
+--
+2.56.0
+
diff --git a/0002-parse-Fix-UB-in-treaming_alias_collection_state.patch b/0002-parse-Fix-UB-in-treaming_alias_collection_state.patch
new file mode 100644
index 0000000..8128244
--- /dev/null
+++ b/0002-parse-Fix-UB-in-treaming_alias_collection_state.patch
@@ -0,0 +1,56 @@
+From 040e85d6176f093bb50af750cd0ea5a76e502d5d Mon Sep 17 00:00:00 2001
+From: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
+Date: Mon, 16 Mar 2026 12:15:28 +0200
+Subject: [PATCH 02/10] parse: Fix UB in treaming_alias_collection_state
+
+The shift must be handled correctly.
+
+Fixes #265
+
+Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
+---
+ src/lib/fy-parse.c | 11 +++++++----
+ 1 file changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/src/lib/fy-parse.c b/src/lib/fy-parse.c
+index 4fabc69..8fbd372 100644
+--- a/src/lib/fy-parse.c
++++ b/src/lib/fy-parse.c
+@@ -8020,6 +8020,7 @@ static inline int
+ fy_parse_streaming_alias_collection_state_set_top(struct fy_parser *fyp, int cts)
+ {
+ int pos, off, old_cts;
++ uint32_t mask, bits;
+
+ if (fyp->cts.top < 2)
+ return -1;
+@@ -8030,12 +8031,14 @@ fy_parse_streaming_alias_collection_state_set_top(struct fy_parser *fyp, int cts
+ pos = (fyp->cts.top - 2) / (sizeof(*fyp->cts.stack) * 8);
+ off = (fyp->cts.top - 2) % (sizeof(*fyp->cts.stack) * 8);
+
+- old_cts = (int)((fyp->cts.stack[pos] >> off) & 3);
++ old_cts = (int)((fyp->cts.stack[pos] >> off) & UINT32_C(3));
++ mask = UINT32_C(3) << off;
++ bits = ((uint32_t)cts & UINT32_C(3)) << off;
+
+ /* clear the bits first */
+- fyp->cts.stack[pos] &= ~(3 << off);
++ fyp->cts.stack[pos] &= ~mask;
+ /* set the state */
+- fyp->cts.stack[pos] |= (cts & 3) << off;
++ fyp->cts.stack[pos] |= bits;
+
+ return old_cts;
+ }
+@@ -8052,7 +8055,7 @@ fy_parse_streaming_alias_collection_state_top(struct fy_parser *fyp)
+ pos = (fyp->cts.top - 2) / (sizeof(*fyp->cts.stack) * 8);
+ off = (fyp->cts.top - 2) % (sizeof(*fyp->cts.stack) * 8);
+
+- return (int)((fyp->cts.stack[pos] >> off) & 3);
++ return (int)((fyp->cts.stack[pos] >> off) & UINT32_C(3));
+ }
+
+ static inline bool
+--
+2.56.0
+
diff --git a/0003-test-Add-fuzzing-test-for-treaming_alias_collection_.patch b/0003-test-Add-fuzzing-test-for-treaming_alias_collection_.patch
new file mode 100644
index 0000000..dfb783b
--- /dev/null
+++ b/0003-test-Add-fuzzing-test-for-treaming_alias_collection_.patch
@@ -0,0 +1,76 @@
+From 0185220c4b3fb8ffe6dbc2d487c0bba09b61dd9e Mon Sep 17 00:00:00 2001
+From: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
+Date: Mon, 16 Mar 2026 12:16:22 +0200
+Subject: [PATCH 03/10] test: Add fuzzing test for
+ treaming_alias_collection_state()
+
+Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
+---
+ test/libfyaml-test-fuzzing.c | 46 ++++++++++++++++++++++++++++++++++++
+ 1 file changed, 46 insertions(+)
+
+diff --git a/test/libfyaml-test-fuzzing.c b/test/libfyaml-test-fuzzing.c
+index 3b22e73..22798eb 100644
+--- a/test/libfyaml-test-fuzzing.c
++++ b/test/libfyaml-test-fuzzing.c
+@@ -1125,6 +1125,51 @@ START_TEST(fuzz_anchor_accel_cleanup_mapping_borrowed_input)
+ }
+ END_TEST
+
++START_TEST(fuzz_parser_streaming_alias_collection_state_mask)
++{
++ char data[] =
++ "\x7b\x0a\x7b\x26\x25\x3e\x25\x7b\x26\x30\x7a\x3a\x7b\x7b\x26"
++ "\x3a\x7b\x7b\x26\x3a\x7b\x66\x3a\x3a\x7b\x7b\x26\x54\x7b\x26"
++ "\x3a\x7b\x26\x3a\x7b\x26\x3a\x7b\x7b\x26\x3a\x7b\x26\x3a\x26"
++ "\x25\x3e\x25\x7b\x26\x31\x3a\x7b\x7b\x26\x3a\x7b\x32\x26\x3a"
++ "\x7b\x66\x3a\x3a\x7b\x7b\x26\x54\x7b\x26\x3a\x7b\x26\x3a\x7b"
++ "\x26\x3a\x7b\x7b\x26\x3a\x7b\x26\x3a\x26\x25\x3e\x25\x7b\x26"
++ "\x31\x3a\x7b\x28\x26\x3a\x7b\x26\x30\x7a\x3a\x7b\x7b\x26\x3a"
++ "\x7b\x7b\x26\x3a\x7b\x66\x3a\x3a\x7b\x7b\x26\x54\x7b\x26\x3a"
++ "\x7b\x26\x3a\x7b\x26\x3a\x7b\x7b\x26\x3a\x7b\x26\x3a\x26\x25"
++ "\x3e\x60\x7b\x26\x31\x3a\x7b\x7b\x26\x3a\x7b\x32\x26\x3a\x7b"
++ "\x66\x3a\x3a\x7b\x7b\x26\x54\x7b\x26\x3a\x7b\x26\x3a\x7b\x26"
++ "\x3a\x7b\x7b\x26\x3a\x7b\x26\x3a\x26\x25\x3e\x25\x7b\x26\x31"
++ "\x3a\x7b\x7b\x26\x3a\x7b\x32\x6e\x3a\x0a\x25\x59\x41\x4d\x4c"
++ "\x09\x31\x2e\x31\xc2\x85\xc2\x85\x27\x29\x23\x56\x56\x31\xc2"
++ "\x85\x2e\x2e\x2e\xc2\x85\x2d\x29\x4c\x09\x31\x3a\x7b\x26\x7b"
++ "\x3a\x7b\x26\x3a\x7b\x26\x3a\x7b\x0a\x25\x00\x00\x00";
++ struct fy_parser *fyp = NULL;
++ struct fy_parse_cfg cfg = {
++ .flags = FYPCF_RESOLVE_DOCUMENT | FYPCF_PREFER_RECURSIVE |
++ FYPCF_YPATH_ALIASES,
++ };
++ struct fy_event *fyev;
++ FILE *f = NULL;
++
++ f = fmemopen((void *)data, sizeof(data), "r");
++ ck_assert_ptr_ne(f, NULL);
++
++ fyp = fy_parser_create(&cfg);
++ ck_assert_ptr_ne(fyp, NULL);
++
++ ck_assert_int_eq(fy_parser_set_input_fp(fyp, NULL, f), 0);
++
++ while ((fyev = fy_parser_parse(fyp)) != NULL) {
++ fy_event_get_comments(fyev);
++ fy_parser_event_free(fyp, fyev);
++ }
++
++ fclose(f);
++ fy_parser_destroy(fyp);
++}
++END_TEST
++
+ void libfyaml_case_fuzzing(struct fy_check_suite *cs)
+ {
+ struct fy_check_testcase *ctc;
+@@ -1193,4 +1238,5 @@ void libfyaml_case_fuzzing(struct fy_check_suite *cs)
+ fy_check_testcase_add_test(ctc, fuzz_path_expr_execute_oom);
+ fy_check_testcase_add_test(ctc, fuzz_anchor_accel_cleanup_scalar_borrowed_input);
+ fy_check_testcase_add_test(ctc, fuzz_anchor_accel_cleanup_mapping_borrowed_input);
++ fy_check_testcase_add_test(ctc, fuzz_parser_streaming_alias_collection_state_mask);
+ }
+--
+2.56.0
+
diff --git a/0005-Fix-32-bit-build-by-removing-stray-parameter-to-fy_s.patch b/0005-Fix-32-bit-build-by-removing-stray-parameter-to-fy_s.patch
new file mode 100644
index 0000000..a22d20f
--- /dev/null
+++ b/0005-Fix-32-bit-build-by-removing-stray-parameter-to-fy_s.patch
@@ -0,0 +1,26 @@
+From 0982fcefc6a16d4c8cb5b06747d3fc8e630de3ae Mon Sep 17 00:00:00 2001
+From: Fredrik Fornwall <fredrik@fornwall.net>
+Date: Sun, 15 Mar 2026 21:47:27 +0100
+Subject: [PATCH 05/10] Fix 32-bit build by removing stray parameter to
+ fy_skip_size32()
+
+---
+ include/libfyaml/libfyaml-vlsize.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/libfyaml/libfyaml-vlsize.h b/include/libfyaml/libfyaml-vlsize.h
+index 6ccb7ab..1b950c4 100644
+--- a/include/libfyaml/libfyaml-vlsize.h
++++ b/include/libfyaml/libfyaml-vlsize.h
+@@ -816,7 +816,7 @@ fy_decode_size_nocheck(const uint8_t *start, size_t *sizep)
+ static inline const uint8_t *
+ fy_skip_size(const uint8_t *start, size_t bufsz)
+ {
+- return fy_skip_size32(start, bufsz, &sz);
++ return fy_skip_size32(start, bufsz);
+ }
+
+ static inline const uint8_t *
+--
+2.56.0
+
diff --git a/0006-Fix-C11-atomics-detection-and-buggy-macros-for-C-com.patch b/0006-Fix-C11-atomics-detection-and-buggy-macros-for-C-com.patch
new file mode 100644
index 0000000..15bf762
--- /dev/null
+++ b/0006-Fix-C11-atomics-detection-and-buggy-macros-for-C-com.patch
@@ -0,0 +1,91 @@
+From 1026d76850909dc9b1c5f95b8cd94e865a313fd5 Mon Sep 17 00:00:00 2001
+From: Nanda H Krishna <me@nandahkrishna.com>
+Date: Sun, 15 Mar 2026 17:56:13 -0400
+Subject: [PATCH 06/10] Fix C11 atomics detection and buggy macros for C++
+ compatibility
+
+---
+ include/libfyaml/libfyaml-atomics.h | 12 +++++++++---
+ 1 file changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/include/libfyaml/libfyaml-atomics.h b/include/libfyaml/libfyaml-atomics.h
+index 54d88ae..64142a8 100644
+--- a/include/libfyaml/libfyaml-atomics.h
++++ b/include/libfyaml/libfyaml-atomics.h
+@@ -78,7 +78,7 @@ extern "C" {
+ #if !defined(FY_HAVE_C11_ATOMICS)
+ #undef FY_HAVE_STDATOMIC_H
+
+-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
++#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && !defined(__cplusplus)
+ #define FY_HAVE_C11_ATOMICS
+ #elif defined(__clang__) && defined(__has_extension)
+ #if __has_extension(c_atomic)
+@@ -123,7 +123,7 @@ typedef bool atomic_flag;
+
+ #define atomic_store(_ptr, _val) \
+ do { \
+- *(_obj) = (_val); \
++ *(_ptr) = (_val); \
+ } while(0)
+
+ #define atomic_exchange(_ptr, _v) \
+@@ -152,6 +152,7 @@ typedef bool atomic_flag;
+
+ #define atomic_fetch_add(_ptr, _v) \
+ ({ \
++ __typeof__(_ptr) __ptr = (_ptr); \
+ __typeof__(*(_ptr)) __old = *__ptr; \
+ *__ptr += (_v); \
+ __old; \
+@@ -159,6 +160,7 @@ typedef bool atomic_flag;
+
+ #define atomic_fetch_sub(_ptr, _v) \
+ ({ \
++ __typeof__(_ptr) __ptr = (_ptr); \
+ __typeof__(*(_ptr)) __old = *__ptr; \
+ *__ptr -= (_v); \
+ __old; \
+@@ -166,6 +168,7 @@ typedef bool atomic_flag;
+
+ #define atomic_fetch_or(_ptr, _v) \
+ ({ \
++ __typeof__(_ptr) __ptr = (_ptr); \
+ __typeof__(*(_ptr)) __old = *__ptr; \
+ *__ptr |= (_v); \
+ __old; \
+@@ -173,6 +176,7 @@ typedef bool atomic_flag;
+
+ #define atomic_fetch_xor(_ptr, _v) \
+ ({ \
++ __typeof__(_ptr) __ptr = (_ptr); \
+ __typeof__(*(_ptr)) __old = *__ptr; \
+ *__ptr ^= (_v); \
+ __old; \
+@@ -180,6 +184,7 @@ typedef bool atomic_flag;
+
+ #define atomic_fetch_and(_ptr, _v) \
+ ({ \
++ __typeof__(_ptr) __ptr = (_ptr); \
+ __typeof__(*(_ptr)) __old = *__ptr; \
+ *__ptr &= (_v); \
+ __old; \
+@@ -199,13 +204,14 @@ typedef bool atomic_flag;
+ #define atomic_flag_test_and_set(_ptr) \
+ ({ \
+ volatile atomic_flag *__ptr = (_ptr); \
++ bool __ret; \
+ if (!*__ptr) { \
+ *__ptr = true; \
+ __ret = true; \
+ } else \
+ __ret = false; \
+ __ret; \
+- }
++ })
+
+ #endif
+
+--
+2.56.0
+
diff --git a/0007-fix-folded-scalars-emit-spurious-trailing-blank-line.patch b/0007-fix-folded-scalars-emit-spurious-trailing-blank-line.patch
new file mode 100644
index 0000000..8d1efc3
--- /dev/null
+++ b/0007-fix-folded-scalars-emit-spurious-trailing-blank-line.patch
@@ -0,0 +1,188 @@
+From ac7cc3f3442dae8b30276c929b0c833970d72937 Mon Sep 17 00:00:00 2001
+From: jonathanrainer <jonathan.rainer@apollographql.com>
+Date: Sun, 15 Mar 2026 16:37:46 +0000
+Subject: [PATCH 07/10] fix: folded scalars emit spurious trailing blank line
+ in original mode
+
+fy_emit_token_write_folded_original was treating the parser's lookahead
+fragment (indent bytes consumed by fy_scan_block_scalar_indent) as a
+content line, producing a spurious blank line after every folded scalar
+in original mode.
+
+Fix by breaking on lines with no trailing linebreak
+(line_len_lb == line_len) and deferring blank-line emission so that
+only FYAC_KEEP chomping retains trailing blank lines.
+
+Signed-off-by: jonathanrainer <jonathan@jonathan-rainer.com>
+---
+ src/lib/fy-emit.c | 45 ++++++++++++++++-------
+ test/libfyaml-test-emit-bugs.c | 67 ++++++++++++++++++++++++++++++++++
+ 2 files changed, 99 insertions(+), 13 deletions(-)
+
+diff --git a/src/lib/fy-emit.c b/src/lib/fy-emit.c
+index 3649cc5..dcccdf4 100644
+--- a/src/lib/fy-emit.c
++++ b/src/lib/fy-emit.c
+@@ -1313,6 +1313,7 @@ static void fy_emit_token_write_folded_original(struct fy_emitter *emit,
+ struct fy_atom_raw_line_iter rliter;
+ const struct fy_raw_line *rl;
+ int w;
++ int deferred_blanks = 0;
+
+ fy_atom_raw_line_iter_start(atom, &rliter);
+ fy_emit_accum_start(&emit->ea, emit->column, fy_token_atom_lb_mode(fyt));
+@@ -1321,21 +1322,14 @@ static void fy_emit_token_write_folded_original(struct fy_emitter *emit,
+
+ while ((rl = fy_atom_raw_line_iter_next(&rliter)) != NULL) {
+
+- if (rl->content_len == 0) {
+- /* blank line: emit newline only */
+- fy_emit_putc_simple(emit, fyewt_linebreak, '\n');
+- emit->flags |= FYEF_WHITESPACE | FYEF_INDENTATION;
+- continue;
+- }
+-
+- /* content line: write indent, content, then newline */
+- fy_emit_write_indent(emit, indent);
+- fy_emit_output_col_sync(emit, &emit->ea);
++ /* Partial final fragment: parser lookahead consumed indent bytes of the
++ * next element; no trailing linebreak means this is not scalar content. */
++ if (rl->line_len_lb == rl->line_len)
++ break;
+
++ /* Compute content after stripping base indentation */
+ const char *s = rl->content_start;
+ const char *e = s + rl->content_len;
+-
+- /* skip the block scalar's base indentation */
+ {
+ unsigned int skip = orig_indent;
+ while (skip > 0 && s < e &&
+@@ -1345,8 +1339,24 @@ static void fy_emit_token_write_folded_original(struct fy_emitter *emit,
+ }
+ }
+
++ if (s >= e) {
++ /* blank line: defer emission */
++ deferred_blanks++;
++ continue;
++ }
++
++ /* non-blank content line: flush any deferred blank lines first */
++ while (deferred_blanks > 0) {
++ fy_emit_putc_simple(emit, fyewt_linebreak, '\n');
++ emit->flags |= FYEF_WHITESPACE | FYEF_INDENTATION;
++ deferred_blanks--;
++ }
++
++ fy_emit_write_indent(emit, indent);
++ fy_emit_output_col_sync(emit, &emit->ea);
++
+ while (s < e) {
+- const int c = fy_utf8_get(s, (size_t) (e - s), &w);
++ const int c = fy_utf8_get(s, (size_t)(e - s), &w);
+ if (c <= 0)
+ break;
+ fy_emit_accum_utf8_put(&emit->ea, c);
+@@ -1357,6 +1367,15 @@ static void fy_emit_token_write_folded_original(struct fy_emitter *emit,
+ emit->flags |= FYEF_WHITESPACE | FYEF_INDENTATION;
+ }
+
++ /* trailing blank lines: only keep-chomp retains them */
++ if (atom->chomp == FYAC_KEEP) {
++ while (deferred_blanks > 0) {
++ fy_emit_putc_simple(emit, fyewt_linebreak, '\n');
++ emit->flags |= FYEF_WHITESPACE | FYEF_INDENTATION;
++ deferred_blanks--;
++ }
++ }
++
+ fy_emit_accum_finish(&emit->ea);
+ fy_atom_raw_line_iter_finish(&rliter);
+ }
+diff --git a/test/libfyaml-test-emit-bugs.c b/test/libfyaml-test-emit-bugs.c
+index 02ee5cc..15beeda 100644
+--- a/test/libfyaml-test-emit-bugs.c
++++ b/test/libfyaml-test-emit-bugs.c
+@@ -913,6 +913,67 @@ START_TEST(emit_bug_folded_more_indented_roundtrip)
+ }
+ END_TEST
+
++/* ═══ Bug 16: fy_emit_token_write_folded_original emits spurious blank line ═══ */
++
++START_TEST(emit_bug_folded_clip_no_trailing_blank)
++{
++ /* > (clip): roundtrip must not add a blank line after the scalar */
++ static const char input[] =
++ "key: >\n"
++ " content line\n"
++ "other: value\n";
++ char *got = roundtrip_doc(input);
++ ck_assert_ptr_ne(got, NULL);
++ ck_assert_str_eq(got, input);
++ free(got);
++}
++END_TEST
++
++START_TEST(emit_bug_folded_strip_no_trailing_blank)
++{
++ /* >- (strip): roundtrip must not add a blank line after the scalar */
++ static const char input[] =
++ "key: >-\n"
++ " content line\n"
++ "other: value\n";
++ char *got = roundtrip_doc(input);
++ ck_assert_ptr_ne(got, NULL);
++ ck_assert_str_eq(got, input);
++ free(got);
++}
++END_TEST
++
++START_TEST(emit_bug_folded_keep_trailing_blank_preserved)
++{
++ /* >+ (keep): trailing blank lines must be preserved */
++ static const char input[] =
++ "key: >+\n"
++ " content line\n"
++ "\n"
++ "other: value\n";
++ char *got = roundtrip_doc(input);
++ ck_assert_ptr_ne(got, NULL);
++ ck_assert_str_eq(got, input);
++ free(got);
++}
++END_TEST
++
++START_TEST(emit_bug_folded_mid_content_blank_preserved)
++{
++ /* mid-content blank lines must always be preserved regardless of chomp */
++ static const char input[] =
++ "key: >\n"
++ " first line\n"
++ "\n"
++ " second line\n"
++ "other: value\n";
++ char *got = roundtrip_doc(input);
++ ck_assert_ptr_ne(got, NULL);
++ ck_assert_str_eq(got, input);
++ free(got);
++}
++END_TEST
++
+ /* ── registration ────────────────────────────────────────────────── */
+
+ void libfyaml_case_emit_bugs(struct fy_check_suite *cs)
+@@ -994,4 +1055,10 @@ void libfyaml_case_emit_bugs(struct fy_check_suite *cs)
+ fy_check_testcase_add_test(ctc, emit_bug_folded_keep_roundtrip);
+ fy_check_testcase_add_test(ctc, emit_bug_folded_blank_lines_roundtrip);
+ fy_check_testcase_add_test(ctc, emit_bug_folded_more_indented_roundtrip);
++
++ /* Bug 16: folded scalar spurious trailing blank line */
++ fy_check_testcase_add_test(ctc, emit_bug_folded_clip_no_trailing_blank);
++ fy_check_testcase_add_test(ctc, emit_bug_folded_strip_no_trailing_blank);
++ fy_check_testcase_add_test(ctc, emit_bug_folded_keep_trailing_blank_preserved);
++ fy_check_testcase_add_test(ctc, emit_bug_folded_mid_content_blank_preserved);
+ }
+--
+2.56.0
+
diff --git a/0009-test-gate-fuzz_parser_streaming_alias_collection_sta.patch b/0009-test-gate-fuzz_parser_streaming_alias_collection_sta.patch
new file mode 100644
index 0000000..51ba0cb
--- /dev/null
+++ b/0009-test-gate-fuzz_parser_streaming_alias_collection_sta.patch
@@ -0,0 +1,44 @@
+From d54b52a8f40eaa846645b5466af77f3ea69fac8c Mon Sep 17 00:00:00 2001
+From: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
+Date: Mon, 16 Mar 2026 16:47:52 +0200
+Subject: [PATCH 09/10] test: gate
+ fuzz_parser_streaming_alias_collection_state_mask for linux
+
+Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
+---
+ test/libfyaml-test-fuzzing.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/test/libfyaml-test-fuzzing.c b/test/libfyaml-test-fuzzing.c
+index 22798eb..17f928d 100644
+--- a/test/libfyaml-test-fuzzing.c
++++ b/test/libfyaml-test-fuzzing.c
+@@ -1125,6 +1125,8 @@ START_TEST(fuzz_anchor_accel_cleanup_mapping_borrowed_input)
+ }
+ END_TEST
+
++#if defined(__linux__)
++
+ START_TEST(fuzz_parser_streaming_alias_collection_state_mask)
+ {
+ char data[] =
+@@ -1170,6 +1172,8 @@ START_TEST(fuzz_parser_streaming_alias_collection_state_mask)
+ }
+ END_TEST
+
++#endif
++
+ void libfyaml_case_fuzzing(struct fy_check_suite *cs)
+ {
+ struct fy_check_testcase *ctc;
+@@ -1238,5 +1242,7 @@ void libfyaml_case_fuzzing(struct fy_check_suite *cs)
+ fy_check_testcase_add_test(ctc, fuzz_path_expr_execute_oom);
+ fy_check_testcase_add_test(ctc, fuzz_anchor_accel_cleanup_scalar_borrowed_input);
+ fy_check_testcase_add_test(ctc, fuzz_anchor_accel_cleanup_mapping_borrowed_input);
++#if defined(__linux__)
+ fy_check_testcase_add_test(ctc, fuzz_parser_streaming_alias_collection_state_mask);
++#endif
+ }
+--
+2.56.0
+
diff --git a/0010-vlsize-Handle-decoding-when-size_t-sizeof-uint64_t.patch b/0010-vlsize-Handle-decoding-when-size_t-sizeof-uint64_t.patch
new file mode 100644
index 0000000..8df0fa2
--- /dev/null
+++ b/0010-vlsize-Handle-decoding-when-size_t-sizeof-uint64_t.patch
@@ -0,0 +1,33 @@
+From 9a6e06ad189c3c1f343d7953b8fa09ddb055d725 Mon Sep 17 00:00:00 2001
+From: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
+Date: Wed, 18 Mar 2026 15:56:10 +0200
+Subject: [PATCH 10/10] vlsize: Handle decoding when size_t < sizeof(uint64_t)
+
+Those two might differ.
+
+Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
+---
+ include/libfyaml/libfyaml-vlsize.h | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/include/libfyaml/libfyaml-vlsize.h b/include/libfyaml/libfyaml-vlsize.h
+index 1b950c4..acfd78d 100644
+--- a/include/libfyaml/libfyaml-vlsize.h
++++ b/include/libfyaml/libfyaml-vlsize.h
+@@ -810,7 +810,12 @@ fy_decode_size(const uint8_t *start, size_t bufsz, size_t *sizep)
+ static inline const uint8_t *
+ fy_decode_size_nocheck(const uint8_t *start, size_t *sizep)
+ {
+- return fy_decode_size32_nocheck(start, sizep);
++ uint64_t sz;
++ const uint8_t *ret;
++
++ ret = fy_decode_size32_nocheck(start, &sz);
++ *sizep = (size_t)sz;
++ return ret;
+ }
+
+ static inline const uint8_t *
+--
+2.56.0
+
diff --git a/libfyaml.spec b/libfyaml.spec
index aec3630..cabfd9f 100644
--- a/libfyaml.spec
+++ b/libfyaml.spec
@@ -1,3 +1,6 @@
+# Enable tests
+%bcond ctest 1
+
Name: libfyaml
Version: 0.9.6
Release: 1%{?dist}
@@ -11,13 +14,32 @@ Summary: Complete YAML parser and emitter
# src/xxhash/xxhash.h
License: MIT and GPL-2.0-only and BSD-2-Clause
URL: https://github.com/pantoniou/libfyaml
-Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
+Source0: %{url}/releases/download/v%{version}/%{name}-%{version}.tar.gz
Source1: LICENSE-GPL-2.0
Source2: LICENSE-BSD-2-Clause
+
+# Backports from upstream
+Patch0001: 0001-utf8-Guard-against-NULL-pointer-in-fy_utf8_split_pos.patch
+Patch0002: 0002-parse-Fix-UB-in-treaming_alias_collection_state.patch
+Patch0003: 0003-test-Add-fuzzing-test-for-treaming_alias_collection_.patch
+Patch0005: 0005-Fix-32-bit-build-by-removing-stray-parameter-to-fy_s.patch
+Patch0006: 0006-Fix-C11-atomics-detection-and-buggy-macros-for-C-com.patch
+Patch0007: 0007-fix-folded-scalars-emit-spurious-trailing-blank-line.patch
+Patch0009: 0009-test-gate-fuzz_parser_streaming_alias_collection_sta.patch
+Patch0010: 0010-vlsize-Handle-decoding-when-size_t-sizeof-uint64_t.patch
+
# Fixed in master already
-Patch0: libfyaml-0.9.6-fix-manpage-install.patch
+# Submitted to stable: https://github.com/pantoniou/libfyaml/pull/507
+Patch0101: libfyaml-0.9.6-fix-manpage-install.patch
+
+BuildSystem: cmake
+
+# Disables tests that require networking to function
+BuildOption: -DENABLE_NETWORK:BOOL=OFF
+# Disable semi-broken handwritten per-architecture acceleration assembler code
+# which also inadvertently raises the CPU baseline
+BuildOption: -DENABLE_PORTABLE_TARGET:BOOL=ON
-BuildRequires: cmake
BuildRequires: cmake(check)
BuildRequires: gcc
BuildRequires: pkgconfig(yaml-0.1)
@@ -60,21 +82,11 @@ Header files and libraries for libfyaml
%prep
%autosetup -C -p1
-%conf
-%cmake -DENABLE_NETWORK:BOOL=OFF
-%build
+%build -p
cp %{SOURCE1} .
cp %{SOURCE2} .
-%cmake_build
-
-%install
-%cmake_install
-
-%check
-# Run basic tests
-%ctest
%files
%license LICENSE
@@ -103,9 +115,13 @@ cp %{SOURCE2} .
%{_libdir}/libfyaml.so
%{_mandir}/man3/libfyaml*
+
%changelog
-* Tue Nov 10 2026 Neal Gompa <ngompa@fedoraproject.org> - 0.9.6-1
+* Thu Nov 12 2026 Neal Gompa <ngompa@fedoraproject.org> - 0.9.6-1
- Rebase to 0.9.6
+- Modernize spec file
+- Backport various fixes from upstream
+- Use new location for source tarball
* Thu Jul 16 2026 Fedora Release Engineering <releng@fedoraproject.org> - 0.8-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild
diff --git a/sources b/sources
index eabf58b..290974b 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-SHA512 (libfyaml-0.9.6.tar.gz) = e38f42b5d3e5e88300fd1c7b59868592afa5f2f88d30f61e778700c35435ebd14ecef7d82ac0213345dabdb3c562dc234ed1b2bfd84e40b47fdc4f84144c79f5
+SHA512 (libfyaml-0.9.6.tar.gz) = 71f01fdbfa8a3675bdd6697929bb8ee85672befa5ed815ef30813987c2f75f8ef0959e70d1b17d02ccadabc967f1dfd5b7f46a10a83fca7b1a9ed7455c52e344
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-12 23:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-12 23:47 [rpms/libfyaml] rawhide: Modernize spec file Neal Gompa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox