diff options
Diffstat (limited to 'contrib')
31 files changed, 430 insertions, 176 deletions
diff --git a/contrib/expat/Changes b/contrib/expat/Changes index 092252ed1fa3..01e54b676416 100644 --- a/contrib/expat/Changes +++ b/contrib/expat/Changes @@ -41,6 +41,59 @@ !! THANK YOU! Sebastian Pipping -- Berlin, 2024-03-09 !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +Release 2.7.3 Wed September 24 2025 + Security fixes: + #1046 #1048 Fix alignment of internal allocations for some non-amd64 + architectures (e.g. sparc32); fixes up on the fix to + CVE-2025-59375 from #1034 (of Expat 2.7.2 and related + backports) + #1059 Fix a class of false positives where input should have been + rejected with error XML_ERROR_ASYNC_ENTITY; regression from + CVE-2024-8176 fix pull request #973 (of Expat 2.7.0 and + related backports). Please check the added unit tests for + example documents. + + Other changes: + #1043 Prove and regression-proof absence of integer overflow + from function expat_realloc + #1062 Remove "harmless" cast that truncated a size_t to unsigned + #1049 Autotools: Remove "ln -s" discovery + #1054 docs: Be consistent with use of floating point around + XML_SetAllocTrackerMaximumAmplification + #1056 docs: Make it explicit that XML_GetCurrentColumnNumber + starts at 0 + #1057 docs: Better integrate the effect of the activation + thresholds + #1058 docs: Fix an in-comment typo in expat.h + #1045 docs: Fix a typo in README.md + #1041 docs: Improve change log of release 2.7.2 + #1053 xmlwf: Resolve use of functions XML_GetErrorLineNumber + and XML_GetErrorColumnNumber + #1032 Windows: Normalize .bat files to CRLF line endings + #1060 #1061 Version info bumped from 12:0:11 (libexpat*.so.1.11.0) + to 12:1:11 (libexpat*.so.1.11.1); see https://verbump.de/ + for what these numbers do + + Infrastructure: + #1047 #1050 CI: Cleanup UndefinedBehaviorSanitizer fatality + #1044 CI|Linux: Stop aborting at first job failure + #1052 CI|FreeBSD: Upgrade to FreeBSD 15.0 + #1039 CI|FreeBSD: Do not install CMake meta-package + + Special thanks to: + Bénédikt Tran + Berkay Eren Ürün + Daniel Engberg + Hanno Böck + Matthew Fernandez + Rolf Eike Beer + Sam James + Tim Bray + and + Clang/GCC UndefinedBehaviorSanitizer + OSS-Fuzz / ClusterFuzz + Z3 Theorem Prover + Release 2.7.2 Tue September 16 2025 Security fixes: #1018 #1034 CVE-2025-59375 -- Disallow use of disproportional amounts of @@ -73,7 +126,7 @@ Release 2.7.2 Tue September 16 2025 to the pull request URL could be of help. Other changes: - #1008 #1017 Autotools: Sync CMake templates with CMake 3.31 for macOS + #1008 #1017 Autotools|macOS: Sync CMake templates with CMake 3.31 #1007 CMake: Drop support for CMake <3.15 #1004 CMake: Fix off_t detection for -Werror #1007 CMake|Windows: Fix -DEXPAT_MSVC_STATIC_CRT=ON @@ -89,7 +142,7 @@ Release 2.7.2 Tue September 16 2025 #994 docs: Drop AppVeyor badge #1000 tests: Fix portable_strndup #1036 Drop casts around malloc/free/realloc that C99 does not need - #1010 Replace empty for-loops with while loops + #1010 Replace empty for loops with while loops #1011 Add const with internal XmlInitUnknownEncodingNS #14 #1037 Drop an OpenVMS support leftover #999 #1001 Address more clang-tidy warnings @@ -111,6 +164,7 @@ Release 2.7.2 Tue September 16 2025 Neil Pang Theo Buehler and + GNU Time OSS-Fuzz / ClusterFuzz Perl XML::Parser diff --git a/contrib/expat/README.md b/contrib/expat/README.md index fdaaf459e204..c2f288ca1242 100644 --- a/contrib/expat/README.md +++ b/contrib/expat/README.md @@ -11,7 +11,7 @@ > at the top of the `Changes` file. -# Expat, Release 2.7.2 +# Expat, Release 2.7.3 This is Expat, a C99 library for parsing [XML 1.0 Fourth Edition](https://www.w3.org/TR/2006/REC-xml-20060816/), started by @@ -120,7 +120,7 @@ project(hello VERSION 1.0.0) FetchContent_Declare( expat GIT_REPOSITORY https://github.com/libexpat/libexpat/ - GIT_TAG 000000000_GIT_COMMIT_SHA1_HERE_000000000 # i.e. Git tag R_0_Y_Z + GIT_TAG 000000000_GIT_COMMIT_SHA1_HERE_000000000 # i.e. Git tag R_X_Y_Z SOURCE_SUBDIR expat/ ) diff --git a/contrib/expat/configure.ac b/contrib/expat/configure.ac index b9966eabcd60..072fea41ee8c 100644 --- a/contrib/expat/configure.ac +++ b/contrib/expat/configure.ac @@ -24,6 +24,7 @@ dnl Copyright (c) 2019 Kishore Kunche <kishore.kunche@intel.com> dnl Copyright (c) 2020 Jeffrey Walton <noloader@gmail.com> dnl Copyright (c) 2024 Ferenc Géczi <ferenc.gm@gmail.com> dnl Copyright (c) 2024 Dag-Erling Smørgrav <des@des.dev> +dnl Copyright (c) 2025 Matthew Fernandez <matthew.fernandez@gmail.com> dnl Licensed under the MIT license: dnl dnl Permission is hereby granted, free of charge, to any person obtaining @@ -85,7 +86,7 @@ dnl If the API changes incompatibly set LIBAGE back to 0 dnl LIBCURRENT=12 # sync -LIBREVISION=0 # with +LIBREVISION=1 # with LIBAGE=11 # CMakeLists.txt! AC_CONFIG_HEADERS([expat_config.h]) @@ -95,7 +96,6 @@ AH_BOTTOM([#endif // ndef EXPAT_CONFIG_H]) AM_PROG_AR AC_PROG_INSTALL -AC_PROG_LN_S AC_PROG_MAKE_SET LT_PREREQ([2.4]) diff --git a/contrib/expat/doc/reference.html b/contrib/expat/doc/reference.html index 12b12b92ff6d..d2dded499435 100644 --- a/contrib/expat/doc/reference.html +++ b/contrib/expat/doc/reference.html @@ -52,7 +52,7 @@ <div> <h1> The Expat XML Parser - <small>Release 2.7.2</small> + <small>Release 2.7.3</small> </h1> </div> <div class="content"> @@ -2137,8 +2137,8 @@ XML_Size XMLCALL XML_GetCurrentColumnNumber(XML_Parser p); </pre> <div class="fcndef"> -Return the offset, from the beginning of the current line, of -the position. +Return the <em>offset</em>, from the beginning of the current line, of +the position. The first column is reported as <code>0</code>. </div> <h4 id="XML_GetCurrentByteCount">XML_GetCurrentByteCount</h4> @@ -2200,7 +2200,10 @@ XML_SetBillionLaughsAttackProtectionMaximumAmplification(XML_Parser p, returns <code>XML_TRUE</code> upon success and <code>XML_FALSE</code> upon error. </p> - <p>The amplification factor is calculated as ..</p> + <p> + Once the <a href="#XML_SetBillionLaughsAttackProtectionActivationThreshold">threshold for activation</a> is reached, + the amplification factor is calculated as .. + </p> <pre>amplification := (direct + indirect) / direct</pre> <p> .. while parsing, whereas @@ -2317,7 +2320,10 @@ XML_SetAllocTrackerMaximumAmplification(XML_Parser p, </li> </ul> - <p>The amplification factor is calculated as ..</p> + <p> + Once the <a href="#XML_SetAllocTrackerActivationThreshold">threshold for activation</a> is reached, + the amplification factor is calculated as .. + </p> <pre>amplification := allocated / direct</pre> <p> .. while parsing, whereas @@ -2339,7 +2345,7 @@ XML_SetAllocTrackerMaximumAmplification(XML_Parser p, <p> <strong>Note:</strong> - Amplifications factors greater than 100 can been observed near the start of parsing + Amplifications factors greater than <code>100.0</code> can been observed near the start of parsing even with benign files in practice. So if you do reduce the maximum allowed amplification, diff --git a/contrib/expat/doc/xmlwf.1 b/contrib/expat/doc/xmlwf.1 index 5f50ba9e4d00..aa2e9c218007 100644 --- a/contrib/expat/doc/xmlwf.1 +++ b/contrib/expat/doc/xmlwf.1 @@ -5,7 +5,7 @@ \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac -.TH XMLWF 1 "September 16, 2025" "" "" +.TH XMLWF 1 "September 24, 2025" "" "" .SH NAME xmlwf \- Determines if an XML document is well-formed .SH SYNOPSIS diff --git a/contrib/expat/doc/xmlwf.xml b/contrib/expat/doc/xmlwf.xml index defe9df8e46a..01316bb16627 100644 --- a/contrib/expat/doc/xmlwf.xml +++ b/contrib/expat/doc/xmlwf.xml @@ -21,7 +21,7 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [ <!ENTITY dhfirstname "<firstname>Scott</firstname>"> <!ENTITY dhsurname "<surname>Bronson</surname>"> - <!ENTITY dhdate "<date>September 16, 2025</date>"> + <!ENTITY dhdate "<date>September 24, 2025</date>"> <!-- Please adjust this^^ date whenever cutting a new release. --> <!ENTITY dhsection "<manvolnum>1</manvolnum>"> <!ENTITY dhemail "<email>bronson@rinspin.com</email>"> diff --git a/contrib/expat/lib/expat.h b/contrib/expat/lib/expat.h index bb9cdedbac7d..290dfeb0f6dd 100644 --- a/contrib/expat/lib/expat.h +++ b/contrib/expat/lib/expat.h @@ -19,6 +19,7 @@ Copyright (c) 2023 Hanno Böck <hanno@gentoo.org> Copyright (c) 2023 Sony Corporation / Snild Dolkow <snild@sony.com> Copyright (c) 2024 Taichi Haradaguchi <20001722@ymail.ne.jp> + Copyright (c) 2025 Matthew Fernandez <matthew.fernandez@gmail.com> Licensed under the MIT license: Permission is hereby granted, free of charge, to any person obtaining @@ -276,7 +277,7 @@ XML_ParserCreate_MM(const XML_Char *encoding, /* Prepare a parser object to be reused. This is particularly valuable when memory allocation overhead is disproportionately high, - such as when a large number of small documnents need to be parsed. + such as when a large number of small documents need to be parsed. All handlers are cleared from the parser, except for the unknownEncodingHandler. The parser's external state is re-initialized except for the values of ns and ns_triplets. @@ -1081,7 +1082,7 @@ XML_SetReparseDeferralEnabled(XML_Parser parser, XML_Bool enabled); */ # define XML_MAJOR_VERSION 2 # define XML_MINOR_VERSION 7 -# define XML_MICRO_VERSION 2 +# define XML_MICRO_VERSION 3 # ifdef __cplusplus } diff --git a/contrib/expat/lib/internal.h b/contrib/expat/lib/internal.h index 6e087858ebbe..8f5edf48ef7c 100644 --- a/contrib/expat/lib/internal.h +++ b/contrib/expat/lib/internal.h @@ -108,6 +108,7 @@ #endif #include <limits.h> // ULONG_MAX +#include <stddef.h> // size_t #if defined(_WIN32) \ && (! defined(__USE_MINGW_ANSI_STDIO) \ @@ -153,6 +154,11 @@ #define EXPAT_ALLOC_TRACKER_ACTIVATION_THRESHOLD_DEFAULT \ 67108864 // 64 MiB, 2^26 +// NOTE: If function expat_alloc was user facing, EXPAT_MALLOC_ALIGNMENT would +// have to take sizeof(long double) into account +#define EXPAT_MALLOC_ALIGNMENT sizeof(long long) // largest parser (sub)member +#define EXPAT_MALLOC_PADDING ((EXPAT_MALLOC_ALIGNMENT) - sizeof(size_t)) + /* NOTE END */ #include "expat.h" // so we can use type XML_Parser below diff --git a/contrib/expat/lib/xmlparse.c b/contrib/expat/lib/xmlparse.c index de1594934900..a187a3a18f19 100644 --- a/contrib/expat/lib/xmlparse.c +++ b/contrib/expat/lib/xmlparse.c @@ -1,4 +1,4 @@ -/* 60e137abb91af642d6c3988f8f133d23329b32638659c74d47125fc0faf6ddd5 (2.7.2+) +/* 28bcd8b1ba7eb595d82822908257fd9c3589b4243e3c922d0369f35bfcd7b506 (2.7.3+) __ __ _ ___\ \/ /_ __ __ _| |_ / _ \\ /| '_ \ / _` | __| @@ -41,6 +41,7 @@ Copyright (c) 2023-2024 Sony Corporation / Snild Dolkow <snild@sony.com> Copyright (c) 2024-2025 Berkay Eren Ürün <berkay.ueruen@siemens.com> Copyright (c) 2024 Hanno Böck <hanno@gentoo.org> + Copyright (c) 2025 Matthew Fernandez <matthew.fernandez@gmail.com> Licensed under the MIT license: Permission is hereby granted, free of charge, to any person obtaining @@ -850,14 +851,14 @@ static void * # endif expat_malloc(XML_Parser parser, size_t size, int sourceLine) { // Detect integer overflow - if (SIZE_MAX - size < sizeof(size_t)) { + if (SIZE_MAX - size < sizeof(size_t) + EXPAT_MALLOC_PADDING) { return NULL; } const XML_Parser rootParser = getRootParserOf(parser, NULL); assert(rootParser->m_parentParser == NULL); - const size_t bytesToAllocate = sizeof(size_t) + size; + const size_t bytesToAllocate = sizeof(size_t) + EXPAT_MALLOC_PADDING + size; if ((XmlBigCount)-1 - rootParser->m_alloc_tracker.bytesAllocated < bytesToAllocate) { @@ -894,7 +895,7 @@ expat_malloc(XML_Parser parser, size_t size, int sourceLine) { rootParser->m_alloc_tracker.peakBytesAllocated, sourceLine); } - return (char *)mallocedPtr + sizeof(size_t); + return (char *)mallocedPtr + sizeof(size_t) + EXPAT_MALLOC_PADDING; } # if defined(XML_TESTING) @@ -914,8 +915,9 @@ expat_free(XML_Parser parser, void *ptr, int sourceLine) { // Extract size (to the eyes of malloc_fcn/realloc_fcn) and // the original pointer returned by malloc/realloc - void *const mallocedPtr = (char *)ptr - sizeof(size_t); - const size_t bytesAllocated = sizeof(size_t) + *(size_t *)mallocedPtr; + void *const mallocedPtr = (char *)ptr - EXPAT_MALLOC_PADDING - sizeof(size_t); + const size_t bytesAllocated + = sizeof(size_t) + EXPAT_MALLOC_PADDING + *(size_t *)mallocedPtr; // Update accounting assert(rootParser->m_alloc_tracker.bytesAllocated >= bytesAllocated); @@ -954,7 +956,7 @@ expat_realloc(XML_Parser parser, void *ptr, size_t size, int sourceLine) { // Extract original size (to the eyes of the caller) and the original // pointer returned by malloc/realloc - void *mallocedPtr = (char *)ptr - sizeof(size_t); + void *mallocedPtr = (char *)ptr - EXPAT_MALLOC_PADDING - sizeof(size_t); const size_t prevSize = *(size_t *)mallocedPtr; // Classify upcoming change @@ -969,8 +971,13 @@ expat_realloc(XML_Parser parser, void *ptr, size_t size, int sourceLine) { } } + // NOTE: Integer overflow detection has already been done for us + // by expat_heap_increase_tolerable(..) above + assert(SIZE_MAX - sizeof(size_t) - EXPAT_MALLOC_PADDING >= size); + // Actually allocate - mallocedPtr = parser->m_mem.realloc_fcn(mallocedPtr, sizeof(size_t) + size); + mallocedPtr = parser->m_mem.realloc_fcn( + mallocedPtr, sizeof(size_t) + EXPAT_MALLOC_PADDING + size); if (mallocedPtr == NULL) { return NULL; @@ -1001,7 +1008,7 @@ expat_realloc(XML_Parser parser, void *ptr, size_t size, int sourceLine) { // Update in-block recorded size *(size_t *)mallocedPtr = size; - return (char *)mallocedPtr + sizeof(size_t); + return (char *)mallocedPtr + sizeof(size_t) + EXPAT_MALLOC_PADDING; } #endif // XML_GE == 1 @@ -1337,7 +1344,8 @@ parserCreate(const XML_Char *encodingName, XML_Parser parser = NULL; #if XML_GE == 1 - const size_t increase = sizeof(size_t) + sizeof(struct XML_ParserStruct); + const size_t increase + = sizeof(size_t) + EXPAT_MALLOC_PADDING + sizeof(struct XML_ParserStruct); if (parentParser != NULL) { const XML_Parser rootParser = getRootParserOf(parentParser, NULL); @@ -1352,11 +1360,13 @@ parserCreate(const XML_Char *encodingName, if (memsuite) { XML_Memory_Handling_Suite *mtemp; #if XML_GE == 1 - void *const sizeAndParser = memsuite->malloc_fcn( - sizeof(size_t) + sizeof(struct XML_ParserStruct)); + void *const sizeAndParser + = memsuite->malloc_fcn(sizeof(size_t) + EXPAT_MALLOC_PADDING + + sizeof(struct XML_ParserStruct)); if (sizeAndParser != NULL) { *(size_t *)sizeAndParser = sizeof(struct XML_ParserStruct); - parser = (XML_Parser)((char *)sizeAndParser + sizeof(size_t)); + parser = (XML_Parser)((char *)sizeAndParser + sizeof(size_t) + + EXPAT_MALLOC_PADDING); #else parser = memsuite->malloc_fcn(sizeof(struct XML_ParserStruct)); if (parser != NULL) { @@ -1369,11 +1379,12 @@ parserCreate(const XML_Char *encodingName, } else { XML_Memory_Handling_Suite *mtemp; #if XML_GE == 1 - void *const sizeAndParser - = malloc(sizeof(size_t) + sizeof(struct XML_ParserStruct)); + void *const sizeAndParser = malloc(sizeof(size_t) + EXPAT_MALLOC_PADDING + + sizeof(struct XML_ParserStruct)); if (sizeAndParser != NULL) { *(size_t *)sizeAndParser = sizeof(struct XML_ParserStruct); - parser = (XML_Parser)((char *)sizeAndParser + sizeof(size_t)); + parser = (XML_Parser)((char *)sizeAndParser + sizeof(size_t) + + EXPAT_MALLOC_PADDING); #else parser = malloc(sizeof(struct XML_ParserStruct)); if (parser != NULL) { @@ -6437,6 +6448,10 @@ internalEntityProcessor(XML_Parser parser, const char *s, const char *end, // process its possible inner entities (which are added to the // m_openInternalEntities during doProlog or doContent calls above) entity->hasMore = XML_FALSE; + if (! entity->is_param + && (openEntity->startTagLevel != parser->m_tagLevel)) { + return XML_ERROR_ASYNC_ENTITY; + } triggerReenter(parser); return result; } // End of entity processing, "if" block will return here @@ -8135,7 +8150,7 @@ poolGrow(STRING_POOL *pool) { if (bytesToAllocate == 0) return XML_FALSE; - temp = REALLOC(pool->parser, pool->blocks, (unsigned)bytesToAllocate); + temp = REALLOC(pool->parser, pool->blocks, bytesToAllocate); if (temp == NULL) return XML_FALSE; pool->blocks = temp; diff --git a/contrib/expat/lib/xmlrole.h b/contrib/expat/lib/xmlrole.h index 67bdd3dd5160..9d0d4ff11b7f 100644 --- a/contrib/expat/lib/xmlrole.h +++ b/contrib/expat/lib/xmlrole.h @@ -10,7 +10,7 @@ Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net> Copyright (c) 2002 Karl Waclawek <karl@waclawek.net> Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net> - Copyright (c) 2017-2024 Sebastian Pipping <sebastian@pipping.org> + Copyright (c) 2017-2025 Sebastian Pipping <sebastian@pipping.org> Licensed under the MIT license: Permission is hereby granted, free of charge, to any person obtaining diff --git a/contrib/expat/tests/alloc_tests.c b/contrib/expat/tests/alloc_tests.c index 644a49523c6e..5ae6c6a72025 100644 --- a/contrib/expat/tests/alloc_tests.c +++ b/contrib/expat/tests/alloc_tests.c @@ -2091,6 +2091,13 @@ START_TEST(test_alloc_reset_after_external_entity_parser_create_fail) { } END_TEST +#if XML_GE == 1 +static size_t +sizeRecordedFor(void *ptr) { + return *(size_t *)((char *)ptr - EXPAT_MALLOC_PADDING - sizeof(size_t)); +} +#endif // XML_GE == 1 + START_TEST(test_alloc_tracker_size_recorded) { XML_Memory_Handling_Suite memsuite = {malloc, realloc, free}; @@ -2106,16 +2113,16 @@ START_TEST(test_alloc_tracker_size_recorded) { void *ptr = expat_malloc(parser, 10, -1); assert_true(ptr != NULL); - assert_true(*((size_t *)ptr - 1) == 10); + assert_true(sizeRecordedFor(ptr) == 10); assert_true(expat_realloc(parser, ptr, SIZE_MAX / 2, -1) == NULL); - assert_true(*((size_t *)ptr - 1) == 10); // i.e. unchanged + assert_true(sizeRecordedFor(ptr) == 10); // i.e. unchanged ptr = expat_realloc(parser, ptr, 20, -1); assert_true(ptr != NULL); - assert_true(*((size_t *)ptr - 1) == 20); + assert_true(sizeRecordedFor(ptr) == 20); expat_free(parser, ptr, -1); #endif @@ -2125,6 +2132,22 @@ START_TEST(test_alloc_tracker_size_recorded) { } END_TEST +START_TEST(test_alloc_tracker_pointer_alignment) { + XML_Parser parser = XML_ParserCreate(NULL); +#if XML_GE == 1 + assert_true(sizeof(long long) >= sizeof(size_t)); // self-test + long long *const ptr + = (long long *)expat_malloc(parser, 4 * sizeof(long long), -1); + ptr[0] = 0LL; + ptr[1] = 1LL; + ptr[2] = 2LL; + ptr[3] = 3LL; + expat_free(parser, ptr, -1); +#endif + XML_ParserFree(parser); +} +END_TEST + START_TEST(test_alloc_tracker_maximum_amplification) { if (g_reparseDeferralEnabledDefault == XML_TRUE) { return; @@ -2355,14 +2378,13 @@ make_alloc_test_case(Suite *s) { tcase_add_test__ifdef_xml_dtd( tc_alloc, test_alloc_reset_after_external_entity_parser_create_fail); - tcase_add_test__ifdef_xml_dtd(tc_alloc, test_alloc_tracker_size_recorded); - tcase_add_test__ifdef_xml_dtd(tc_alloc, - test_alloc_tracker_maximum_amplification); - tcase_add_test__ifdef_xml_dtd(tc_alloc, test_alloc_tracker_threshold); - tcase_add_test__ifdef_xml_dtd(tc_alloc, - test_alloc_tracker_getbuffer_unlimited); - tcase_add_test__ifdef_xml_dtd(tc_alloc, test_alloc_tracker_api); + tcase_add_test__if_xml_ge(tc_alloc, test_alloc_tracker_size_recorded); + tcase_add_test__if_xml_ge(tc_alloc, test_alloc_tracker_pointer_alignment); + tcase_add_test__if_xml_ge(tc_alloc, test_alloc_tracker_maximum_amplification); + tcase_add_test__if_xml_ge(tc_alloc, test_alloc_tracker_threshold); + tcase_add_test__if_xml_ge(tc_alloc, test_alloc_tracker_getbuffer_unlimited); + tcase_add_test__if_xml_ge(tc_alloc, test_alloc_tracker_api); tcase_add_test(tc_alloc, test_mem_api_cycle); - tcase_add_test__ifdef_xml_dtd(tc_alloc, test_mem_api_unlimited); + tcase_add_test__if_xml_ge(tc_alloc, test_mem_api_unlimited); } diff --git a/contrib/expat/tests/misc_tests.c b/contrib/expat/tests/misc_tests.c index 3346bce6074b..2a8054546a12 100644 --- a/contrib/expat/tests/misc_tests.c +++ b/contrib/expat/tests/misc_tests.c @@ -211,7 +211,7 @@ START_TEST(test_misc_version) { if (! versions_equal(&read_version, &parsed_version)) fail("Version mismatch"); - if (xcstrcmp(version_text, XCS("expat_2.7.2")) + if (xcstrcmp(version_text, XCS("expat_2.7.3")) != 0) /* needs bump on releases */ fail("XML_*_VERSION in expat.h out of sync?\n"); } @@ -679,6 +679,98 @@ START_TEST(test_misc_expected_event_ptr_issue_980) { } END_TEST +START_TEST(test_misc_sync_entity_tolerated) { + const char *const doc = "<!DOCTYPE t0 [\n" + " <!ENTITY a '<t1></t1>'>\n" + " <!ENTITY b '<t2>two</t2>'>\n" + " <!ENTITY c '<t3>three<t4>four</t4>three</t3>'>\n" + " <!ENTITY d '<t5>&b;</t5>'>\n" + "]>\n" + "<t0>&a;&b;&c;&d;</t0>\n"; + XML_Parser parser = XML_ParserCreate(NULL); + + assert_true(_XML_Parse_SINGLE_BYTES(parser, doc, (int)strlen(doc), + /*isFinal=*/XML_TRUE) + == XML_STATUS_OK); + + XML_ParserFree(parser); +} +END_TEST + +START_TEST(test_misc_async_entity_rejected) { + struct test_case { + const char *doc; + enum XML_Status expectedStatusNoGE; + enum XML_Error expectedErrorNoGE; + XML_Size expectedErrorLine; + XML_Size expectedErrorColumn; + }; + const struct test_case cases[] = { + // Opened by one entity, closed by another + {"<!DOCTYPE t0 [\n" + " <!ENTITY open '<t1>'>\n" + " <!ENTITY close '</t1>'>\n" + "]>\n" + "<t0>&open;&close;</t0>\n", + XML_STATUS_OK, XML_ERROR_NONE, 5, 4}, + // Opened by tag, closed by entity (non-root case) + {"<!DOCTYPE t0 [\n" + " <!ENTITY g0 ''>\n" + " <!ENTITY g1 '&g0;</t1>'>\n" + "]>\n" + "<t0><t1>&g1;</t0>\n", + XML_STATUS_ERROR, XML_ERROR_TAG_MISMATCH, 5, 8}, + // Opened by tag, closed by entity (root case) + {"<!DOCTYPE t0 [\n" + " <!ENTITY g0 ''>\n" + " <!ENTITY g1 '&g0;</t0>'>\n" + "]>\n" + "<t0>&g1;\n", + XML_STATUS_ERROR, XML_ERROR_NO_ELEMENTS, 5, 4}, + // Opened by entity, closed by tag <-- regression from 2.7.0 + {"<!DOCTYPE t0 [\n" + " <!ENTITY g0 ''>\n" + " <!ENTITY g1 '<t1>&g0;'>\n" + "]>\n" + "<t0>&g1;</t1></t0>\n", + XML_STATUS_ERROR, XML_ERROR_TAG_MISMATCH, 5, 4}, + // Opened by tag, closed by entity; then the other way around + {"<!DOCTYPE t0 [\n" + " <!ENTITY open '<t1>'>\n" + " <!ENTITY close '</t1>'>\n" + "]>\n" + "<t0><t1>&close;&open;</t1></t0>\n", + XML_STATUS_OK, XML_ERROR_NONE, 5, 8}, + }; + + for (size_t i = 0; i < sizeof(cases) / sizeof(cases[0]); i++) { + const struct test_case testCase = cases[i]; + set_subtest("cases[%d]", (int)i); + + const char *const doc = testCase.doc; +#if XML_GE == 1 + const enum XML_Status expectedStatus = XML_STATUS_ERROR; + const enum XML_Error expectedError = XML_ERROR_ASYNC_ENTITY; +#else + const enum XML_Status expectedStatus = testCase.expectedStatusNoGE; + const enum XML_Error expectedError = testCase.expectedErrorNoGE; +#endif + + XML_Parser parser = XML_ParserCreate(NULL); + assert_true(_XML_Parse_SINGLE_BYTES(parser, doc, (int)strlen(doc), + /*isFinal=*/XML_TRUE) + == expectedStatus); + assert_true(XML_GetErrorCode(parser) == expectedError); +#if XML_GE == 1 + assert_true(XML_GetCurrentLineNumber(parser) == testCase.expectedErrorLine); + assert_true(XML_GetCurrentColumnNumber(parser) + == testCase.expectedErrorColumn); +#endif + XML_ParserFree(parser); + } +} +END_TEST + void make_miscellaneous_test_case(Suite *s) { TCase *tc_misc = tcase_create("miscellaneous tests"); @@ -707,4 +799,6 @@ make_miscellaneous_test_case(Suite *s) { tcase_add_test(tc_misc, test_misc_stopparser_rejects_unstarted_parser); tcase_add_test__if_xml_ge(tc_misc, test_renter_loop_finite_content); tcase_add_test(tc_misc, test_misc_expected_event_ptr_issue_980); + tcase_add_test(tc_misc, test_misc_sync_entity_tolerated); + tcase_add_test(tc_misc, test_misc_async_entity_rejected); } diff --git a/contrib/expat/xmlwf/xmlfile.c b/contrib/expat/xmlwf/xmlfile.c index 54617fcc5a1a..ce0b61217ed7 100644 --- a/contrib/expat/xmlwf/xmlfile.c +++ b/contrib/expat/xmlwf/xmlfile.c @@ -96,8 +96,8 @@ reportError(XML_Parser parser, const XML_Char *filename) { ftprintf(stdout, T("%s") T(":%") T(XML_FMT_INT_MOD) T("u") T(":%") T(XML_FMT_INT_MOD) T("u") T(": %s\n"), - filename, XML_GetErrorLineNumber(parser), - XML_GetErrorColumnNumber(parser), message); + filename, XML_GetCurrentLineNumber(parser), + XML_GetCurrentColumnNumber(parser), message); else ftprintf(stderr, T("%s: (unknown message %u)\n"), filename, (unsigned int)code); diff --git a/contrib/libucl/lua/lua_ucl.c b/contrib/libucl/lua/lua_ucl.c index d6be69e42a71..1b3f9dfd111c 100644 --- a/contrib/libucl/lua/lua_ucl.c +++ b/contrib/libucl/lua/lua_ucl.c @@ -30,6 +30,8 @@ #include "lua_ucl.h" #include <strings.h> +#include "bootstrap.h" + /*** * @module ucl * This lua module allows to parse objects from strings and to store data into @@ -1571,3 +1573,5 @@ ucl_object_toclosure (const ucl_object_t *obj) return (struct ucl_lua_funcdata*)obj->value.ud; } + +FLUA_MODULE(ucl); diff --git a/contrib/libucl/src/ucl_parser.c b/contrib/libucl/src/ucl_parser.c index 6be16d12169c..728cd6381056 100644 --- a/contrib/libucl/src/ucl_parser.c +++ b/contrib/libucl/src/ucl_parser.c @@ -164,51 +164,50 @@ start: } } } - else if (chunk->remain >= 2 && *p == '/') { - if (p[1] == '*') { - beg = p; - ucl_chunk_skipc (chunk, p); - comments_nested ++; - ucl_chunk_skipc (chunk, p); - - while (p < chunk->end) { - if (*p == '"' && *(p - 1) != '\\') { - quoted = !quoted; - } - - if (!quoted) { - if (*p == '*') { - ucl_chunk_skipc (chunk, p); - if (chunk->remain > 0 && *p == '/') { - comments_nested --; - if (comments_nested == 0) { - if (parser->flags & UCL_PARSER_SAVE_COMMENTS) { - ucl_save_comment (parser, beg, p - beg + 1); - beg = NULL; - } - - ucl_chunk_skipc (chunk, p); - goto start; - } - } - ucl_chunk_skipc (chunk, p); - } - else if (p[0] == '/' && chunk->remain >= 2 && p[1] == '*') { - comments_nested ++; - ucl_chunk_skipc (chunk, p); - ucl_chunk_skipc (chunk, p); - continue; + else if (chunk->remain >= 2 && *p == '/' && p[1] == '*') { + beg = p; + comments_nested ++; + ucl_chunk_skipc (chunk, p); + ucl_chunk_skipc (chunk, p); + while (p < chunk->end) { + if (*p == '"' && *(p - 1) != '\\') { + /* begin or end double-quoted string */ + quoted = !quoted; + ucl_chunk_skipc (chunk, p); + } + else if (quoted) { + /* quoted character */ + ucl_chunk_skipc (chunk, p); + } + else if (chunk->remain >= 2 && *p == '*' && p[1] == '/') { + /* end of comment */ + ucl_chunk_skipc (chunk, p); + ucl_chunk_skipc (chunk, p); + comments_nested --; + if (comments_nested == 0) { + if (parser->flags & UCL_PARSER_SAVE_COMMENTS) { + ucl_save_comment (parser, beg, p - beg + 1); + beg = NULL; } + goto start; } - + } + else if (chunk->remain >= 2 && *p == '/' && p[1] == '*') { + /* start of nested comment */ + comments_nested ++; + ucl_chunk_skipc (chunk, p); ucl_chunk_skipc (chunk, p); } - if (comments_nested != 0) { - ucl_set_err (parser, UCL_ENESTED, - "unfinished multiline comment", &parser->err); - return false; + else { + /* anything else */ + ucl_chunk_skipc (chunk, p); } } + if (comments_nested != 0) { + ucl_set_err (parser, UCL_ENESTED, + "unfinished multiline comment", &parser->err); + return false; + } } if (beg && p > beg && (parser->flags & UCL_PARSER_SAVE_COMMENTS)) { diff --git a/contrib/lyaml/ext/yaml/yaml.c b/contrib/lyaml/ext/yaml/yaml.c index 54478610134f..6a5ddc605e0f 100644 --- a/contrib/lyaml/ext/yaml/yaml.c +++ b/contrib/lyaml/ext/yaml/yaml.c @@ -35,6 +35,8 @@ #include "lyaml.h" +#include "bootstrap.h" + #define MYNAME "yaml" #define MYVERSION MYNAME " library for " LUA_VERSION " / " VERSION @@ -64,3 +66,5 @@ luaopen_yaml (lua_State *L) return 1; } + +FLUA_MODULE(yaml); diff --git a/contrib/mandoc/Makefile b/contrib/mandoc/Makefile index 0830c9f289a3..d4a2c794b437 100644 --- a/contrib/mandoc/Makefile +++ b/contrib/mandoc/Makefile @@ -15,7 +15,7 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -VERSION = 1.14.6s20250727 +VERSION = 1.14.6s20250926 # === LIST OF FILES ==================================================== diff --git a/contrib/mandoc/dba.c b/contrib/mandoc/dba.c index ee43933de3bf..ab40798e8eed 100644 --- a/contrib/mandoc/dba.c +++ b/contrib/mandoc/dba.c @@ -1,6 +1,6 @@ -/* $Id: dba.c,v 1.10 2017/02/17 14:43:54 schwarze Exp $ */ +/* $Id: dba.c,v 1.11 2025/09/24 13:13:30 schwarze Exp $ */ /* - * Copyright (c) 2016, 2017 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2016, 2017, 2025 Ingo Schwarze <schwarze@openbsd.org> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -318,7 +318,8 @@ compare_names(const void *vp1, const void *vp2) cp1 = *(const char * const *)vp1; cp2 = *(const char * const *)vp2; return (diff = *cp2 - *cp1) ? diff : - strcasecmp(cp1 + 1, cp2 + 1); + (diff = strcasecmp(cp1 + 1, cp2 + 1)) ? diff : + strcmp(cp1 + 1, cp2 + 1); } static int diff --git a/contrib/mandoc/main.c b/contrib/mandoc/main.c index 57b06c9b9e66..d70ff1ce77b4 100644 --- a/contrib/mandoc/main.c +++ b/contrib/mandoc/main.c @@ -1,6 +1,6 @@ -/* $Id: main.c,v 1.361 2022/04/14 16:43:43 schwarze Exp $ */ +/* $Id: main.c,v 1.364 2025/09/24 21:30:20 schwarze Exp $ */ /* - * Copyright (c) 2010-2012, 2014-2021 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2010-2012,2014-2021,2025 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010 Joerg Sonnenberger <joerg@netbsd.org> * @@ -109,7 +109,7 @@ static void parse(struct mparse *, int, const char *, struct outstate *, struct manconf *); static void passthrough(int, int); static void process_onefile(struct mparse *, struct manpage *, - int, struct outstate *, struct manconf *); + struct outstate *, struct manconf *); static void run_pager(struct outstate *, char *); static pid_t spawn_pager(struct outstate *, char *); static void usage(enum argmode) __attribute__((__noreturn__)); @@ -144,7 +144,6 @@ main(int argc, char *argv[]) int options; /* Parser options. */ int show_usage; /* Invalid argument: give up. */ int prio, best_prio; - int startdir; int c; enum mandoc_os os_e; /* Check base system conventions. */ enum outmode outmode; /* According to command line. */ @@ -514,7 +513,7 @@ main(int argc, char *argv[]) if (resnsz == 0) (void)fs_search(&search, &conf.manpath, *argv, &resn, &resnsz); - if (resnsz == 0 && strchr(*argv, '/') == NULL) { + if (resnsz == 0) { if (search.arch != NULL && arch_valid(search.arch, OSENUM) == 0) warnx("Unknown architecture \"%s\".", @@ -529,20 +528,6 @@ main(int argc, char *argv[]) mandoc_msg_setrc(MANDOCLEVEL_BADARG); continue; } - if (resnsz == 0) { - if (access(*argv, R_OK) == -1) { - mandoc_msg_setinfilename(*argv); - mandoc_msg(MANDOCERR_BADARG_BAD, - 0, 0, "%s", strerror(errno)); - mandoc_msg_setinfilename(NULL); - continue; - } - resnsz = 1; - resn = mandoc_calloc(resnsz, sizeof(*res)); - resn->file = mandoc_strdup(*argv); - resn->ipath = SIZE_MAX; - resn->form = FORM_SRC; - } if (outmode != OUTMODE_ONE || resnsz == 1) { res = mandoc_reallocarray(res, ressz + resnsz, sizeof(*res)); @@ -559,7 +544,8 @@ main(int argc, char *argv[]) best_prio = 40; for (ib = i = 0; i < resnsz; i++) { - sec = resn[i].file; + sec = resn[i].file + + strlen(conf.manpath.paths[resn[i].ipath]); sec += strcspn(sec, "123456789"); if (sec[0] == '\0') continue; /* No section at all. */ @@ -647,23 +633,13 @@ main(int argc, char *argv[]) mchars_alloc(); mp = mparse_alloc(options, os_e, os_s); - /* - * Remember the original working directory, if possible. - * This will be needed if some names on the command line - * are page names and some are relative file names. - * Do not error out if the current directory is not - * readable: Maybe it won't be needed after all. - */ - startdir = open(".", O_RDONLY | O_DIRECTORY); for (i = 0; i < ressz; i++) { - process_onefile(mp, res + i, startdir, &outst, &conf); + if (i > 0) + mparse_reset(mp); + process_onefile(mp, res + i, &outst, &conf); if (outst.wstop && mandoc_msg_getrc() != MANDOCLEVEL_OK) break; } - if (startdir != -1) { - (void)fchdir(startdir); - close(startdir); - } if (conf.output.tag != NULL && conf.output.tag_found == 0) { mandoc_msg(MANDOCERR_TAG, 0, 0, "%s", conf.output.tag); conf.output.tag = NULL; @@ -909,7 +885,7 @@ fs_search(const struct mansearch *cfg, const struct manpaths *paths, } static void -process_onefile(struct mparse *mp, struct manpage *resp, int startdir, +process_onefile(struct mparse *mp, struct manpage *resp, struct outstate *outst, struct manconf *conf) { int fd; @@ -921,8 +897,6 @@ process_onefile(struct mparse *mp, struct manpage *resp, int startdir, */ if (resp->ipath != SIZE_MAX) (void)chdir(conf->manpath.paths[resp->ipath]); - else if (startdir != -1) - (void)fchdir(startdir); mandoc_msg_setinfilename(resp->file); if (resp->file != NULL) { @@ -982,18 +956,12 @@ parse(struct mparse *mp, int fd, const char *file, struct outstate *outst, struct manconf *conf) { static struct manpaths basepaths; - static int previous; struct roff_meta *meta; assert(fd >= 0); if (file == NULL) file = "<stdin>"; - if (previous) - mparse_reset(mp); - else - previous = 1; - mparse_readfd(mp, fd, file); if (fd != STDIN_FILENO) close(fd); diff --git a/contrib/mandoc/man.c b/contrib/mandoc/man.c index f651efe3de8b..26846f1cf243 100644 --- a/contrib/mandoc/man.c +++ b/contrib/mandoc/man.c @@ -1,4 +1,4 @@ -/* $Id: man.c,v 1.189 2022/08/16 23:01:09 schwarze Exp $ */ +/* $Id: man.c,v 1.190 2025/08/22 13:17:06 schwarze Exp $ */ /* * Copyright (c) 2013-2015,2017-2019,2022 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> @@ -134,6 +134,7 @@ man_ptext(struct roff_man *man, int line, char *buf, int offs) *ep = '\0'; return 1; } + mandoc_msg(MANDOCERR_FI_BLANK, line, i, NULL); roff_elem_alloc(man, line, offs, ROFF_sp); man->next = ROFF_NEXT_SIBLING; return 1; diff --git a/contrib/mandoc/man.options.1 b/contrib/mandoc/man.options.1 index be65ad98fddc..be101d4b5b62 100644 --- a/contrib/mandoc/man.options.1 +++ b/contrib/mandoc/man.options.1 @@ -1,4 +1,4 @@ -.\" $Id: man.options.1,v 1.8 2025/06/30 00:11:06 schwarze Exp $ +.\" $Id: man.options.1,v 1.9 2025/08/28 13:46:57 schwarze Exp $ .\" .\" Copyright (c) 2017, 2025 Ingo Schwarze <schwarze@openbsd.org> .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: June 30 2025 $ +.Dd $Mdocdate: August 28 2025 $ .Dt MAN.OPTIONS 1 .Os .Sh NAME @@ -39,9 +39,18 @@ .de At5 .At V Pq January 1983 \\$1 .. +.de At8 +.No Version 8 At Pq February 1985 \\$1 +.. .de Bx43 .Bx 4.3 Pq June 1986 \\$1 .. +.de At9 +.No Version 9 At Pq September 1986 \\$1 +.. +.de At10 +.No Version 10 At Pq October 1989 \\$1 +.. .\" option was present in groff-1.01 as contained in 4.3BSD-Net/2 .\" and no mention of it could be found in the ChangeLog, .\" so it's probably older than groff-0.4, where the log started @@ -49,7 +58,7 @@ .No probably before groff-0.4 Pq before July 14, 1990 \\$1 .. .de Eaton -.No Eaton Pq before July 7, 1993; 1990/91? \\$1 +.No Eaton Pq before July 7, 1993; 1990/91?\& \\$1 .. .\" man-1.5e was released on July 11, 1998. .de man15e @@ -399,6 +408,12 @@ do not feed out paper nor stop phototypesetter .br .Nm troff : .At7 +.Pp +.Bq superseded by Fl l +interpret arguments as file names +.br +.Nm man : +.At10 .It Fl G preprocess with .Xr grap 1 @@ -549,6 +564,7 @@ mode .br .Nm man : .Bx4 , +.At10 , .Eaton ; .No POSIX , Ox , Fx , Nx , No man-db , man-1.6 , illumos , Solaris 9-11 .br @@ -720,7 +736,9 @@ specify a page number for the first page output mode .br .Nm man : -.At7 +.At7 , +.At8 , +.At10 .Pp do not create the .Xr whatis 1 @@ -852,6 +870,12 @@ invoke the simultaneous input-output mode of the .rd request .Nm nroff , troff : .At7 .Pp +quick mode: prefer preformatted page if available +.br +.Nm man : +.At8 , +.At10 +.Pp issue no warnings .br .Nm manpath : @@ -1046,6 +1070,8 @@ output mode .Bx 2 Pq May 10, 1979 , .At3 , .At5 , +.At8 , +.At10 , .Eaton ; .Fx , No man-db , man-1.6 , illumos , Solaris 9-11 .br @@ -1162,6 +1188,7 @@ list pathnames .At7 , .At3 , .At5 , +.At8 , .Eaton ; .Ox , Fx , Nx , No man-db , man-1.6 .br diff --git a/contrib/mandoc/mandoc.1 b/contrib/mandoc/mandoc.1 index 8b6fe7d19b1e..0f83bcd53f1b 100644 --- a/contrib/mandoc/mandoc.1 +++ b/contrib/mandoc/mandoc.1 @@ -1,4 +1,4 @@ -.\" $Id: mandoc.1,v 1.272 2025/07/09 13:46:05 schwarze Exp $ +.\" $Id: mandoc.1,v 1.273 2025/08/22 13:17:06 schwarze Exp $ .\" .\" Copyright (c) 2012, 2014-2023, 2025 Ingo Schwarze <schwarze@openbsd.org> .\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> @@ -15,7 +15,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: July 9 2025 $ +.Dd $Mdocdate: August 22 2025 $ .Dt MANDOC 1 .Os .Sh NAME @@ -1002,14 +1002,14 @@ macro that could be represented using or .Ic \&Dx . .It Sy "errnos out of order" -.Pq mdoc, Nx +.Pq mdoc , Nx The .Ic \&Er items in a .Ic \&Bl list are not in alphabetical order. .It Sy "duplicate errno" -.Pq mdoc, Nx +.Pq mdoc , Nx A .Ic \&Bl list contains two consecutive @@ -1150,7 +1150,7 @@ The argument is used as provided anyway. Consider checking whether the file name or the argument need a correction. .It Sy "missing date, using \(dq\(dq" -.Pq mdoc, man +.Pq mdoc , man The document was parsed as .Xr mdoc 7 and it has no @@ -1732,7 +1732,7 @@ or macro contains an opening or closing parenthesis; that's probably wrong, parentheses are added automatically. .It Sy "unknown library name" -.Pq mdoc, not on Ox +.Pq mdoc , not on Ox An .Ic \&Lb macro has an unknown name argument and will be rendered as @@ -1790,7 +1790,7 @@ The last character is mapped to the blank character. .Ss "Warnings related to plain text" .Bl -ohang .It Sy "blank line in fill mode, using .sp" -.Pq mdoc +.Pq mdoc , man The meaning of blank input lines is only well-defined in non-fill mode: In fill mode, line breaks of text input lines are not supposed to be significant. @@ -1800,6 +1800,8 @@ are formatted like requests. To request a paragraph break, use .Ic \&Pp +or +.Ic \&PP instead of a blank line. .It Sy "tab in filled text" .Pq mdoc , man diff --git a/contrib/mandoc/mdoc.7 b/contrib/mandoc/mdoc.7 index 55cc7fae688d..6c2d3568baa6 100644 --- a/contrib/mandoc/mdoc.7 +++ b/contrib/mandoc/mdoc.7 @@ -1,4 +1,4 @@ -.\" $Id: mdoc.7,v 1.299 2025/06/13 16:18:28 schwarze Exp $ +.\" $Id: mdoc.7,v 1.300 2025/08/19 14:08:59 schwarze Exp $ .\" .\" Copyright (c) 2010-2021, 2024, 2025 Ingo Schwarze <schwarze@openbsd.org> .\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> @@ -15,7 +15,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: June 13 2025 $ +.Dd $Mdocdate: August 19 2025 $ .Dt MDOC 7 .Os .Sh NAME @@ -979,7 +979,7 @@ Unless the .Fl compact argument is specified, list entries are separated by vertical space. .Pp -A list must specify one of the following list types: +The following list types are commonly used: .Bl -tag -width 12n -offset indent .It Fl bullet No item heads can be specified, but a bullet will be printed at the head @@ -994,7 +994,14 @@ The .Fl width argument has no effect; instead, the string length of each argument specifies the width of one column. -If the first line of the body of a +The width specification for the last column does not affect formatting. +.Pp +For two-column lists, using +.Fl tag +often results in simpler code, identical terminal output, and better HTML +output, especially when the first column contains short identifiers. +.Pp +For compatibility with legacy documents, if the first line of the body of a .Fl column list is not an .Ic \&It @@ -1016,7 +1023,7 @@ Like except that item heads are not parsed for macro invocations. Most often used in the .Em DIAGNOSTICS -section with error constants in the item heads. +section with error messages in the item heads. .It Fl enum A numbered list. No item heads can be specified. @@ -1024,6 +1031,17 @@ Formatted like .Fl bullet , except that ordinal numbers are used in place of bullets, starting at 1. +.It Fl tag +Item bodies are indented according to the +.Fl width +argument. +When an item head fits inside the indentation, the item body follows +this head on the same output line. +Otherwise, the body starts on the output line following the head. +.El +.Pp +The following list types are rarely useful: +.Bl -tag -width 12n -offset indent .It Fl hang Like .Fl tag , @@ -1050,13 +1068,6 @@ Item bodies start on the line following item heads and are not indented. The .Fl width argument is ignored. -.It Fl tag -Item bodies are indented according to the -.Fl width -argument. -When an item head fits inside the indentation, the item body follows -this head on the same output line. -Otherwise, the body starts on the output line following the head. .El .Pp Lists may be nested within lists and displays. diff --git a/contrib/mandoc/roff_term.c b/contrib/mandoc/roff_term.c index 85d2caeb2749..38321c830013 100644 --- a/contrib/mandoc/roff_term.c +++ b/contrib/mandoc/roff_term.c @@ -1,4 +1,4 @@ -/* $Id: roff_term.c,v 1.26 2025/07/16 14:33:08 schwarze Exp $ */ +/* $Id: roff_term.c,v 1.27 2025/08/21 15:38:51 schwarze Exp $ */ /* * Copyright (c) 2010, 2014, 2015, 2017-2021, 2025 * Ingo Schwarze <schwarze@openbsd.org> diff --git a/contrib/mandoc/term_ps.c b/contrib/mandoc/term_ps.c index 4c6368ca1d1f..91124152d55a 100644 --- a/contrib/mandoc/term_ps.c +++ b/contrib/mandoc/term_ps.c @@ -1,4 +1,4 @@ -/* $Id: term_ps.c,v 1.94 2025/07/18 15:47:18 schwarze Exp $ */ +/* $Id: term_ps.c,v 1.95 2025/09/26 12:17:12 schwarze Exp $ */ /* * Copyright (c) 2014-2017, 2020, 2025 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> @@ -1222,6 +1222,8 @@ ps_endline(struct termp *p) ps_plast(p); ps_pclose(p); + p->viscol = 0; + p->minbl = 0; /* * If we're in the margin, don't try to recalculate our current @@ -1235,8 +1237,6 @@ ps_endline(struct termp *p) /* Left-justify. */ p->ps->pscol = p->ps->left; - p->viscol = 0; - p->minbl = 0; /* If we haven't printed anything, return. */ diff --git a/contrib/ofed/libcxgb4/dev.c b/contrib/ofed/libcxgb4/dev.c index d3c289dad9f2..db728f5627da 100644 --- a/contrib/ofed/libcxgb4/dev.c +++ b/contrib/ofed/libcxgb4/dev.c @@ -144,6 +144,8 @@ static struct ibv_context *c4iw_alloc_context(struct ibv_device *ibdev, context->ibv_ctx.ops = c4iw_ctx_ops; switch (rhp->chip_version) { + case CHELSIO_T7: + PDBG("%s T7/T6/T5/T4 device\n", __FUNCTION__); case CHELSIO_T6: PDBG("%s T6/T5/T4 device\n", __FUNCTION__); case CHELSIO_T5: @@ -429,6 +431,8 @@ static struct verbs_device *cxgb4_driver_init(const char *uverbs_sys_path, strstr(&ibdev[2], "nex") && devnum >= 0) { snprintf(dev_str, sizeof(dev_str), "/dev/t%cnex/%d", ibdev[1], devnum); + } else if (strstr(&ibdev[0], "chnex") && devnum >= 0) { + snprintf(dev_str, sizeof(dev_str), "/dev/chnex/%d", devnum); } else return NULL; @@ -523,7 +527,10 @@ found: goto err; dev->ibv_dev.ops = &c4iw_dev_ops; - dev->chip_version = CHELSIO_CHIP_VERSION(hca_table[i].device >> 8); + if (hca_table[i].device == 0xd000) + dev->chip_version = CHELSIO_T7; + else + dev->chip_version = CHELSIO_CHIP_VERSION(hca_table[i].device >> 8); dev->abi_version = abi_version; PDBG("%s device claimed\n", __FUNCTION__); diff --git a/contrib/ofed/libcxgb4/libcxgb4.h b/contrib/ofed/libcxgb4/libcxgb4.h index b891e8b1df97..216eee05a9d8 100644 --- a/contrib/ofed/libcxgb4/libcxgb4.h +++ b/contrib/ofed/libcxgb4/libcxgb4.h @@ -64,6 +64,11 @@ struct c4iw_dev { int abi_version; }; +static inline int dev_is_t7(struct c4iw_dev *dev) +{ + return dev->chip_version == CHELSIO_T7; +} + static inline int dev_is_t6(struct c4iw_dev *dev) { return dev->chip_version == CHELSIO_T6; diff --git a/contrib/ofed/libcxgb4/t4_chip_type.h b/contrib/ofed/libcxgb4/t4_chip_type.h index 54b718111e3f..ae3b760c51a1 100644 --- a/contrib/ofed/libcxgb4/t4_chip_type.h +++ b/contrib/ofed/libcxgb4/t4_chip_type.h @@ -37,6 +37,7 @@ #define CHELSIO_T4 0x4 #define CHELSIO_T5 0x5 #define CHELSIO_T6 0x6 +#define CHELSIO_T7 0x7 /* We code the Chelsio T4 Family "Chip Code" as a tuple: * @@ -65,6 +66,10 @@ enum chip_type { T6_A0 = CHELSIO_CHIP_CODE(CHELSIO_T6, 0), T6_FIRST_REV = T6_A0, T6_LAST_REV = T6_A0, + + T7_A1 = CHELSIO_CHIP_CODE(CHELSIO_T7, 1), + T7_FIRST_REV = T7_A1, + T7_LAST_REV = T7_A1, }; static inline int is_t4(enum chip_type chip) @@ -82,4 +87,9 @@ static inline int is_t6(enum chip_type chip) return (CHELSIO_CHIP_VERSION(chip) == CHELSIO_T6); } +static inline int is_t7(enum chip_type chip) +{ + return (CHELSIO_CHIP_VERSION(chip) == CHELSIO_T7); +} + #endif /* __T4_CHIP_TYPE_H__ */ diff --git a/contrib/ofed/libcxgb4/t4_pci_id_tbl.h b/contrib/ofed/libcxgb4/t4_pci_id_tbl.h index 50812a1d67bd..0ff7e689dc84 100644 --- a/contrib/ofed/libcxgb4/t4_pci_id_tbl.h +++ b/contrib/ofed/libcxgb4/t4_pci_id_tbl.h @@ -92,8 +92,7 @@ #endif CH_PCI_DEVICE_ID_TABLE_DEFINE_BEGIN - /* T4 adapters: - */ + /* T4 adapters */ CH_PCI_ID_TABLE_FENTRY(0x4000), /* T440-dbg */ CH_PCI_ID_TABLE_FENTRY(0x4001), /* T420-cr */ CH_PCI_ID_TABLE_FENTRY(0x4002), /* T422-cr */ @@ -119,8 +118,7 @@ CH_PCI_DEVICE_ID_TABLE_DEFINE_BEGIN CH_PCI_ID_TABLE_FENTRY(0x4087), /* Custom T440-cr */ CH_PCI_ID_TABLE_FENTRY(0x4088), /* Custom T440 2-xaui, 2-xfi */ - /* T5 adapters: - */ + /* T5 adapters */ CH_PCI_ID_TABLE_FENTRY(0x5000), /* T580-dbg */ CH_PCI_ID_TABLE_FENTRY(0x5001), /* T520-cr */ CH_PCI_ID_TABLE_FENTRY(0x5002), /* T522-cr */ @@ -169,8 +167,7 @@ CH_PCI_DEVICE_ID_TABLE_DEFINE_BEGIN CH_PCI_ID_TABLE_FENTRY(0x509b), /* Custom T540-CR LOM */ CH_PCI_ID_TABLE_FENTRY(0x509c), /* Custom T520-CR*/ - /* T6 adapters: - */ + /* T6 adapters */ CH_PCI_ID_TABLE_FENTRY(0x6001), CH_PCI_ID_TABLE_FENTRY(0x6002), CH_PCI_ID_TABLE_FENTRY(0x6003), @@ -184,6 +181,24 @@ CH_PCI_DEVICE_ID_TABLE_DEFINE_BEGIN CH_PCI_ID_TABLE_FENTRY(0x6011), CH_PCI_ID_TABLE_FENTRY(0x6014), CH_PCI_ID_TABLE_FENTRY(0x6015), + CH_PCI_ID_TABLE_FENTRY(0x6081), + + /* T7 adapters */ + { .vendor = 0x1425, .device = 0xd000 }, /* T7 FPGA */ + CH_PCI_ID_TABLE_FENTRY(0x7000), /* T7-DBG */ + CH_PCI_ID_TABLE_FENTRY(0x7001), /* T7250 */ + CH_PCI_ID_TABLE_FENTRY(0x7002), /* S7250 */ + CH_PCI_ID_TABLE_FENTRY(0x7003), /* T7450 */ + CH_PCI_ID_TABLE_FENTRY(0x7004), /* S7450 */ + CH_PCI_ID_TABLE_FENTRY(0x7005), /* T72200 */ + CH_PCI_ID_TABLE_FENTRY(0x7006), /* S72200 */ + CH_PCI_ID_TABLE_FENTRY(0x7007), /* T72200-FH */ + CH_PCI_ID_TABLE_FENTRY(0x7008), /* T71400 */ + CH_PCI_ID_TABLE_FENTRY(0x7009), /* S7210-BT */ + CH_PCI_ID_TABLE_FENTRY(0x700a), /* T7450-RC */ + CH_PCI_ID_TABLE_FENTRY(0x700b), /* T72200-RC */ + CH_PCI_ID_TABLE_FENTRY(0x700c), /* T72200-FH-RC */ + CH_PCI_ID_TABLE_FENTRY(0x7080), /* Custom */ CH_PCI_DEVICE_ID_TABLE_DEFINE_END; #endif /* __T4_PCI_ID_TBL_H__ */ diff --git a/contrib/tnftp/src/ftp.1 b/contrib/tnftp/src/ftp.1 index 34a88c23520b..e9f09ddca8cc 100644 --- a/contrib/tnftp/src/ftp.1 +++ b/contrib/tnftp/src/ftp.1 @@ -58,7 +58,7 @@ .\" .\" @(#)ftp.1 8.3 (Berkeley) 10/9/94 .\" -.Dd May 10, 2008 +.Dd September 25, 2025 .Dt FTP 1 .Os .Sh NAME @@ -2325,8 +2325,7 @@ for an example of how to make this automatic. .Sh SEE ALSO .Xr getservbyname 3 , .Xr editrc 5 , -.Xr services 5 , -.Xr ftpd 8 +.Xr services 5 .Sh STANDARDS .Nm attempts to be compliant with: diff --git a/contrib/tzcode/localtime.c b/contrib/tzcode/localtime.c index c98134f7be7c..1668475ea646 100644 --- a/contrib/tzcode/localtime.c +++ b/contrib/tzcode/localtime.c @@ -672,26 +672,29 @@ tzloadbody(char const *name, struct state *sp, char tzloadflags, if ((tzloadflags & TZLOAD_FROMENV) && strcmp(name, TZDEFAULT) == 0) tzloadflags &= ~TZLOAD_FROMENV; relname = name; - if (strncmp(relname, TZDIR "/", strlen(TZDIR) + 1) == 0) + if (strncmp(relname, TZDIR "/", strlen(TZDIR) + 1) == 0) { relname += strlen(TZDIR) + 1; - dd = open(TZDIR, O_DIRECTORY | O_RDONLY); + while (*relname == '/') + relname++; + } + dd = open(TZDIR, O_DIRECTORY | O_SEARCH | O_CLOEXEC); if ((tzloadflags & TZLOAD_FROMENV) && issetugid()) { if (dd < 0) return errno; - if (fstatat(dd, name, &sb, AT_RESOLVE_BENEATH) < 0) { + if (fstatat(dd, relname, &sb, AT_RESOLVE_BENEATH) < 0) { fid = -1; } else if (!S_ISREG(sb.st_mode)) { fid = -1; errno = EINVAL; } else { - fid = openat(dd, relname, O_RDONLY | O_BINARY, AT_RESOLVE_BENEATH); + fid = openat(dd, relname, O_RDONLY | O_CLOEXEC | O_RESOLVE_BENEATH); } } else { if (dd < 0) { relname = name; dd = AT_FDCWD; } - fid = openat(dd, relname, O_RDONLY | O_BINARY, 0); + fid = openat(dd, relname, O_RDONLY | O_CLOEXEC); } if (dd != AT_FDCWD && dd >= 0) { serrno = errno; |