From patchwork Wed Nov 6 13:33:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Sakoman X-Patchwork-Id: 52099 X-Patchwork-Delegate: steve@sakoman.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCA74D44D5D for ; Wed, 6 Nov 2024 13:33:36 +0000 (UTC) Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) by mx.groups.io with SMTP id smtpd.web11.45594.1730900011871700561 for ; Wed, 06 Nov 2024 05:33:31 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@sakoman-com.20230601.gappssmtp.com header.s=20230601 header.b=QRhUY9h6; spf=softfail (domain: sakoman.com, ip: 209.85.210.181, mailfrom: steve@sakoman.com) Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-71e953f4e7cso5386791b3a.3 for ; Wed, 06 Nov 2024 05:33:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakoman-com.20230601.gappssmtp.com; s=20230601; t=1730900011; x=1731504811; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=q1s9ZDCOqVnqyU1/yrE1CoOJqaU5FsvoViCfX+w/wYs=; b=QRhUY9h6qd+vtX21bv4PvwFddPxhqqPxL5g3u4rN1LIhw3jjjcjOleVwCMaBsVQjQT xd6p0WATMnqjTBtl21KzFZz3JPPwDk+BCTfZhPWvqkThEacoH7bxStjAyGBw1fJxuifn EmaJNxShiaFEgjCNILTAsrFND7AceGhGGRhIr05iERFhwFMkt5K74fuTBcRfIi/YMh/i 4Zh6AI1QgDM0/STUMGxpHXfEq9hwox7oQuGDjjfRf+KIrBgibmhrX5sqK1IOdMhtEgw0 asXxxCcrrttUMpLHbLrY/etNWXaG5dpcQmHgeYJ7Kf4MCinuxwVbkCs5jJX7yZVq85y6 VUJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730900011; x=1731504811; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=q1s9ZDCOqVnqyU1/yrE1CoOJqaU5FsvoViCfX+w/wYs=; b=kcazx07RF8MGTnj3EVLuQnfhLqKiupw/bTFa98siTubpB3KkrdnfqsgHWNKO28TQ09 2Y5GTsox/UF2b5O17PoWF0xd/iMRLnAl8x65k7bL2L1+B7h1gCzGD8z2Kivv8CbHnxTW qZXG6CfUUaiWeDwM/5t5kg4q3JUg6n2VMmW7b8KjTSE38Ayya2y6z67ix8r7J7xEkG7d X7NZAdgI9FMjOeB7qlWLGHl/4CU+CXYjIkFEE358p5S7Msc3jwdO5hiI/B8QoDAGFR3Q EmboNtnvsRdWLrjpwSzfnhsJ5hYNmTAQ57xPAJRRjG3jcSC1F5EKCapMvjUvHw2to6wn kpGQ== X-Gm-Message-State: AOJu0YyKZlEqydbdyOxXzWmhN3QUOAO+wlMMl457fzLWUV0rICaAYQ2R IJ8IKgXreIXbsQhqS3SDg7CQSAEUnrisaJB/7XOkMSFGGGhCPfyBjdgxCboRhm6cRwlUInMDxPF m X-Google-Smtp-Source: AGHT+IGTntwzWANLkoJL1nQz+nglAa/bVMniOunoYHHXGc5YDMtkRiaSZWOTOOp1csYT4q145ruxpA== X-Received: by 2002:a05:6a00:228d:b0:714:1d96:e6bd with SMTP id d2e1a72fcca58-720c98d200amr28527179b3a.13.1730900010809; Wed, 06 Nov 2024 05:33:30 -0800 (PST) Received: from hexa.. ([98.142.47.158]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-720bc1e5722sm11631717b3a.71.2024.11.06.05.33.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Nov 2024 05:33:30 -0800 (PST) From: Steve Sakoman To: openembedded-core@lists.openembedded.org Subject: [OE-core][kirkstone 1/5] zstd: patch CVE-2022-4899 Date: Wed, 6 Nov 2024 05:33:18 -0800 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 06 Nov 2024 13:33:36 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/206768 From: Peter Marko Pick commits from [1] linked from [2] via [3]. [1] https://github.com/facebook/zstd/pull/3220 [2] https://nvd.nist.gov/vuln/detail/CVE-2022-4899 [3] https://github.com/facebook/zstd/issues/3200 Signed-off-by: Peter Marko Signed-off-by: Steve Sakoman --- .../zstd/zstd/CVE-2022-4899-1.patch | 66 +++++++++++++++ .../zstd/zstd/CVE-2022-4899-2.patch | 83 +++++++++++++++++++ meta/recipes-extended/zstd/zstd_1.5.2.bb | 5 +- 3 files changed, 153 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-extended/zstd/zstd/CVE-2022-4899-1.patch create mode 100644 meta/recipes-extended/zstd/zstd/CVE-2022-4899-2.patch diff --git a/meta/recipes-extended/zstd/zstd/CVE-2022-4899-1.patch b/meta/recipes-extended/zstd/zstd/CVE-2022-4899-1.patch new file mode 100644 index 0000000000..c21aae7cb1 --- /dev/null +++ b/meta/recipes-extended/zstd/zstd/CVE-2022-4899-1.patch @@ -0,0 +1,66 @@ +From e1873ad576cb478fff0e6e44ad99599cd5fd2846 Mon Sep 17 00:00:00 2001 +From: Elliot Gorokhovsky +Date: Fri, 29 Jul 2022 11:10:47 -0700 +Subject: [PATCH 1/2] Fix buffer underflow for null dir1 + +CVE: CVE-2022-4899 +Upstream-Status: Backport [https://github.com/facebook/zstd/pull/3220/commits/e1873ad576cb478fff0e6e44ad99599cd5fd2846] +Signed-off-by: Peter Marko +--- + programs/util.c | 38 +++++++++++++++++++------------------- + 1 file changed, 19 insertions(+), 19 deletions(-) + +diff --git a/programs/util.c b/programs/util.c +index f53eb03fbe..b874344c4d 100644 +--- a/programs/util.c ++++ b/programs/util.c +@@ -870,30 +870,30 @@ static const char * trimPath(const char *pathname) + + static char* mallocAndJoin2Dir(const char *dir1, const char *dir2) + { +- const size_t dir1Size = strlen(dir1); +- const size_t dir2Size = strlen(dir2); +- char *outDirBuffer, *buffer, trailingChar; +- + assert(dir1 != NULL && dir2 != NULL); +- outDirBuffer = (char *) malloc(dir1Size + dir2Size + 2); +- CONTROL(outDirBuffer != NULL); ++ { const size_t dir1Size = strlen(dir1); ++ const size_t dir2Size = strlen(dir2); ++ char *outDirBuffer, *buffer; + +- memcpy(outDirBuffer, dir1, dir1Size); +- outDirBuffer[dir1Size] = '\0'; ++ outDirBuffer = (char *) malloc(dir1Size + dir2Size + 2); ++ CONTROL(outDirBuffer != NULL); + +- if (dir2[0] == '.') +- return outDirBuffer; ++ memcpy(outDirBuffer, dir1, dir1Size); ++ outDirBuffer[dir1Size] = '\0'; + +- buffer = outDirBuffer + dir1Size; +- trailingChar = *(buffer - 1); +- if (trailingChar != PATH_SEP) { +- *buffer = PATH_SEP; +- buffer++; +- } +- memcpy(buffer, dir2, dir2Size); +- buffer[dir2Size] = '\0'; ++ if (dir2[0] == '.') ++ return outDirBuffer; + +- return outDirBuffer; ++ buffer = outDirBuffer + dir1Size; ++ if (dir1Size > 0 && *(buffer - 1) != PATH_SEP) { ++ *buffer = PATH_SEP; ++ buffer++; ++ } ++ memcpy(buffer, dir2, dir2Size); ++ buffer[dir2Size] = '\0'; ++ ++ return outDirBuffer; ++ } + } + + /* this function will return NULL if input srcFileName is not valid name for mirrored output path */ diff --git a/meta/recipes-extended/zstd/zstd/CVE-2022-4899-2.patch b/meta/recipes-extended/zstd/zstd/CVE-2022-4899-2.patch new file mode 100644 index 0000000000..15dcda5ddc --- /dev/null +++ b/meta/recipes-extended/zstd/zstd/CVE-2022-4899-2.patch @@ -0,0 +1,83 @@ +From f9f27de91c89d826c6a39c3ef44fb1b02f9a43aa Mon Sep 17 00:00:00 2001 +From: Elliot Gorokhovsky +Date: Fri, 29 Jul 2022 14:44:22 -0700 +Subject: [PATCH 2/2] Disallow empty output directory + +CVE: CVE-2022-4899 +Upstream-Status: Backport [https://github.com/facebook/zstd/pull/3220/commits/f9f27de91c89d826c6a39c3ef44fb1b02f9a43aa] +Signed-off-by: Peter Marko +--- + programs/zstdcli.c | 18 ++++++++++++++++-- + tests/cli-tests/basic/output_dir.sh | 7 +++++++ + .../cli-tests/basic/output_dir.sh.stderr.exact | 2 ++ + .../cli-tests/basic/output_dir.sh.stdout.exact | 2 ++ + 4 files changed, 27 insertions(+), 2 deletions(-) + create mode 100755 tests/cli-tests/basic/output_dir.sh + create mode 100644 tests/cli-tests/basic/output_dir.sh.stderr.exact + create mode 100644 tests/cli-tests/basic/output_dir.sh.stdout.exact + +diff --git a/programs/zstdcli.c b/programs/zstdcli.c +index fbacb908a9..1143ac3fe8 100644 +--- a/programs/zstdcli.c ++++ b/programs/zstdcli.c +@@ -990,7 +990,14 @@ int main(int argCount, const char* argv[]) + if (longCommandWArg(&argument, "--stream-size=")) { streamSrcSize = readSizeTFromChar(&argument); continue; } + if (longCommandWArg(&argument, "--target-compressed-block-size=")) { targetCBlockSize = readSizeTFromChar(&argument); continue; } + if (longCommandWArg(&argument, "--size-hint=")) { srcSizeHint = readSizeTFromChar(&argument); continue; } +- if (longCommandWArg(&argument, "--output-dir-flat")) { NEXT_FIELD(outDirName); continue; } ++ if (longCommandWArg(&argument, "--output-dir-flat")) { ++ NEXT_FIELD(outDirName); ++ if (strlen(outDirName) == 0) { ++ DISPLAY("error: output dir cannot be empty string (did you mean to pass '.' instead?)\n"); ++ CLEAN_RETURN(1); ++ } ++ continue; ++ } + #ifdef ZSTD_MULTITHREAD + if (longCommandWArg(&argument, "--auto-threads")) { + const char* threadDefault = NULL; +@@ -1001,7 +1008,14 @@ int main(int argCount, const char* argv[]) + } + #endif + #ifdef UTIL_HAS_MIRRORFILELIST +- if (longCommandWArg(&argument, "--output-dir-mirror")) { NEXT_FIELD(outMirroredDirName); continue; } ++ if (longCommandWArg(&argument, "--output-dir-mirror")) { ++ NEXT_FIELD(outMirroredDirName); ++ if (strlen(outMirroredDirName) == 0) { ++ DISPLAY("error: output dir cannot be empty string (did you mean to pass '.' instead?)\n"); ++ CLEAN_RETURN(1); ++ } ++ continue; ++ } + #endif + #ifndef ZSTD_NOTRACE + if (longCommandWArg(&argument, "--trace")) { char const* traceFile; NEXT_FIELD(traceFile); TRACE_enable(traceFile); continue; } +diff --git a/tests/cli-tests/basic/output_dir.sh b/tests/cli-tests/basic/output_dir.sh +new file mode 100755 +index 0000000000..a8819d2926 +--- /dev/null ++++ b/tests/cli-tests/basic/output_dir.sh +@@ -0,0 +1,7 @@ ++#!/bin/sh ++ ++println "+ zstd -r * --output-dir-mirror=\"\"" ++zstd -r * --output-dir-mirror="" && die "Should not allow empty output dir!" ++println "+ zstd -r * --output-dir-flat=\"\"" ++zstd -r * --output-dir-flat="" && die "Should not allow empty output dir!" ++exit 0 +diff --git a/tests/cli-tests/basic/output_dir.sh.stderr.exact b/tests/cli-tests/basic/output_dir.sh.stderr.exact +new file mode 100644 +index 0000000000..e12b50427c +--- /dev/null ++++ b/tests/cli-tests/basic/output_dir.sh.stderr.exact +@@ -0,0 +1,2 @@ ++error: output dir cannot be empty string (did you mean to pass '.' instead?) ++error: output dir cannot be empty string (did you mean to pass '.' instead?) +diff --git a/tests/cli-tests/basic/output_dir.sh.stdout.exact b/tests/cli-tests/basic/output_dir.sh.stdout.exact +new file mode 100644 +index 0000000000..1e478cd753 +--- /dev/null ++++ b/tests/cli-tests/basic/output_dir.sh.stdout.exact +@@ -0,0 +1,2 @@ +++ zstd -r * --output-dir-mirror="" +++ zstd -r * --output-dir-flat="" diff --git a/meta/recipes-extended/zstd/zstd_1.5.2.bb b/meta/recipes-extended/zstd/zstd_1.5.2.bb index 591e823049..63bf0d3fb9 100644 --- a/meta/recipes-extended/zstd/zstd_1.5.2.bb +++ b/meta/recipes-extended/zstd/zstd_1.5.2.bb @@ -9,7 +9,10 @@ LICENSE = "BSD-3-Clause | GPL-2.0-only" LIC_FILES_CHKSUM = "file://LICENSE;md5=c7f0b161edbe52f5f345a3d1311d0b32 \ file://COPYING;md5=39bba7d2cf0ba1036f2a6e2be52fe3f0" -SRC_URI = "git://github.com/facebook/zstd.git;branch=release;protocol=https" +SRC_URI = "git://github.com/facebook/zstd.git;branch=release;protocol=https \ + file://CVE-2022-4899-1.patch \ + file://CVE-2022-4899-2.patch \ +" SRCREV = "e47e674cd09583ff0503f0f6defd6d23d8b718d3" UPSTREAM_CHECK_GITTAGREGEX = "v(?P\d+(\.\d+)+)" From patchwork Wed Nov 6 13:33:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Sakoman X-Patchwork-Id: 52095 X-Patchwork-Delegate: steve@sakoman.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBDD4D44D5C for ; Wed, 6 Nov 2024 13:33:36 +0000 (UTC) Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) by mx.groups.io with SMTP id smtpd.web10.45793.1730900013393516862 for ; Wed, 06 Nov 2024 05:33:33 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@sakoman-com.20230601.gappssmtp.com header.s=20230601 header.b=a4UvitF5; spf=softfail (domain: sakoman.com, ip: 209.85.210.181, mailfrom: steve@sakoman.com) Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-71e8235f0b6so5839856b3a.3 for ; Wed, 06 Nov 2024 05:33:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakoman-com.20230601.gappssmtp.com; s=20230601; t=1730900013; x=1731504813; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=rr7tIhLiX/gO3UTwoxE/y9ZNlewEJUTjwaoRNEJpiUk=; b=a4UvitF59uAuexnhREG7lYua122JSmgKppzfOqyxY689zG1Df7+3pBzv06hDZj1cDm ICovsEz3EfUh7SerisL7FG2exu9AKo+9VpDSq2IaBqBDBAUSSLiC3B/UFU18UJrBguDU dfeFkqwQFE8ibsKkP/iWRplzbsaq8rI9/I45jQnVIStjG0Dbkm0oSd+dydS1hn7ezR62 KGzX01mnNUeQFKU2spF6AjqSUarrX/qXKmeDDhbVacMFDW3e62l7KxNLqxjVMdqyMCzJ Ewr6NWalohXyDKTlMBtFDP6mNaGQxLXt5bzw576GGw5hZ48czvtdAeAMOwa+qy5XgsaJ Hv4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730900013; x=1731504813; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rr7tIhLiX/gO3UTwoxE/y9ZNlewEJUTjwaoRNEJpiUk=; b=Zj8l0t4lw/dGzwvV/mGlvUSs00jBOpsY3QVinkC2HnM/QpqFkuQ3gBPu04yTZu+I/+ QldJtmkwvJeAfbxuCah1ega/pVftuglqPjuNn2z9h19tZnEnNl7gKZePlA7byCodJBX0 gMUqr+dVzWZNg8f/0H2Y+3Wftg6qU0ZY6GsTI/jI3ZOEDoGkCZpGuIGhLPs9HBPOGjQ0 hV0Q+g2mPgflPMdRRSlAPVNpWjKYmEoP/aN9hFXZynyBKxJqHA9LQIjn+BtIv0KmcSif 9DuB5PN6iOHPqfwkglBmqsTHh0Bqx3RdxJkKEoatz46IAQibPTHwOLKEVDvErAbGFW8w Zwuw== X-Gm-Message-State: AOJu0YxQsqWp5D3As6WCMaNucFHXvTLLeHnTuvK5v6tSWMSb0NQwTN7a Mdhl0Ldcpml3VqCVcDddX5t5H+NhTXlTgWLayQtjffejh+7RLqs0LSQIn2WMGIdUDE+NwgVFZyw h X-Google-Smtp-Source: AGHT+IGccxYKgnf3eM6bk7p9qhP2sEgyEKvPj3lQ1zylLWkMWCgv97B7iNgXEI0GmlQmDIlXL7JFVQ== X-Received: by 2002:a05:6a20:4325:b0:1db:ff5a:23e5 with SMTP id adf61e73a8af0-1dbff5a23eamr4199930637.4.1730900012583; Wed, 06 Nov 2024 05:33:32 -0800 (PST) Received: from hexa.. ([98.142.47.158]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-720bc1e5722sm11631717b3a.71.2024.11.06.05.33.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Nov 2024 05:33:32 -0800 (PST) From: Steve Sakoman To: openembedded-core@lists.openembedded.org Subject: [OE-core][kirkstone 2/5] cve_check: Use a local copy of the database during builds Date: Wed, 6 Nov 2024 05:33:19 -0800 Message-Id: <9b6363994e5715f1d08b98956befd8915c128e85.1730899830.git.steve@sakoman.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 06 Nov 2024 13:33:36 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/206769 From: Richard Purdie Rtaher than trying to use a sqlite database over NFS from DL_DIR, work from a local copy in STAGING DIR after fetching. Signed-off-by: Richard Purdie (cherry picked from commit 03596904392d257572a905a182b92c780d636744) Signed-off-by: Steve Sakoman --- meta/classes/cve-check.bbclass | 7 ++++--- .../meta/cve-update-nvd2-native.bb | 18 +++++++++++++----- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/meta/classes/cve-check.bbclass b/meta/classes/cve-check.bbclass index dd9847f366..ac13b0a863 100644 --- a/meta/classes/cve-check.bbclass +++ b/meta/classes/cve-check.bbclass @@ -25,8 +25,9 @@ CVE_PRODUCT ??= "${BPN}" CVE_VERSION ??= "${PV}" -CVE_CHECK_DB_DIR ?= "${DL_DIR}/CVE_CHECK" -CVE_CHECK_DB_FILE ?= "${CVE_CHECK_DB_DIR}/nvdcve_2-2.db" +CVE_CHECK_DB_FILENAME ?= "nvdcve_2-2.db" +CVE_CHECK_DB_DIR ?= "${STAGING_DIR}/CVE_CHECK" +CVE_CHECK_DB_FILE ?= "${CVE_CHECK_DB_DIR}/${CVE_CHECK_DB_FILENAME}" CVE_CHECK_DB_FILE_LOCK ?= "${CVE_CHECK_DB_FILE}.lock" CVE_CHECK_LOG ?= "${T}/cve.log" @@ -157,7 +158,7 @@ python do_cve_check () { } addtask cve_check before do_build -do_cve_check[depends] = "cve-update-nvd2-native:do_fetch" +do_cve_check[depends] = "cve-update-nvd2-native:do_unpack" do_cve_check[nostamp] = "1" python cve_check_cleanup () { diff --git a/meta/recipes-core/meta/cve-update-nvd2-native.bb b/meta/recipes-core/meta/cve-update-nvd2-native.bb index b4c46ef756..dc742df06d 100644 --- a/meta/recipes-core/meta/cve-update-nvd2-native.bb +++ b/meta/recipes-core/meta/cve-update-nvd2-native.bb @@ -8,7 +8,6 @@ INHIBIT_DEFAULT_DEPS = "1" inherit native -deltask do_unpack deltask do_patch deltask do_configure deltask do_compile @@ -35,7 +34,9 @@ CVE_DB_INCR_UPDATE_AGE_THRES ?= "10368000" # Number of attempts for each http query to nvd server before giving up CVE_DB_UPDATE_ATTEMPTS ?= "5" -CVE_DB_TEMP_FILE ?= "${CVE_CHECK_DB_DIR}/temp_nvdcve_2.db" +CVE_CHECK_DB_DLDIR_FILE ?= "${DL_DIR}/CVE_CHECK/${CVE_CHECK_DB_FILENAME}" +CVE_CHECK_DB_DLDIR_LOCK ?= "${CVE_CHECK_DB_DLDIR_FILE}.lock" +CVE_CHECK_DB_TEMP_FILE ?= "${CVE_CHECK_DB_FILE}.tmp" python () { if not bb.data.inherits_class("cve-check", d): @@ -52,9 +53,9 @@ python do_fetch() { bb.utils.export_proxies(d) - db_file = d.getVar("CVE_CHECK_DB_FILE") + db_file = d.getVar("CVE_CHECK_DB_DLDIR_FILE") db_dir = os.path.dirname(db_file) - db_tmp_file = d.getVar("CVE_DB_TEMP_FILE") + db_tmp_file = d.getVar("CVE_CHECK_DB_TEMP_FILE") cleanup_db_download(db_file, db_tmp_file) # By default let's update the whole database (since time 0) @@ -77,6 +78,7 @@ python do_fetch() { pass bb.utils.mkdirhier(db_dir) + bb.utils.mkdirhier(os.path.dirname(db_tmp_file)) if os.path.exists(db_file): shutil.copy2(db_file, db_tmp_file) @@ -89,10 +91,16 @@ python do_fetch() { os.remove(db_tmp_file) } -do_fetch[lockfiles] += "${CVE_CHECK_DB_FILE_LOCK}" +do_fetch[lockfiles] += "${CVE_CHECK_DB_DLDIR_LOCK}" do_fetch[file-checksums] = "" do_fetch[vardeps] = "" +python do_unpack() { + import shutil + shutil.copyfile(d.getVar("CVE_CHECK_DB_DLDIR_FILE"), d.getVar("CVE_CHECK_DB_FILE")) +} +do_unpack[lockfiles] += "${CVE_CHECK_DB_DLDIR_LOCK} ${CVE_CHECK_DB_FILE_LOCK}" + def cleanup_db_download(db_file, db_tmp_file): """ Cleanup the download space from possible failed downloads From patchwork Wed Nov 6 13:33:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Sakoman X-Patchwork-Id: 52098 X-Patchwork-Delegate: steve@sakoman.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9640D44D5E for ; Wed, 6 Nov 2024 13:33:36 +0000 (UTC) Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by mx.groups.io with SMTP id smtpd.web10.45794.1730900014991116315 for ; Wed, 06 Nov 2024 05:33:35 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@sakoman-com.20230601.gappssmtp.com header.s=20230601 header.b=CpyVdgBZ; spf=softfail (domain: sakoman.com, ip: 209.85.210.178, mailfrom: steve@sakoman.com) Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-71e52582cf8so5786723b3a.2 for ; Wed, 06 Nov 2024 05:33:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakoman-com.20230601.gappssmtp.com; s=20230601; t=1730900014; x=1731504814; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=8c+s+3W+0NpknorBHlFgNUbWnfK2UgFBIx5RGBcHAsU=; b=CpyVdgBZ5MIBU02jtc5gc6iDD8jDS0JSIM+ZQCdIt0QuFzFOEbFmpgdhaqbt0CiJmc MDLvgZuLS1vrUhYXi/9K7QVtzZftpwztXH5/mdNxGcT5ujgXK+/IFsQG1xu4b/WSZg5G 8PI38xlCURmMhRA5h9ZXVHTAJtZ3lP6H0PkuXB+rfU0v6bJ18zzLwOZku/NkcWkXPWtr f4lEZOS+T3QL2bg1DXGvhh/Y+1YZbu0zWhblW+iIdh7UiZWTuPBb212df51WFqtd+j5S 9wrchT6Unr05V3L4uTUW03qofuRG4mc7daRqXlTUgU1ddMnCO0n+n1Krafyp8MUNH/Ku F1Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730900014; x=1731504814; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8c+s+3W+0NpknorBHlFgNUbWnfK2UgFBIx5RGBcHAsU=; b=AyFjAf0BhdEAOM6IbUXK12Fbf06PK82Di4zS297Ay41wtRdwCMcunhRuiRV8NAcAaC tPs9CtDuBHPxeMPR7tpc2Dk3bv6ZgBLW7GuhU0h8dONrHgIF5UCyh3PtZw837k8Wn+c2 dyGB1jxI+XGIgWvx3+4KvnT+Tyrt756SpEZa1rplmeUPGSxs30HyoyDEng5FuYBqsEL5 gLIvr7FzGTzMy39F5k0DFeI0NXY0c9rc2KbRbbYMaHjKGKMe+LaEuvtHedLDN7aJMVTP LblCel9ReQhp9Vb+ipcf5aH/67glffVwsf3jr01VvKzZ34Q+fP/g2+VobLKxdak+ISYR gqDA== X-Gm-Message-State: AOJu0YzzTEChV9bAzCeEbGcroK5yrvcBorPNA7Lb5OYA/QgdD54v27oZ X11pic6MI6texSMcNMayA7O5VxVxt4p+C1yv3Toyv2CdRwvNQnpVmB6gEEupamCQKWmcRkNGHnH 8 X-Google-Smtp-Source: AGHT+IHUxLC3xEGq6UdvFlBBmz/3je57EYlnIReB/GI0Eb/+rJR+RwsdTB2OMM0jL0GDLpQlur62mA== X-Received: by 2002:a05:6a00:808:b0:71d:ee1b:c854 with SMTP id d2e1a72fcca58-720c98d1ff4mr29172603b3a.9.1730900014130; Wed, 06 Nov 2024 05:33:34 -0800 (PST) Received: from hexa.. ([98.142.47.158]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-720bc1e5722sm11631717b3a.71.2024.11.06.05.33.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Nov 2024 05:33:33 -0800 (PST) From: Steve Sakoman To: openembedded-core@lists.openembedded.org Subject: [OE-core][kirkstone 3/5] gcc: restore a patch for Neoverse N2 core Date: Wed, 6 Nov 2024 05:33:20 -0800 Message-Id: <4c75edda8ec28fb8dee19ca90a1ea7f33ba80999.1730899830.git.steve@sakoman.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 06 Nov 2024 13:33:36 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/206770 From: Ruiqiang Hao Commit 7806e21e7d47 ("gcc: upgrade to v11.5") removed one patch named 0001-aarch64-Update-Neoverse-N2-core-defini.patch by mistake, this will cause the Neoverse N2 core to be identified as the armv8.5 architecture, restore this patch to avoid related compilation issues. Signed-off-by: Ruiqiang Hao Signed-off-by: Steve Sakoman --- meta/recipes-devtools/gcc/gcc-11.5.inc | 1 + ...4-Update-Neoverse-N2-core-definition.patch | 40 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 meta/recipes-devtools/gcc/gcc/0001-aarch64-Update-Neoverse-N2-core-definition.patch diff --git a/meta/recipes-devtools/gcc/gcc-11.5.inc b/meta/recipes-devtools/gcc/gcc-11.5.inc index 5d29b8e61e..f17ec9da5c 100644 --- a/meta/recipes-devtools/gcc/gcc-11.5.inc +++ b/meta/recipes-devtools/gcc/gcc-11.5.inc @@ -65,6 +65,7 @@ SRC_URI = "\ file://0003-CVE-2021-42574.patch \ file://0004-CVE-2021-42574.patch \ file://0001-CVE-2021-46195.patch \ + file://0001-aarch64-Update-Neoverse-N2-core-definition.patch \ file://0002-aarch64-add-armv9-a-to-march.patch \ file://0003-aarch64-Enable-FP16-feature-by-default-for-Armv9.patch \ file://0004-arm-add-armv9-a-architecture-to-march.patch \ diff --git a/meta/recipes-devtools/gcc/gcc/0001-aarch64-Update-Neoverse-N2-core-definition.patch b/meta/recipes-devtools/gcc/gcc/0001-aarch64-Update-Neoverse-N2-core-definition.patch new file mode 100644 index 0000000000..4159042ebb --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc/0001-aarch64-Update-Neoverse-N2-core-definition.patch @@ -0,0 +1,40 @@ +From 30ade014c7b7d22a2a26697b5a2079a278ea560d Mon Sep 17 00:00:00 2001 +From: Andre Vieira +Date: Thu, 8 Sep 2022 06:02:18 +0000 +Subject: [PATCH] aarch64: Update Neoverse N2 core definition + +commit 9f37d31324f89d0b7b2abac988a976d121ae29c6 from upstream. + +gcc/ChangeLog: + + * config/aarch64/aarch64-cores.def: Update Neoverse N2 core entry. + +Upstream-Status: Backport +Signed-off-by: Ruiqiang Hao +--- + gcc/config/aarch64/aarch64-cores.def | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/gcc/config/aarch64/aarch64-cores.def b/gcc/config/aarch64/aarch64-cores.def +index 0243e3d4d..722f3e64e 100644 +--- a/gcc/config/aarch64/aarch64-cores.def ++++ b/gcc/config/aarch64/aarch64-cores.def +@@ -147,7 +147,6 @@ AARCH64_CORE("neoverse-512tvb", neoverse512tvb, cortexa57, 8_4A, AARCH64_FL_FOR + AARCH64_CORE("saphira", saphira, saphira, 8_4A, AARCH64_FL_FOR_ARCH8_4 | AARCH64_FL_CRYPTO, saphira, 0x51, 0xC01, -1) + + /* Armv8.5-A Architecture Processors. */ +-AARCH64_CORE("neoverse-n2", neoversen2, cortexa57, 8_5A, AARCH64_FL_FOR_ARCH8_5 | AARCH64_FL_I8MM | AARCH64_FL_BF16 | AARCH64_FL_F16 | AARCH64_FL_SVE | AARCH64_FL_SVE2 | AARCH64_FL_SVE2_BITPERM | AARCH64_FL_RNG | AARCH64_FL_MEMTAG, neoversen2, 0x41, 0xd49, -1) + AARCH64_CORE("cobalt-100", cobalt100, cortexa57, 8_5A, AARCH64_FL_FOR_ARCH8_5 | AARCH64_FL_I8MM | AARCH64_FL_BF16 | AARCH64_FL_F16 | AARCH64_FL_SVE | AARCH64_FL_SVE2 | AARCH64_FL_SVE2_BITPERM | AARCH64_FL_RNG | AARCH64_FL_MEMTAG, neoversen2, 0x6d, 0xd49, -1) + AARCH64_CORE("neoverse-v2", neoversev2, cortexa57, 8_5A, AARCH64_FL_FOR_ARCH8_5 | AARCH64_FL_I8MM | AARCH64_FL_BF16 | AARCH64_FL_F16 | AARCH64_FL_SVE | AARCH64_FL_SVE2 | AARCH64_FL_SVE2_BITPERM | AARCH64_FL_RNG | AARCH64_FL_MEMTAG, neoverse512tvb, 0x41, 0xd4f, -1) + AARCH64_CORE("grace", grace, cortexa57, 8_5A, AARCH64_FL_FOR_ARCH8_5 | AARCH64_FL_I8MM | AARCH64_FL_BF16 | AARCH64_FL_F16 | AARCH64_FL_CRYPTO | AARCH64_FL_SHA3 | AARCH64_FL_SM4 | AARCH64_FL_SVE | AARCH64_FL_SVE2 | AARCH64_FL_SVE2_BITPERM | AARCH64_FL_SVE2_AES | AARCH64_FL_SVE2_SM4 | AARCH64_FL_SVE2_SHA3, neoverse512tvb, 0x41, 0xd4f, -1) +@@ -167,4 +166,7 @@ AARCH64_CORE("cortex-a76.cortex-a55", cortexa76cortexa55, cortexa53, 8_2A, AAR + /* Armv8-R Architecture Processors. */ + AARCH64_CORE("cortex-r82", cortexr82, cortexa53, 8R, AARCH64_FL_FOR_ARCH8_R, cortexa53, 0x41, 0xd15, -1) + ++/* Armv9-A Architecture Processors. */ ++AARCH64_CORE("neoverse-n2", neoversen2, cortexa57, 9A, AARCH64_FL_FOR_ARCH9 | AARCH64_FL_I8MM | AARCH64_FL_BF16 | AARCH64_FL_F16 | AARCH64_FL_SVE | AARCH64_FL_SVE2 | AARCH64_FL_SVE2_BITPERM | AARCH64_FL_RNG | AARCH64_FL_MEMTAG | AARCH64_FL_PROFILE, neoversen2, 0x41, 0xd49, -1) ++ + #undef AARCH64_CORE +-- +2.46.2 + From patchwork Wed Nov 6 13:33:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Sakoman X-Patchwork-Id: 52097 X-Patchwork-Delegate: steve@sakoman.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id D96E1D44D62 for ; Wed, 6 Nov 2024 13:33:36 +0000 (UTC) Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by mx.groups.io with SMTP id smtpd.web10.45795.1730900016411439451 for ; Wed, 06 Nov 2024 05:33:36 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@sakoman-com.20230601.gappssmtp.com header.s=20230601 header.b=ORhA8ob3; spf=softfail (domain: sakoman.com, ip: 209.85.210.175, mailfrom: steve@sakoman.com) Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-71e3fce4a60so5397555b3a.0 for ; Wed, 06 Nov 2024 05:33:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakoman-com.20230601.gappssmtp.com; s=20230601; t=1730900016; x=1731504816; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=v3oa+z62HQFmGI0AbYcWvdSeQdoiXEEThnbJi5iViao=; b=ORhA8ob3tMAO9sxgzGmxC1FGD17DhzbTWfD219ov1g/TBOx2ubVxVXBDWq9KOSdyAo Fxk+SQ+sXHTB0NQ0QzMDUXmaPByTo2EpqU84qCJNVH9vMXCJDSN8wZ2NBpIxkm7U1JL2 6ESqxS0Bpf+h9YRkiolMBR8/PYvaTM4Lk9QuZK8rna5KESX2JonFzvMN4ObmXX2xUWJM mAHXAkjVczru5+ujfw+XqhZ4CPR6kp2scetKbRlNC6TUlrqeAtKenIEXtHyqjD3x04d2 o1P1n1D/aa7SdceqGkFtt6Rtf5ygiDb5YJ4yxGfAd3B9WL/z2Fnr4O1Fx2N769C9CR/y JrmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730900016; x=1731504816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=v3oa+z62HQFmGI0AbYcWvdSeQdoiXEEThnbJi5iViao=; b=A2TVe8334jdy9BAiVFpTh+fTGNPCy9zCN0PHHGhkNdnKVxe0z/CpCHjX+5WGy5Gzh1 IV0kqy8knS242FStragJXS9IFPakE6bSvgYcgwPvtkfdrYhuFF6ZLHOn8+Y67auhE1zv 1yhAIS4Rz1yvhdiM9YXCZeUb/er7U7vvk0qlPoxyQ7N1lajcGoQSaMWEQ0DhdsmBhKH9 oLUUeWorm7ALG7QnLqffyPDaR9xmPsndKOJnr+C5rB6uOv12HR3h/Ewu9QkFd3mXirww sH4VQG4gE3dAeWlV5EQnmfOyy6UTpEhnsMFDBecUSXl5+5uKStU5aOIFzRX6sCUDrBUs iaXg== X-Gm-Message-State: AOJu0Yws5vTh42Gb1xYB7DARFo188tsj+Brs0jw9Evr/I04q2+0GcX+k i1O+7lEga2jrhlnOXN3kHuQuZISnzQwj2aMm3xE9K2VXHRX/DqEOH75nN1idwOMlp3b1pt964Wa Q X-Google-Smtp-Source: AGHT+IFczEOnnsqvr2o+o5W0+xLq9k1mxvj6SYCQrro97/r/O9zP+IoGsZmeXv89WWk7ZnIJUPAq/Q== X-Received: by 2002:a05:6a20:c998:b0:1d5:1354:5256 with SMTP id adf61e73a8af0-1d9a84d9806mr55108657637.39.1730900015632; Wed, 06 Nov 2024 05:33:35 -0800 (PST) Received: from hexa.. ([98.142.47.158]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-720bc1e5722sm11631717b3a.71.2024.11.06.05.33.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Nov 2024 05:33:35 -0800 (PST) From: Steve Sakoman To: openembedded-core@lists.openembedded.org Subject: [OE-core][kirkstone 4/5] package: Switch debug source handling to use prefix map Date: Wed, 6 Nov 2024 05:33:21 -0800 Message-Id: <80289f49d0c5ca98da1d1558728b8a468aab4326.1730899830.git.steve@sakoman.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 06 Nov 2024 13:33:36 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/206771 From: Richard Purdie Reproducible builds are no longer a configuration option but are required. We also rely on the prefix mapping capability of the compilers now. As such, rewrite the source locating code to use the prefix maps instead of taking a guess about WORKDIR which isn't correct for kernels, gcc, externalsrc and probably more. Instead, iterate the maps to locate any matching source code, keeping in mind that multiple maps may map to one target location. Signed-off-by: Richard Purdie (cherry picked from commit cbd6144a9769d21371ae0fe04db2adc05f6eed02) Signed-off-by: Steve Sakoman --- meta/classes/package.bbclass | 68 +++++++++++++++--------------------- 1 file changed, 28 insertions(+), 40 deletions(-) diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass index 67351b2510..07bf5eb426 100644 --- a/meta/classes/package.bbclass +++ b/meta/classes/package.bbclass @@ -574,26 +574,16 @@ def copydebugsources(debugsrcdir, sources, d): objcopy = d.getVar("OBJCOPY") workdir = d.getVar("WORKDIR") sdir = d.getVar("S") - sparentdir = os.path.dirname(os.path.dirname(sdir)) - sbasedir = os.path.basename(os.path.dirname(sdir)) + "/" + os.path.basename(sdir) - workparentdir = os.path.dirname(os.path.dirname(workdir)) - workbasedir = os.path.basename(os.path.dirname(workdir)) + "/" + os.path.basename(workdir) - - # If S isnt based on WORKDIR we can infer our sources are located elsewhere, - # e.g. using externalsrc; use S as base for our dirs - if workdir in sdir or 'work-shared' in sdir: - basedir = workbasedir - parentdir = workparentdir - else: - basedir = sbasedir - parentdir = sparentdir + cflags = d.expand("${CFLAGS}") - # If build path exists in sourcefile, it means toolchain did not use - # -fdebug-prefix-map to compile - if checkbuildpath(sourcefile, d): - localsrc_prefix = parentdir + "/" - else: - localsrc_prefix = "/usr/src/debug/" + prefixmap = {} + for flag in cflags.split(): + if not flag.startswith("-fdebug-prefix-map"): + continue + if "recipe-sysroot" in flag: + continue + flag = flag.split("=") + prefixmap[flag[1]] = flag[2] nosuchdir = [] basepath = dvar @@ -604,28 +594,26 @@ def copydebugsources(debugsrcdir, sources, d): bb.utils.mkdirhier(basepath) cpath.updatecache(basepath) - # Ignore files from the recipe sysroots (target and native) - processdebugsrc = "LC_ALL=C ; sort -z -u '%s' | egrep -v -z '((|)$|/.*recipe-sysroot.*/)' | " - # We need to ignore files that are not actually ours - # we do this by only paying attention to items from this package - processdebugsrc += "fgrep -zw '%s' | " - # Remove prefix in the source paths - processdebugsrc += "sed 's#%s##g' | " - processdebugsrc += "(cd '%s' ; cpio -pd0mlL --no-preserve-owner '%s%s' 2>/dev/null)" - - cmd = processdebugsrc % (sourcefile, basedir, localsrc_prefix, parentdir, dvar, debugsrcdir) - try: - subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT) - except subprocess.CalledProcessError: - # Can "fail" if internal headers/transient sources are attempted - pass - - # cpio seems to have a bug with -lL together and symbolic links are just copied, not dereferenced. - # Work around this by manually finding and copying any symbolic links that made it through. - cmd = "find %s%s -type l -print0 -delete | sed s#%s%s/##g | (cd '%s' ; cpio -pd0mL --no-preserve-owner '%s%s')" % \ - (dvar, debugsrcdir, dvar, debugsrcdir, parentdir, dvar, debugsrcdir) - subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT) + for pmap in prefixmap: + # Ignore files from the recipe sysroots (target and native) + cmd = "LC_ALL=C ; sort -z -u '%s' | egrep -v -z '((|)$|/.*recipe-sysroot.*/)' | " % sourcefile + # We need to ignore files that are not actually ours + # we do this by only paying attention to items from this package + cmd += "fgrep -zw '%s' | " % prefixmap[pmap] + # Remove prefix in the source paths + cmd += "sed 's#%s/##g' | " % (prefixmap[pmap]) + cmd += "(cd '%s' ; cpio -pd0mlL --no-preserve-owner '%s%s' 2>/dev/null)" % (pmap, dvar, prefixmap[pmap]) + try: + subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT) + except subprocess.CalledProcessError: + # Can "fail" if internal headers/transient sources are attempted + pass + # cpio seems to have a bug with -lL together and symbolic links are just copied, not dereferenced. + # Work around this by manually finding and copying any symbolic links that made it through. + cmd = "find %s%s -type l -print0 -delete | sed s#%s%s/##g | (cd '%s' ; cpio -pd0mL --no-preserve-owner '%s%s')" % \ + (dvar, prefixmap[pmap], dvar, prefixmap[pmap], pmap, dvar, prefixmap[pmap]) + subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT) # debugsources.list may be polluted from the host if we used externalsrc, # cpio uses copy-pass and may have just created a directory structure From patchwork Wed Nov 6 13:33:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Steve Sakoman X-Patchwork-Id: 52100 X-Patchwork-Delegate: steve@sakoman.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7553D44D5C for ; Wed, 6 Nov 2024 13:33:46 +0000 (UTC) Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by mx.groups.io with SMTP id smtpd.web11.45598.1730900020744371194 for ; Wed, 06 Nov 2024 05:33:40 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@sakoman-com.20230601.gappssmtp.com header.s=20230601 header.b=mDgBa4Ke; spf=softfail (domain: sakoman.com, ip: 209.85.210.175, mailfrom: steve@sakoman.com) Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-720d01caa66so4888780b3a.2 for ; Wed, 06 Nov 2024 05:33:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakoman-com.20230601.gappssmtp.com; s=20230601; t=1730900020; x=1731504820; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=LIVRBSH/MHq317EHDwRflQ3kM8XB8985BaibMpciEBQ=; b=mDgBa4KeJE0cOmpiSq9Qwctf7ud88Q+9te+ODmESOmFL+Za9duTNN2Z7BHa/oNS+aO VAOL54ctnuf2y5BdkcFLdFhY7BgBxEAhihl70oqRm4OAbDzBCt+n94AQhGyB+WzEvDAD NKlGPXytAHNTuxaUj0O4OaFPsT2DoVjh+R4/VEnMQQmnFoKilMlzcx1ongis1mz4sK52 aaKTPQVaPEjI3W3X/jh3e+bw2wKliPcvZkUZV7r8bb3C0VO4Va+Im08CMqRyWR/Ix1wX PFOA3lch/OBW5rDY7rVgvh5oaX3xIC8NCF2N6GpjyUOYJpaib76RYXy3xKLquzukY/5T Qqtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730900020; x=1731504820; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LIVRBSH/MHq317EHDwRflQ3kM8XB8985BaibMpciEBQ=; b=xDcU4dvLvhCo9rqq/Ro4NjqN0x/VdNeJZ799eWQn6MTNxKW5T+w6gU+UoyLRzR9YfY 5HClfZmyA6PVHLFlXzJENh0BCHIf2pF20g6N/B7DuzKGvd/naBdjY8QHAS7jNDL+w51y OCQDc2FoS6Sdx9vt2eA2YCnBowjym3hOV9F/Nic0a2O+AIrk18PG6k7QsQziZ9mhbbuk SiUIyPuwz0eVHOkzqwbqRJ+ZF/RVEEpGyvauB/wOgX8hvq9/7wb/AHrLVOmT51plb8gV A8yz0QTqiv8lJUo4C1dNPhrOVQ/VYzLA2XdzR/28RJEDQQhouK6VhfmYlYrpv3EcKzz3 FOiA== X-Gm-Message-State: AOJu0YxcJdk9meMcrKXbcFGYTBfKKY6hw/QgwloPxq+uubsxaOjN1QHA 6e7GVqgzoBHgB64w/m8ctYMgQVxbbDb8ajpYCFSK28QlqEwh6zfSFIYfU2Bnjoh0X/iktRF1Kig W X-Google-Smtp-Source: AGHT+IGaa2dvr2/F6w4LJ+iKifJO5RNn7owKouN5j2bCp+j6cPMHJSvpQLWD+Jeazj7ISX6m3NYG/A== X-Received: by 2002:a05:6a00:190f:b0:71e:795f:92f0 with SMTP id d2e1a72fcca58-720b9b84653mr33383214b3a.3.1730900018978; Wed, 06 Nov 2024 05:33:38 -0800 (PST) Received: from hexa.. ([98.142.47.158]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-720bc1e5722sm11631717b3a.71.2024.11.06.05.33.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Nov 2024 05:33:38 -0800 (PST) From: Steve Sakoman To: openembedded-core@lists.openembedded.org Subject: [OE-core][kirkstone 5/5] xmlto: backport a patch to fix build with gcc-14 on host Date: Wed, 6 Nov 2024 05:33:22 -0800 Message-Id: <2e8819c0b9ada2b600aecc40c974a18eb7c0a666.1730899830.git.steve@sakoman.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 06 Nov 2024 13:33:46 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/206772 From: Martin Jansa * need to add dependency on flex-native because now when the .l file is modified by the .patch file it will try to regenerate the c code and fail: | make[1]: Entering directory 'work/x86_64-linux/xmlto-native/0.0.28-r0/build' | /bin/bash ../xmlto-0.0.28/ylwrap ../xmlto-0.0.28/xmlif/xmlif.l .c xmlif/xmlif.c -- /bin/bash 'work/x86_64-linux/xmlto-native/0.0.28-r0/xmlto-0.0.28/missing' flex | work/x86_64-linux/xmlto-native/0.0.28-r0/xmlto-0.0.28/missing: line 81: flex: command not found | WARNING: 'flex' is missing on your system. | You should only need it if you modified a '.l' file. | You may want to install the Fast Lexical Analyzer package: | * backport https://pagure.io/xmlto/c/32376c053733c6c0ebaca3c25c0725509342fdf3?branch=master as well, so that patched xmlif/xmlif.c is newer than xmlif/xmlif.l and the build won't try to regenerate it with flex as that leads to random build failures reported in: https://lists.openembedded.org/g/openembedded-core/message/206412 https://errors.yoctoproject.org/Errors/Details/810853/ https://lists.openembedded.org/g/openembedded-core/message/206496 https://valkyrie.yoctoproject.org/#/builders/29/builds/355 Signed-off-by: Martin Jansa Signed-off-by: Steve Sakoman --- ...001-Fix-return-type-of-main-function.patch | 42 + ...mlif.c-and-update-xmlif.l-to-comply-.patch | 1259 +++++++++++++++++ .../0001-fix-Wimplicit-int-for-ifsense.patch | 33 + meta/recipes-devtools/xmlto/xmlto_0.0.28.bb | 10 + 4 files changed, 1344 insertions(+) create mode 100644 meta/recipes-devtools/xmlto/xmlto-0.0.28/0001-Fix-return-type-of-main-function.patch create mode 100644 meta/recipes-devtools/xmlto/xmlto-0.0.28/0001-Regenerate-the-xmlif.c-and-update-xmlif.l-to-comply-.patch create mode 100644 meta/recipes-devtools/xmlto/xmlto-0.0.28/0001-fix-Wimplicit-int-for-ifsense.patch diff --git a/meta/recipes-devtools/xmlto/xmlto-0.0.28/0001-Fix-return-type-of-main-function.patch b/meta/recipes-devtools/xmlto/xmlto-0.0.28/0001-Fix-return-type-of-main-function.patch new file mode 100644 index 0000000000..f28f1fb56a --- /dev/null +++ b/meta/recipes-devtools/xmlto/xmlto-0.0.28/0001-Fix-return-type-of-main-function.patch @@ -0,0 +1,42 @@ +From 6347e1b9da2140acdd55e3e7ac1199456793e17c Mon Sep 17 00:00:00 2001 +From: Thomas Kuehne +Date: Sat, 11 Dec 2021 20:56:00 +0000 +Subject: [PATCH] Fix return type of main function +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Fixes: +xmlif/xmlif.l:242:1: warning: return type defaults to ‘int’ [-Wimplicit-int] + 242 | main(int argc, char *argv[]) + | ^~~~ + +Signed-off-by: Thomas Kuehne +Signed-off-by: Martin Jansa +Upstream-Status: Backport [v0.0.29 https://pagure.io/xmlto/c/8e34f087bf410bcc5fe445933d6ad9bae54f24b5?branch=master] +--- + xmlif/xmlif.l | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/xmlif/xmlif.l b/xmlif/xmlif.l +index ac42136..78a62bc 100644 +--- a/xmlif/xmlif.l ++++ b/xmlif/xmlif.l +@@ -239,7 +239,7 @@ WS [ \t\n]* + + int yywrap() {exit(0);}; + +-main(int argc, char *argv[]) ++int main(int argc, char *argv[]) + { + int i; + +@@ -265,7 +265,7 @@ main(int argc, char *argv[]) + exit(1); + } + +- yylex(); ++ return yylex(); + } + + /* diff --git a/meta/recipes-devtools/xmlto/xmlto-0.0.28/0001-Regenerate-the-xmlif.c-and-update-xmlif.l-to-comply-.patch b/meta/recipes-devtools/xmlto/xmlto-0.0.28/0001-Regenerate-the-xmlif.c-and-update-xmlif.l-to-comply-.patch new file mode 100644 index 0000000000..2e5344158c --- /dev/null +++ b/meta/recipes-devtools/xmlto/xmlto-0.0.28/0001-Regenerate-the-xmlif.c-and-update-xmlif.l-to-comply-.patch @@ -0,0 +1,1259 @@ +From 32376c053733c6c0ebaca3c25c0725509342fdf3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ond=C5=99ej=20Sloup?= +Date: Thu, 11 Apr 2024 18:09:37 +0200 +Subject: [PATCH] Regenerate the xmlif.c and update xmlif.l to comply with the + new version of flex and gcc + +Removes warnings in the build process +Signed-off-by: Martin Jansa +Upstream-Status: Backport [v0.0.29 https://pagure.io/xmlto/c/32376c053733c6c0ebaca3c25c0725509342fdf3?branch=master] +--- + xmlif/xmlif.c | 449 ++++++++++++++++++++++++++------------------------ + xmlif/xmlif.l | 2 +- + 2 files changed, 232 insertions(+), 219 deletions(-) + +diff --git a/xmlif/xmlif.c b/xmlif/xmlif.c +index 50aa1bc..1b87a9e 100644 +--- a/xmlif/xmlif.c ++++ b/xmlif/xmlif.c +@@ -1,3 +1,4 @@ ++#line 1 "xmlif/xmlif.c" + + #line 3 "xmlif/xmlif.c" + +@@ -7,8 +8,8 @@ + + #define FLEX_SCANNER + #define YY_FLEX_MAJOR_VERSION 2 +-#define YY_FLEX_MINOR_VERSION 5 +-#define YY_FLEX_SUBMINOR_VERSION 37 ++#define YY_FLEX_MINOR_VERSION 6 ++#define YY_FLEX_SUBMINOR_VERSION 4 + #if YY_FLEX_SUBMINOR_VERSION > 0 + #define FLEX_BETA + #endif +@@ -83,65 +84,61 @@ typedef unsigned int flex_uint32_t; + #define UINT32_MAX (4294967295U) + #endif + ++#ifndef SIZE_MAX ++#define SIZE_MAX (~(size_t)0) ++#endif ++ + #endif /* ! C99 */ + + #endif /* ! FLEXINT_H */ + +-#ifdef __cplusplus +- +-/* The "const" storage-class-modifier is valid. */ +-#define YY_USE_CONST +- +-#else /* ! __cplusplus */ +- +-/* C99 requires __STDC__ to be defined as 1. */ +-#if defined (__STDC__) +- +-#define YY_USE_CONST +- +-#endif /* defined (__STDC__) */ +-#endif /* ! __cplusplus */ ++/* begin standard C++ headers. */ + +-#ifdef YY_USE_CONST ++/* TODO: this is always defined, so inline it */ + #define yyconst const ++ ++#if defined(__GNUC__) && __GNUC__ >= 3 ++#define yynoreturn __attribute__((__noreturn__)) + #else +-#define yyconst ++#define yynoreturn + #endif + + /* Returned upon end-of-file. */ + #define YY_NULL 0 + +-/* Promotes a possibly negative, possibly signed char to an unsigned +- * integer for use as an array index. If the signed char is negative, +- * we want to instead treat it as an 8-bit unsigned char, hence the +- * double cast. ++/* Promotes a possibly negative, possibly signed char to an ++ * integer in range [0..255] for use as an array index. + */ +-#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) ++#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) + + /* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ + #define BEGIN (yy_start) = 1 + 2 * +- + /* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ + #define YY_START (((yy_start) - 1) / 2) + #define YYSTATE YY_START +- + /* Action number for EOF rule of a given start state. */ + #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) +- + /* Special action meaning "start processing a new file". */ +-#define YY_NEW_FILE yyrestart(yyin ) +- ++#define YY_NEW_FILE yyrestart( yyin ) + #define YY_END_OF_BUFFER_CHAR 0 + + /* Size of default input buffer. */ + #ifndef YY_BUF_SIZE ++#ifdef __ia64__ ++/* On IA-64, the buffer size is 16k, not 8k. ++ * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. ++ * Ditto for the __ia64__ case accordingly. ++ */ ++#define YY_BUF_SIZE 32768 ++#else + #define YY_BUF_SIZE 16384 ++#endif /* __ia64__ */ + #endif + + /* The state buf must be large enough to hold one state per character in the main buffer. +@@ -158,15 +155,16 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; + typedef size_t yy_size_t; + #endif + +-extern yy_size_t yyleng; ++extern int yyleng; + + extern FILE *yyin, *yyout; + + #define EOB_ACT_CONTINUE_SCAN 0 + #define EOB_ACT_END_OF_FILE 1 + #define EOB_ACT_LAST_MATCH 2 +- ++ + #define YY_LESS_LINENO(n) ++ #define YY_LINENO_REWIND_TO(ptr) + + /* Return all but the first "n" matched characters back to the input stream. */ + #define yyless(n) \ +@@ -181,7 +179,6 @@ extern FILE *yyin, *yyout; + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) +- + #define unput(c) yyunput( c, (yytext_ptr) ) + + #ifndef YY_STRUCT_YY_BUFFER_STATE +@@ -196,12 +193,12 @@ struct yy_buffer_state + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ +- yy_size_t yy_buf_size; ++ int yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ +- yy_size_t yy_n_chars; ++ int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to +@@ -224,7 +221,7 @@ struct yy_buffer_state + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ +- ++ + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ +@@ -252,7 +249,7 @@ struct yy_buffer_state + /* Stack of input buffers. */ + static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ + static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +-static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ ++static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ + + /* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general +@@ -263,7 +260,6 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ + #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) +- + /* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +@@ -271,11 +267,11 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ + + /* yy_hold_char holds the character lost when yytext is formed. */ + static char yy_hold_char; +-static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ +-yy_size_t yyleng; ++static int yy_n_chars; /* number of characters read into yy_ch_buf */ ++int yyleng; + + /* Points to current character in buffer. */ +-static char *yy_c_buf_p = (char *) 0; ++static char *yy_c_buf_p = NULL; + static int yy_init = 0; /* whether we need to initialize */ + static int yy_start = 0; /* start state number */ + +@@ -284,82 +280,78 @@ static int yy_start = 0; /* start state number */ + */ + static int yy_did_buffer_switch_on_eof; + +-void yyrestart (FILE *input_file ); +-void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); +-YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); +-void yy_delete_buffer (YY_BUFFER_STATE b ); +-void yy_flush_buffer (YY_BUFFER_STATE b ); +-void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); +-void yypop_buffer_state (void ); +- +-static void yyensure_buffer_stack (void ); +-static void yy_load_buffer_state (void ); +-static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); ++void yyrestart ( FILE *input_file ); ++void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); ++YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); ++void yy_delete_buffer ( YY_BUFFER_STATE b ); ++void yy_flush_buffer ( YY_BUFFER_STATE b ); ++void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); ++void yypop_buffer_state ( void ); + +-#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) ++static void yyensure_buffer_stack ( void ); ++static void yy_load_buffer_state ( void ); ++static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file ); ++#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER ) + +-YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); +-YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); +-YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); ++YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); ++YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); ++YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); + +-void *yyalloc (yy_size_t ); +-void *yyrealloc (void *,yy_size_t ); +-void yyfree (void * ); ++void *yyalloc ( yy_size_t ); ++void *yyrealloc ( void *, yy_size_t ); ++void yyfree ( void * ); + + #define yy_new_buffer yy_create_buffer +- + #define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ +- yy_create_buffer(yyin,YY_BUF_SIZE ); \ ++ yy_create_buffer( yyin, YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } +- + #define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ +- yy_create_buffer(yyin,YY_BUF_SIZE ); \ ++ yy_create_buffer( yyin, YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } +- + #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + + /* Begin user sect3 */ ++typedef flex_uint8_t YY_CHAR; + +-typedef unsigned char YY_CHAR; +- +-FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; ++FILE *yyin = NULL, *yyout = NULL; + +-typedef yyconst struct yy_trans_info *yy_state_type; ++typedef const struct yy_trans_info *yy_state_type; + + extern int yylineno; +- + int yylineno = 1; + + extern char *yytext; ++#ifdef yytext_ptr ++#undef yytext_ptr ++#endif + #define yytext_ptr yytext + +-static yy_state_type yy_get_previous_state (void ); +-static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +-static int yy_get_next_buffer (void ); +-static void yy_fatal_error (yyconst char msg[] ); ++static yy_state_type yy_get_previous_state ( void ); ++static yy_state_type yy_try_NUL_trans ( yy_state_type current_state ); ++static int yy_get_next_buffer ( void ); ++static void yynoreturn yy_fatal_error ( const char* msg ); + + /* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ + #define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ +- yyleng = (size_t) (yy_cp - yy_bp); \ ++ yyleng = (int) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; +- + #define YY_NUM_RULES 13 + #define YY_END_OF_BUFFER 14 + struct yy_trans_info +@@ -367,7 +359,7 @@ struct yy_trans_info + flex_int16_t yy_verify; + flex_int16_t yy_nxt; + }; +-static yyconst struct yy_trans_info yy_transition[3478] = ++static const struct yy_trans_info yy_transition[3478] = + { + { 0, 0 }, { 0,3222 }, { 0, 0 }, { 0,3220 }, { 1,1548 }, + { 2,1548 }, { 3,1548 }, { 4,1548 }, { 5,1548 }, { 6,1548 }, +@@ -1079,7 +1071,7 @@ static yyconst struct yy_trans_info yy_transition[3478] = + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, + { 0, 0 }, { 0, 0 }, { 257, 14 }, { 1, 0 }, }; + +-static yyconst struct yy_trans_info *yy_start_state_list[7] = ++static const struct yy_trans_info *yy_start_state_list[7] = + { + &yy_transition[1], + &yy_transition[3], +@@ -1145,13 +1137,14 @@ char *yytext; + */ + #include + #include ++#include + + #define TRUE 1 + #define FALSE 0 + + static char **selections; /* selection tokens */ + static int nselections; /* number of selections */ +-static ifsense; /* sense of last `if' or unless seen */ ++static int ifsense; /* sense of last `if' or unless seen */ + static char *attribute; /* last attribute scanned */ + + struct stack_t { +@@ -1301,8 +1294,9 @@ static void process_else() + } + + ++#line 1297 "xmlif/xmlif.c" + +-#line 1306 "xmlif/xmlif.c" ++#line 1299 "xmlif/xmlif.c" + + #define INITIAL 0 + #define attrib 1 +@@ -1320,36 +1314,36 @@ static void process_else() + #define YY_EXTRA_TYPE void * + #endif + +-static int yy_init_globals (void ); ++static int yy_init_globals ( void ); + + /* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +-int yylex_destroy (void ); ++int yylex_destroy ( void ); + +-int yyget_debug (void ); ++int yyget_debug ( void ); + +-void yyset_debug (int debug_flag ); ++void yyset_debug ( int debug_flag ); + +-YY_EXTRA_TYPE yyget_extra (void ); ++YY_EXTRA_TYPE yyget_extra ( void ); + +-void yyset_extra (YY_EXTRA_TYPE user_defined ); ++void yyset_extra ( YY_EXTRA_TYPE user_defined ); + +-FILE *yyget_in (void ); ++FILE *yyget_in ( void ); + +-void yyset_in (FILE * in_str ); ++void yyset_in ( FILE * _in_str ); + +-FILE *yyget_out (void ); ++FILE *yyget_out ( void ); + +-void yyset_out (FILE * out_str ); ++void yyset_out ( FILE * _out_str ); + +-yy_size_t yyget_leng (void ); ++ int yyget_leng ( void ); + +-char *yyget_text (void ); ++char *yyget_text ( void ); + +-int yyget_lineno (void ); ++int yyget_lineno ( void ); + +-void yyset_lineno (int line_number ); ++void yyset_lineno ( int _line_number ); + + /* Macros after this point can all be overridden by user definitions in + * section 1. +@@ -1357,35 +1351,43 @@ void yyset_lineno (int line_number ); + + #ifndef YY_SKIP_YYWRAP + #ifdef __cplusplus +-extern "C" int yywrap (void ); ++extern "C" int yywrap ( void ); + #else +-extern int yywrap (void ); ++extern int yywrap ( void ); + #endif + #endif + +- static void yyunput (int c,char *buf_ptr ); ++#ifndef YY_NO_UNPUT ++ ++ static void yyunput ( int c, char *buf_ptr ); + ++#endif ++ + #ifndef yytext_ptr +-static void yy_flex_strncpy (char *,yyconst char *,int ); ++static void yy_flex_strncpy ( char *, const char *, int ); + #endif + + #ifdef YY_NEED_STRLEN +-static int yy_flex_strlen (yyconst char * ); ++static int yy_flex_strlen ( const char * ); + #endif + + #ifndef YY_NO_INPUT +- + #ifdef __cplusplus +-static int yyinput (void ); ++static int yyinput ( void ); + #else +-static int input (void ); ++static int input ( void ); + #endif + + #endif + + /* Amount of stuff to slurp up with each read. */ + #ifndef YY_READ_BUF_SIZE ++#ifdef __ia64__ ++/* On IA-64, the buffer size is 16k, not 8k */ ++#define YY_READ_BUF_SIZE 16384 ++#else + #define YY_READ_BUF_SIZE 8192 ++#endif /* __ia64__ */ + #endif + + /* Copy whatever the last rule matched to the standard output. */ +@@ -1393,7 +1395,7 @@ static int input (void ); + /* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +-#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) ++#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) + #endif + + /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, +@@ -1402,7 +1404,7 @@ static int input (void ); + #ifndef YY_INPUT + #define YY_INPUT(buf,result,max_size) \ + errno=0; \ +- while ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \ ++ while ( (result = (int) read( fileno(yyin), buf, (yy_size_t) max_size )) < 0 ) \ + { \ + if( errno != EINTR) \ + { \ +@@ -1456,7 +1458,7 @@ extern int yylex (void); + + /* Code executed at the end of each rule. */ + #ifndef YY_BREAK +-#define YY_BREAK break; ++#define YY_BREAK /*LINTED*/break; + #endif + + #define YY_RULE_SETUP \ +@@ -1466,14 +1468,10 @@ extern int yylex (void); + */ + YY_DECL + { +- register yy_state_type yy_current_state; +- register char *yy_cp, *yy_bp; +- register int yy_act; ++ yy_state_type yy_current_state; ++ char *yy_cp, *yy_bp; ++ int yy_act; + +-#line 207 "xmlif/xmlif.l" +- +-#line 1476 "xmlif/xmlif.c" +- + if ( !(yy_init) ) + { + (yy_init) = 1; +@@ -1494,13 +1492,18 @@ YY_DECL + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = +- yy_create_buffer(yyin,YY_BUF_SIZE ); ++ yy_create_buffer( yyin, YY_BUF_SIZE ); + } + +- yy_load_buffer_state( ); ++ yy_load_buffer_state( ); + } + +- while ( 1 ) /* loops until end-of-file is reached */ ++ { ++#line 208 "xmlif/xmlif.l" ++ ++#line 1504 "xmlif/xmlif.c" ++ ++ while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); + +@@ -1515,12 +1518,12 @@ YY_DECL + yy_current_state = yy_start_state_list[(yy_start)]; + yy_match: + { +- register yyconst struct yy_trans_info *yy_trans_info; ++ const struct yy_trans_info *yy_trans_info; + +- register YY_CHAR yy_c; ++ YY_CHAR yy_c; + + for ( yy_c = YY_SC_TO_UI(*yy_cp); +- (yy_trans_info = &yy_current_state[(unsigned int) yy_c])-> ++ (yy_trans_info = &yy_current_state[yy_c])-> + yy_verify == yy_c; + yy_c = YY_SC_TO_UI(*++yy_cp) ) + { +@@ -1553,58 +1556,58 @@ do_action: /* This label is used only to access EOF actions. */ + case 1: + /* rule 1 can match eol */ + YY_RULE_SETUP +-#line 208 "xmlif/xmlif.l" ++#line 209 "xmlif/xmlif.l" + {BEGIN(attrib); ifsense = FALSE; push_level();} + YY_BREAK + case 2: + /* rule 2 can match eol */ + YY_RULE_SETUP +-#line 209 "xmlif/xmlif.l" ++#line 210 "xmlif/xmlif.l" + {BEGIN(attrib); ifsense = TRUE; push_level();} + YY_BREAK + case 3: + /* rule 3 can match eol */ + YY_RULE_SETUP +-#line 210 "xmlif/xmlif.l" ++#line 211 "xmlif/xmlif.l" + {BEGIN(attrib); ifsense = FALSE;} + YY_BREAK + case 4: + /* rule 4 can match eol */ + YY_RULE_SETUP +-#line 211 "xmlif/xmlif.l" ++#line 212 "xmlif/xmlif.l" + {BEGIN(attrib); ifsense = TRUE;} + YY_BREAK + case 5: + /* rule 5 can match eol */ + YY_RULE_SETUP +-#line 212 "xmlif/xmlif.l" ++#line 213 "xmlif/xmlif.l" + {process_else();} + YY_BREAK + case 6: + /* rule 6 can match eol */ + YY_RULE_SETUP +-#line 214 "xmlif/xmlif.l" ++#line 215 "xmlif/xmlif.l" + {pop_level();} + YY_BREAK + case 7: + YY_RULE_SETUP +-#line 216 "xmlif/xmlif.l" ++#line 217 "xmlif/xmlif.l" + {stash_attribute(yytext);} + YY_BREAK + case 8: + YY_RULE_SETUP +-#line 217 "xmlif/xmlif.l" ++#line 218 "xmlif/xmlif.l" + {BEGIN(val);} + YY_BREAK + case 9: + YY_RULE_SETUP +-#line 218 "xmlif/xmlif.l" ++#line 219 "xmlif/xmlif.l" + {BEGIN(INITIAL); end_attribute();} + YY_BREAK + case 10: + /* rule 10 can match eol */ + YY_RULE_SETUP +-#line 219 "xmlif/xmlif.l" ++#line 220 "xmlif/xmlif.l" + { + yytext[strlen(yytext)-1]='\0'; + process_value(yytext+1); +@@ -1613,7 +1616,7 @@ YY_RULE_SETUP + YY_BREAK + case 11: + YY_RULE_SETUP +-#line 224 "xmlif/xmlif.l" ++#line 225 "xmlif/xmlif.l" + { + fprintf(stderr, + "xmlif: > where value expected\n"); +@@ -1622,7 +1625,7 @@ YY_RULE_SETUP + YY_BREAK + case 12: + YY_RULE_SETUP +-#line 230 "xmlif/xmlif.l" ++#line 231 "xmlif/xmlif.l" + { + if (!end->suppressed) + putchar(yytext[0]); +@@ -1630,10 +1633,10 @@ YY_RULE_SETUP + YY_BREAK + case 13: + YY_RULE_SETUP +-#line 235 "xmlif/xmlif.l" ++#line 236 "xmlif/xmlif.l" + ECHO; + YY_BREAK +-#line 1637 "xmlif/xmlif.c" ++#line 1639 "xmlif/xmlif.c" + case YY_STATE_EOF(INITIAL): + case YY_STATE_EOF(attrib): + case YY_STATE_EOF(val): +@@ -1713,7 +1716,7 @@ case YY_STATE_EOF(val): + { + (yy_did_buffer_switch_on_eof) = 0; + +- if ( yywrap( ) ) ++ if ( yywrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up +@@ -1766,6 +1769,7 @@ case YY_STATE_EOF(val): + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ ++ } /* end of user's declarations */ + } /* end of yylex */ + + /* yy_get_next_buffer - try to read in a new buffer +@@ -1777,9 +1781,9 @@ case YY_STATE_EOF(val): + */ + static int yy_get_next_buffer (void) + { +- register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; +- register char *source = (yytext_ptr); +- register int number_to_move, i; ++ char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; ++ char *source = (yytext_ptr); ++ int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) +@@ -1808,7 +1812,7 @@ static int yy_get_next_buffer (void) + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ +- number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; ++ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); +@@ -1821,7 +1825,7 @@ static int yy_get_next_buffer (void) + + else + { +- yy_size_t num_to_read = ++ int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) +@@ -1835,7 +1839,7 @@ static int yy_get_next_buffer (void) + + if ( b->yy_is_our_buffer ) + { +- yy_size_t new_size = b->yy_buf_size * 2; ++ int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; +@@ -1844,11 +1848,12 @@ static int yy_get_next_buffer (void) + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ +- yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); ++ yyrealloc( (void *) b->yy_ch_buf, ++ (yy_size_t) (b->yy_buf_size + 2) ); + } + else + /* Can't grow it, we don't own it. */ +- b->yy_ch_buf = 0; ++ b->yy_ch_buf = NULL; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( +@@ -1876,7 +1881,7 @@ static int yy_get_next_buffer (void) + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; +- yyrestart(yyin ); ++ yyrestart( yyin ); + } + + else +@@ -1890,12 +1895,15 @@ static int yy_get_next_buffer (void) + else + ret_val = EOB_ACT_CONTINUE_SCAN; + +- if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { ++ if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ +- yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); +- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); ++ int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); ++ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( ++ (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); ++ /* "- 2" to take care of EOB's */ ++ YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); + } + + (yy_n_chars) += number_to_move; +@@ -1911,8 +1919,8 @@ static int yy_get_next_buffer (void) + + static yy_state_type yy_get_previous_state (void) + { +- register yy_state_type yy_current_state; +- register char *yy_cp; ++ yy_state_type yy_current_state; ++ char *yy_cp; + + yy_current_state = yy_start_state_list[(yy_start)]; + +@@ -1936,11 +1944,11 @@ static int yy_get_next_buffer (void) + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) + { +- register int yy_is_jam; +- register char *yy_cp = (yy_c_buf_p); ++ int yy_is_jam; ++ char *yy_cp = (yy_c_buf_p); + +- register int yy_c = 256; +- register yyconst struct yy_trans_info *yy_trans_info; ++ int yy_c = 256; ++ const struct yy_trans_info *yy_trans_info; + + yy_trans_info = &yy_current_state[(unsigned int) yy_c]; + yy_current_state += yy_trans_info->yy_nxt; +@@ -1958,9 +1966,11 @@ static int yy_get_next_buffer (void) + return yy_is_jam ? 0 : yy_current_state; + } + +- static void yyunput (int c, register char * yy_bp ) ++#ifndef YY_NO_UNPUT ++ ++ static void yyunput (int c, char * yy_bp ) + { +- register char *yy_cp; ++ char *yy_cp; + + yy_cp = (yy_c_buf_p); + +@@ -1970,10 +1980,10 @@ static int yy_get_next_buffer (void) + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ +- register yy_size_t number_to_move = (yy_n_chars) + 2; +- register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ ++ int number_to_move = (yy_n_chars) + 2; ++ char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; +- register char *source = ++ char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) +@@ -1982,7 +1992,7 @@ static int yy_get_next_buffer (void) + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = +- (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; ++ (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); +@@ -1995,6 +2005,8 @@ static int yy_get_next_buffer (void) + (yy_c_buf_p) = yy_cp; + } + ++#endif ++ + #ifndef YY_NO_INPUT + #ifdef __cplusplus + static int yyinput (void) +@@ -2019,7 +2031,7 @@ static int yy_get_next_buffer (void) + + else + { /* need more input */ +- yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); ++ int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) +@@ -2036,14 +2048,14 @@ static int yy_get_next_buffer (void) + */ + + /* Reset buffer status. */ +- yyrestart(yyin ); ++ yyrestart( yyin ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { +- if ( yywrap( ) ) +- return EOF; ++ if ( yywrap( ) ) ++ return 0; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +@@ -2080,11 +2092,11 @@ static int yy_get_next_buffer (void) + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = +- yy_create_buffer(yyin,YY_BUF_SIZE ); ++ yy_create_buffer( yyin, YY_BUF_SIZE ); + } + +- yy_init_buffer(YY_CURRENT_BUFFER,input_file ); +- yy_load_buffer_state( ); ++ yy_init_buffer( YY_CURRENT_BUFFER, input_file ); ++ yy_load_buffer_state( ); + } + + /** Switch to a different input buffer. +@@ -2112,7 +2124,7 @@ static int yy_get_next_buffer (void) + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; +- yy_load_buffer_state( ); ++ yy_load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag +@@ -2140,7 +2152,7 @@ static void yy_load_buffer_state (void) + { + YY_BUFFER_STATE b; + +- b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); ++ b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + +@@ -2149,13 +2161,13 @@ static void yy_load_buffer_state (void) + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ +- b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); ++ b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + +- yy_init_buffer(b,file ); ++ yy_init_buffer( b, file ); + + return b; + } +@@ -2174,9 +2186,9 @@ static void yy_load_buffer_state (void) + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) +- yyfree((void *) b->yy_ch_buf ); ++ yyfree( (void *) b->yy_ch_buf ); + +- yyfree((void *) b ); ++ yyfree( (void *) b ); + } + + /* Initializes or reinitializes a buffer. +@@ -2188,7 +2200,7 @@ static void yy_load_buffer_state (void) + { + int oerrno = errno; + +- yy_flush_buffer(b ); ++ yy_flush_buffer( b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; +@@ -2231,7 +2243,7 @@ static void yy_load_buffer_state (void) + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) +- yy_load_buffer_state( ); ++ yy_load_buffer_state( ); + } + + /** Pushes the new state onto the stack. The new state becomes +@@ -2262,7 +2274,7 @@ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ +- yy_load_buffer_state( ); ++ yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } + +@@ -2281,7 +2293,7 @@ void yypop_buffer_state (void) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { +- yy_load_buffer_state( ); ++ yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } + } +@@ -2299,15 +2311,15 @@ static void yyensure_buffer_stack (void) + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ +- num_to_alloc = 1; ++ num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); +- ++ + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); +- ++ + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; +@@ -2316,7 +2328,7 @@ static void yyensure_buffer_stack (void) + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ +- int grow_size = 8 /* arbitrary grow size */; ++ yy_size_t grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc +@@ -2336,7 +2348,7 @@ static void yyensure_buffer_stack (void) + * @param base the character buffer + * @param size the size in bytes of the character buffer + * +- * @return the newly allocated buffer state object. ++ * @return the newly allocated buffer state object. + */ + YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) + { +@@ -2346,23 +2358,23 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ +- return 0; ++ return NULL; + +- b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); ++ b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + +- b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ ++ b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; +- b->yy_input_file = 0; ++ b->yy_input_file = NULL; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + +- yy_switch_to_buffer(b ); ++ yy_switch_to_buffer( b ); + + return b; + } +@@ -2375,10 +2387,10 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) + * @note If you want to scan bytes that may contain NUL values, then use + * yy_scan_bytes() instead. + */ +-YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) ++YY_BUFFER_STATE yy_scan_string (const char * yystr ) + { + +- return yy_scan_bytes(yystr,strlen(yystr) ); ++ return yy_scan_bytes( yystr, (int) strlen(yystr) ); + } + + /** Setup the input buffer state to scan the given bytes. The next call to yylex() will +@@ -2388,7 +2400,7 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) + * + * @return the newly allocated buffer state object. + */ +-YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) ++YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) + { + YY_BUFFER_STATE b; + char *buf; +@@ -2396,8 +2408,8 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ +- n = _yybytes_len + 2; +- buf = (char *) yyalloc(n ); ++ n = (yy_size_t) (_yybytes_len + 2); ++ buf = (char *) yyalloc( n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + +@@ -2406,7 +2418,7 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + +- b = yy_scan_buffer(buf,n ); ++ b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + +@@ -2422,9 +2434,9 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len + #define YY_EXIT_FAILURE 2 + #endif + +-static void yy_fatal_error (yyconst char* msg ) ++static void yynoreturn yy_fatal_error (const char* msg ) + { +- (void) fprintf( stderr, "%s\n", msg ); ++ fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); + } + +@@ -2452,7 +2464,7 @@ static void yy_fatal_error (yyconst char* msg ) + */ + int yyget_lineno (void) + { +- ++ + return yylineno; + } + +@@ -2475,7 +2487,7 @@ FILE *yyget_out (void) + /** Get the length of the current token. + * + */ +-yy_size_t yyget_leng (void) ++int yyget_leng (void) + { + return yyleng; + } +@@ -2490,29 +2502,29 @@ char *yyget_text (void) + } + + /** Set the current line number. +- * @param line_number ++ * @param _line_number line number + * + */ +-void yyset_lineno (int line_number ) ++void yyset_lineno (int _line_number ) + { + +- yylineno = line_number; ++ yylineno = _line_number; + } + + /** Set the input stream. This does not discard the current + * input buffer. +- * @param in_str A readable stream. ++ * @param _in_str A readable stream. + * + * @see yy_switch_to_buffer + */ +-void yyset_in (FILE * in_str ) ++void yyset_in (FILE * _in_str ) + { +- yyin = in_str ; ++ yyin = _in_str ; + } + +-void yyset_out (FILE * out_str ) ++void yyset_out (FILE * _out_str ) + { +- yyout = out_str ; ++ yyout = _out_str ; + } + + int yyget_debug (void) +@@ -2520,9 +2532,9 @@ int yyget_debug (void) + return yy_flex_debug; + } + +-void yyset_debug (int bdebug ) ++void yyset_debug (int _bdebug ) + { +- yy_flex_debug = bdebug ; ++ yy_flex_debug = _bdebug ; + } + + static int yy_init_globals (void) +@@ -2531,10 +2543,10 @@ static int yy_init_globals (void) + * This function is called from yylex_destroy(), so don't allocate here. + */ + +- (yy_buffer_stack) = 0; ++ (yy_buffer_stack) = NULL; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; +- (yy_c_buf_p) = (char *) 0; ++ (yy_c_buf_p) = NULL; + (yy_init) = 0; + (yy_start) = 0; + +@@ -2543,8 +2555,8 @@ static int yy_init_globals (void) + yyin = stdin; + yyout = stdout; + #else +- yyin = (FILE *) 0; +- yyout = (FILE *) 0; ++ yyin = NULL; ++ yyout = NULL; + #endif + + /* For future reference: Set errno on error, since we are called by +@@ -2559,7 +2571,7 @@ int yylex_destroy (void) + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ +- yy_delete_buffer(YY_CURRENT_BUFFER ); ++ yy_delete_buffer( YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(); + } +@@ -2580,18 +2592,19 @@ int yylex_destroy (void) + */ + + #ifndef yytext_ptr +-static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) ++static void yy_flex_strncpy (char* s1, const char * s2, int n ) + { +- register int i; ++ ++ int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; + } + #endif + + #ifdef YY_NEED_STRLEN +-static int yy_flex_strlen (yyconst char * s ) ++static int yy_flex_strlen (const char * s ) + { +- register int n; ++ int n; + for ( n = 0; s[n]; ++n ) + ; + +@@ -2601,11 +2614,12 @@ static int yy_flex_strlen (yyconst char * s ) + + void *yyalloc (yy_size_t size ) + { +- return (void *) malloc( size ); ++ return malloc(size); + } + + void *yyrealloc (void * ptr, yy_size_t size ) + { ++ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter +@@ -2613,26 +2627,25 @@ void *yyrealloc (void * ptr, yy_size_t size ) + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ +- return (void *) realloc( (char *) ptr, size ); ++ return realloc(ptr, size); + } + + void yyfree (void * ptr ) + { +- free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ ++ free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ + } + + #define YYTABLES_NAME "yytables" + +-#line 235 "xmlif/xmlif.l" +- ++#line 236 "xmlif/xmlif.l" + + #include + + #include "config.h" + +-int yywrap() {exit(0);}; ++int yywrap() {exit(0);} + +-main(int argc, char *argv[]) ++int main(int argc, char *argv[]) + { + int i; + +@@ -2658,7 +2671,7 @@ main(int argc, char *argv[]) + exit(1); + } + +- yylex(); ++ return yylex(); + } + + /* +diff --git a/xmlif/xmlif.l b/xmlif/xmlif.l +index 294fbc7..560508e 100644 +--- a/xmlif/xmlif.l ++++ b/xmlif/xmlif.l +@@ -203,7 +203,7 @@ WS [ \t\n]* + + %x attrib val + +-%option batch never-interactive fast 8bit ++%option batch never-interactive fast 8bit yywrap + + %% + \<\?xmlif{WS}if{WS}not{WS} {BEGIN(attrib); ifsense = FALSE; push_level();} diff --git a/meta/recipes-devtools/xmlto/xmlto-0.0.28/0001-fix-Wimplicit-int-for-ifsense.patch b/meta/recipes-devtools/xmlto/xmlto-0.0.28/0001-fix-Wimplicit-int-for-ifsense.patch new file mode 100644 index 0000000000..d5c25ba08a --- /dev/null +++ b/meta/recipes-devtools/xmlto/xmlto-0.0.28/0001-fix-Wimplicit-int-for-ifsense.patch @@ -0,0 +1,33 @@ +From 1375e2df75530cd198bd16ac3de38e2b0d126276 Mon Sep 17 00:00:00 2001 +From: Thomas Kuehne +Date: Sat, 11 Dec 2021 21:10:41 +0100 +Subject: [PATCH] fix -Wimplicit-int for ifsense +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +fixes: +xmlif/xmlif.l:46:8: warning: type defaults to ‘int’ in declaration of ‘ifsense’ [-Wimplicit-int] + 46 | static ifsense; /* sense of last `if' or unless seen */ + | ^~~~~~~ + +Signed-off-by: Thomas Kuehne +Signed-off-by: Martin Jansa +Upstream-Status: Backport [v0.0.29 https://pagure.io/xmlto/c/1375e2df75530cd198bd16ac3de38e2b0d126276?branch=master +--- + xmlif/xmlif.l | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/xmlif/xmlif.l b/xmlif/xmlif.l +index ac42136..6e5970e 100644 +--- a/xmlif/xmlif.l ++++ b/xmlif/xmlif.l +@@ -43,7 +43,7 @@ + + static char **selections; /* selection tokens */ + static int nselections; /* number of selections */ +-static ifsense; /* sense of last `if' or unless seen */ ++static int ifsense; /* sense of last `if' or unless seen */ + static char *attribute; /* last attribute scanned */ + + struct stack_t { diff --git a/meta/recipes-devtools/xmlto/xmlto_0.0.28.bb b/meta/recipes-devtools/xmlto/xmlto_0.0.28.bb index 5cb9a4c57b..ce6680c507 100644 --- a/meta/recipes-devtools/xmlto/xmlto_0.0.28.bb +++ b/meta/recipes-devtools/xmlto/xmlto_0.0.28.bb @@ -8,6 +8,9 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552" SRC_URI = "https://releases.pagure.org/xmlto/xmlto-${PV}.tar.gz \ file://configure.in-drop-the-test-of-xmllint-and-xsltproc.patch \ + file://0001-Fix-return-type-of-main-function.patch \ + file://0001-fix-Wimplicit-int-for-ifsense.patch \ + file://0001-Regenerate-the-xmlif.c-and-update-xmlif.l-to-comply-.patch \ " SRC_URI[md5sum] = "a1fefad9d83499a15576768f60f847c6" SRC_URI[sha256sum] = "2f986b7c9a0e9ac6728147668e776d405465284e13c74d4146c9cbc51fd8aad3" @@ -36,6 +39,13 @@ BBCLASSEXTEND = "native" EXTRA_OECONF:append = " BASH=/bin/bash GCP=/bin/cp XMLLINT=xmllint XSLTPROC=xsltproc" +do_configure:prepend() { + # make sure xmlif.c is newer than xmlif.l after do_patch (order of + # .patch files in SRC_URI isn't enough) to prevent regenerating it + # with flex-native which isn't in DEPENDS + touch ${S}/xmlif/xmlif.c +} + do_install:append:class-native() { create_wrapper ${D}${bindir}/xmlto XML_CATALOG_FILES=${sysconfdir}/xml/catalog }