From 4da28a21731e9b9b79f6c8f5563d761634e248e22af36d51a329ec6413c4c7d5 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Mon, 11 Apr 2022 08:10:24 +0000 Subject: [PATCH 1/3] Accepting request 968378 from home:Andreas_Schwab:Factory - fortify-workaround.patch: work around false positive _FORTIFY_SOURCE=3 failure OBS-URL: https://build.opensuse.org/request/show/968378 OBS-URL: https://build.opensuse.org/package/show/Base:System/autogen?expand=0&rev=78 --- autogen.changes | 6 ++ autogen.spec | 6 +- fortify-workaround.patch | 117 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 127 insertions(+), 2 deletions(-) create mode 100644 fortify-workaround.patch diff --git a/autogen.changes b/autogen.changes index bd1fe19..3623f20 100644 --- a/autogen.changes +++ b/autogen.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Apr 8 14:54:03 UTC 2022 - Andreas Schwab + +- fortify-workaround.patch: work around false positive _FORTIFY_SOURCE=3 + failure + ------------------------------------------------------------------- Wed Jun 10 11:53:58 UTC 2020 - Bernhard Wiedemann diff --git a/autogen.spec b/autogen.spec index 1ed6a8c..772bbc9 100644 --- a/autogen.spec +++ b/autogen.spec @@ -1,7 +1,7 @@ # # spec file for package autogen # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -36,13 +36,14 @@ Patch4: sprintf-overflow.patch Patch5: gcc9-fix-wrestrict.patch # PATCH-FIX-UPSTREAM Allow building with guile 3.0 Patch6: guile-version.patch +Patch7: fortify-workaround.patch BuildRequires: fdupes BuildRequires: guile-devel BuildRequires: makeinfo BuildRequires: pkgconfig >= 0.9.0 BuildRequires: pkgconfig(libxml-2.0) Requires(post): %{install_info_prereq} -Requires(preun): %{install_info_prereq} +Requires(preun):%{install_info_prereq} %description AutoGen is a tool designed for generating program files that contain @@ -92,6 +93,7 @@ well. %patch4 -p1 %patch5 -p1 %patch6 -p1 +%patch7 -p1 touch aclocal.m4 configure Makefile.in config-h.in %build diff --git a/fortify-workaround.patch b/fortify-workaround.patch new file mode 100644 index 0000000..aa607ba --- /dev/null +++ b/fortify-workaround.patch @@ -0,0 +1,117 @@ +Index: autogen-5.18.16/agen5/defDirect.c +=================================================================== +--- autogen-5.18.16.orig/agen5/defDirect.c ++++ autogen-5.18.16/agen5/defDirect.c +@@ -650,6 +650,7 @@ doDir_include(directive_enum_t id, char + { + static char const * const apzSfx[] = { DIRECT_INC_DEF_SFX, NULL }; + scan_ctx_t * new_ctx; ++ char *data; + size_t inc_sz; + char full_name[ AG_PATH_MAX + 1 ]; + (void)id; +@@ -684,9 +685,11 @@ doDir_include(directive_enum_t id, char + */ + { + size_t sz = sizeof(scan_ctx_t) + 4 + inc_sz; +- new_ctx = (scan_ctx_t *)AGALOC(sz, "inc def head"); ++ data = AGALOC(sz, "inc def head"); + +- memset(VOIDP(new_ctx), 0, sz); ++ memset(data, 0, sz); ++ new_ctx = (scan_ctx_t *)data; ++ data += sizeof(scan_ctx_t); + new_ctx->scx_line = 1; + } + +@@ -700,7 +703,7 @@ doDir_include(directive_enum_t id, char + + new_ctx->scx_scan = + new_ctx->scx_data = +- scan_next = (char *)(new_ctx + 1); ++ scan_next = data; + + /* + * Read all the data. Usually in a single read, but loop +@@ -829,6 +832,7 @@ doDir_shell(directive_enum_t id, char co + static size_t const endshell_len = sizeof("\n#endshell") - 1; + + scan_ctx_t * pCtx; ++ char *data; + char * pzText = scan_next; + + (void)arg; +@@ -888,8 +892,10 @@ doDir_shell(directive_enum_t id, char co + * This is an extra allocation and copy, but easier than rewriting + * 'loadData()' for this special context. + */ +- pCtx = (scan_ctx_t *)AGALOC(sizeof(scan_ctx_t) + strlen(pzText) + 4, +- "shell output"); ++ data = AGALOC(sizeof(scan_ctx_t) + strlen(pzText) + 4, ++ "shell output"); ++ pCtx = (scan_ctx_t *)data; ++ data += sizeof(scan_ctx_t); + + /* + * Link the new scan data into the context stack +@@ -902,7 +908,7 @@ doDir_shell(directive_enum_t id, char co + */ + AGDUPSTR(pCtx->scx_fname, DIRECT_SHELL_COMP_DEFS, DIRECT_SHELL_COMP_DEFS); + pCtx->scx_scan = +- pCtx->scx_data = (char *)(pCtx + 1); ++ pCtx->scx_data = data; + pCtx->scx_line = 0; + strcpy(pCtx->scx_scan, pzText); + AGFREE(pzText); +Index: autogen-5.18.16/agen5/defLoad.c +=================================================================== +--- autogen-5.18.16.orig/agen5/defLoad.c ++++ autogen-5.18.16/agen5/defLoad.c +@@ -455,7 +455,9 @@ read_defs(void) + * Allocate the space we need for our definitions. + */ + rem_sz = data_sz+4+sizeof(*base_ctx); +- base_ctx = (scan_ctx_t *)AGALOC(rem_sz, "file buf"); ++ data = AGALOC(rem_sz, "file buf"); ++ base_ctx = (scan_ctx_t *)data; ++ data += sizeof (*base_ctx); + memset(VOIDP(base_ctx), 0, rem_sz); + base_ctx->scx_line = 1; + rem_sz = data_sz; +@@ -466,9 +468,8 @@ read_defs(void) + * is never deallocated, we do not have to remember the initial + * value. (It may get reallocated here in this routine, tho...) + */ +- data = + base_ctx->scx_scan = +- base_ctx->scx_data = (char *)(base_ctx + 1); ++ base_ctx->scx_data = data; + base_ctx->scx_next = NULL; + + /* +@@ -531,18 +532,20 @@ read_defs(void) + */ + data_sz += (rem_sz = 0x1000); + dataOff = data - base_ctx->scx_data; +- p = AGREALOC(VOIDP(base_ctx), data_sz + 4 + sizeof(*base_ctx), +- "expand f buf"); ++ data = AGREALOC(VOIDP(base_ctx), data_sz + 4 + sizeof(*base_ctx), ++ "expand f buf"); ++ p = (scan_ctx_t *)data; ++ data += sizeof(*p); + + /* + * The buffer may have moved. Set the data pointer at an + * offset within the new buffer and make sure our base pointer + * has been corrected as well. + */ +- if (p != base_ctx) { ++ { + p->scx_scan = \ +- p->scx_data = (char *)(p + 1); +- data = p->scx_data + dataOff; ++ p->scx_data = data; ++ data += dataOff; + base_ctx = p; + } + } From d042e0509becb74931ae6c49bc32e04eb4152cf6d6b5c0433da2b53d21d6c0f9 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Mon, 11 Apr 2022 13:38:29 +0000 Subject: [PATCH 2/3] osc copypac from project:Base:System package:autogen revision:77 OBS-URL: https://build.opensuse.org/package/show/Base:System/autogen?expand=0&rev=79 --- autogen.changes | 6 -- autogen.spec | 6 +- fortify-workaround.patch | 117 --------------------------------------- 3 files changed, 2 insertions(+), 127 deletions(-) delete mode 100644 fortify-workaround.patch diff --git a/autogen.changes b/autogen.changes index 3623f20..bd1fe19 100644 --- a/autogen.changes +++ b/autogen.changes @@ -1,9 +1,3 @@ -------------------------------------------------------------------- -Fri Apr 8 14:54:03 UTC 2022 - Andreas Schwab - -- fortify-workaround.patch: work around false positive _FORTIFY_SOURCE=3 - failure - ------------------------------------------------------------------- Wed Jun 10 11:53:58 UTC 2020 - Bernhard Wiedemann diff --git a/autogen.spec b/autogen.spec index 772bbc9..1ed6a8c 100644 --- a/autogen.spec +++ b/autogen.spec @@ -1,7 +1,7 @@ # # spec file for package autogen # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -36,14 +36,13 @@ Patch4: sprintf-overflow.patch Patch5: gcc9-fix-wrestrict.patch # PATCH-FIX-UPSTREAM Allow building with guile 3.0 Patch6: guile-version.patch -Patch7: fortify-workaround.patch BuildRequires: fdupes BuildRequires: guile-devel BuildRequires: makeinfo BuildRequires: pkgconfig >= 0.9.0 BuildRequires: pkgconfig(libxml-2.0) Requires(post): %{install_info_prereq} -Requires(preun):%{install_info_prereq} +Requires(preun): %{install_info_prereq} %description AutoGen is a tool designed for generating program files that contain @@ -93,7 +92,6 @@ well. %patch4 -p1 %patch5 -p1 %patch6 -p1 -%patch7 -p1 touch aclocal.m4 configure Makefile.in config-h.in %build diff --git a/fortify-workaround.patch b/fortify-workaround.patch deleted file mode 100644 index aa607ba..0000000 --- a/fortify-workaround.patch +++ /dev/null @@ -1,117 +0,0 @@ -Index: autogen-5.18.16/agen5/defDirect.c -=================================================================== ---- autogen-5.18.16.orig/agen5/defDirect.c -+++ autogen-5.18.16/agen5/defDirect.c -@@ -650,6 +650,7 @@ doDir_include(directive_enum_t id, char - { - static char const * const apzSfx[] = { DIRECT_INC_DEF_SFX, NULL }; - scan_ctx_t * new_ctx; -+ char *data; - size_t inc_sz; - char full_name[ AG_PATH_MAX + 1 ]; - (void)id; -@@ -684,9 +685,11 @@ doDir_include(directive_enum_t id, char - */ - { - size_t sz = sizeof(scan_ctx_t) + 4 + inc_sz; -- new_ctx = (scan_ctx_t *)AGALOC(sz, "inc def head"); -+ data = AGALOC(sz, "inc def head"); - -- memset(VOIDP(new_ctx), 0, sz); -+ memset(data, 0, sz); -+ new_ctx = (scan_ctx_t *)data; -+ data += sizeof(scan_ctx_t); - new_ctx->scx_line = 1; - } - -@@ -700,7 +703,7 @@ doDir_include(directive_enum_t id, char - - new_ctx->scx_scan = - new_ctx->scx_data = -- scan_next = (char *)(new_ctx + 1); -+ scan_next = data; - - /* - * Read all the data. Usually in a single read, but loop -@@ -829,6 +832,7 @@ doDir_shell(directive_enum_t id, char co - static size_t const endshell_len = sizeof("\n#endshell") - 1; - - scan_ctx_t * pCtx; -+ char *data; - char * pzText = scan_next; - - (void)arg; -@@ -888,8 +892,10 @@ doDir_shell(directive_enum_t id, char co - * This is an extra allocation and copy, but easier than rewriting - * 'loadData()' for this special context. - */ -- pCtx = (scan_ctx_t *)AGALOC(sizeof(scan_ctx_t) + strlen(pzText) + 4, -- "shell output"); -+ data = AGALOC(sizeof(scan_ctx_t) + strlen(pzText) + 4, -+ "shell output"); -+ pCtx = (scan_ctx_t *)data; -+ data += sizeof(scan_ctx_t); - - /* - * Link the new scan data into the context stack -@@ -902,7 +908,7 @@ doDir_shell(directive_enum_t id, char co - */ - AGDUPSTR(pCtx->scx_fname, DIRECT_SHELL_COMP_DEFS, DIRECT_SHELL_COMP_DEFS); - pCtx->scx_scan = -- pCtx->scx_data = (char *)(pCtx + 1); -+ pCtx->scx_data = data; - pCtx->scx_line = 0; - strcpy(pCtx->scx_scan, pzText); - AGFREE(pzText); -Index: autogen-5.18.16/agen5/defLoad.c -=================================================================== ---- autogen-5.18.16.orig/agen5/defLoad.c -+++ autogen-5.18.16/agen5/defLoad.c -@@ -455,7 +455,9 @@ read_defs(void) - * Allocate the space we need for our definitions. - */ - rem_sz = data_sz+4+sizeof(*base_ctx); -- base_ctx = (scan_ctx_t *)AGALOC(rem_sz, "file buf"); -+ data = AGALOC(rem_sz, "file buf"); -+ base_ctx = (scan_ctx_t *)data; -+ data += sizeof (*base_ctx); - memset(VOIDP(base_ctx), 0, rem_sz); - base_ctx->scx_line = 1; - rem_sz = data_sz; -@@ -466,9 +468,8 @@ read_defs(void) - * is never deallocated, we do not have to remember the initial - * value. (It may get reallocated here in this routine, tho...) - */ -- data = - base_ctx->scx_scan = -- base_ctx->scx_data = (char *)(base_ctx + 1); -+ base_ctx->scx_data = data; - base_ctx->scx_next = NULL; - - /* -@@ -531,18 +532,20 @@ read_defs(void) - */ - data_sz += (rem_sz = 0x1000); - dataOff = data - base_ctx->scx_data; -- p = AGREALOC(VOIDP(base_ctx), data_sz + 4 + sizeof(*base_ctx), -- "expand f buf"); -+ data = AGREALOC(VOIDP(base_ctx), data_sz + 4 + sizeof(*base_ctx), -+ "expand f buf"); -+ p = (scan_ctx_t *)data; -+ data += sizeof(*p); - - /* - * The buffer may have moved. Set the data pointer at an - * offset within the new buffer and make sure our base pointer - * has been corrected as well. - */ -- if (p != base_ctx) { -+ { - p->scx_scan = \ -- p->scx_data = (char *)(p + 1); -- data = p->scx_data + dataOff; -+ p->scx_data = data; -+ data += dataOff; - base_ctx = p; - } - } From 1ab02497896f63411e331ee9782796fe2db1a1c44d83c38ae1a3e773961fc522 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Wed, 4 May 2022 16:12:19 +0000 Subject: [PATCH 3/3] Accepting request 970897 from home:marxin:branches:Base:System - Add upstream patch autogen-avoid-GCC-code-analysis-bug.patch in order to support -D_FORTIFY_SOURCE=3 with GCC 12. - Use autosetup. OBS-URL: https://build.opensuse.org/request/show/970897 OBS-URL: https://build.opensuse.org/package/show/Base:System/autogen?expand=0&rev=80 --- autogen-avoid-GCC-code-analysis-bug.patch | 101 ++++++++++++++++++++++ autogen.changes | 7 ++ autogen.spec | 13 +-- 3 files changed, 112 insertions(+), 9 deletions(-) create mode 100644 autogen-avoid-GCC-code-analysis-bug.patch diff --git a/autogen-avoid-GCC-code-analysis-bug.patch b/autogen-avoid-GCC-code-analysis-bug.patch new file mode 100644 index 0000000..6e0adf9 --- /dev/null +++ b/autogen-avoid-GCC-code-analysis-bug.patch @@ -0,0 +1,101 @@ +From 65163ab8c318a501f019c64490aea188e258b954 Mon Sep 17 00:00:00 2001 +From: Bruce Korb +Date: Tue, 19 Apr 2022 09:10:37 -0700 +Subject: [PATCH] avoid GCC code analysis bug + +--- + agen5/defLoad.c | 47 ++++++++++++++++++++++++++--------------------- + 1 file changed, 26 insertions(+), 21 deletions(-) + +diff --git a/agen5/defLoad.c b/agen5/defLoad.c +index e40f2e80..99258cd6 100644 +--- a/agen5/defLoad.c ++++ b/agen5/defLoad.c +@@ -453,17 +453,28 @@ read_defs(void) + FILE * fp; + def_input_mode_t in_mode = ready_def_input(&def_fname, &data_sz); + ++ /* ++ * "ready_def_input" has a lot of side effects. It's possible that ++ * there are no definitions, so "in_mode" is set to DONE and there's ++ * nothing to do. ++ */ + if (in_mode == INPUT_DONE) + return; + + /* + * Allocate the space we need for our definitions. ++ * "data_sz" was set by read_def_input to the size of the ++ * definitions file (or 4096 if we're reading from a fifo file). ++ * In that alternate case, we'll start the input size at 4096 bytes. ++ * The allocation includes space for context and a NUL byte or two + */ +- rem_sz = data_sz+4+sizeof(*base_ctx); +- base_ctx = (scan_ctx_t *)AGALOC(rem_sz, "file buf"); +- memset(VOIDP(base_ctx), 0, rem_sz); ++ { ++ size_t sz = data_sz + sizeof(long) + sizeof(*base_ctx); ++ base_ctx = (scan_ctx_t *)AGALOC(sz, "file buf"); ++ memset(VOIDP(base_ctx), 0, sz); ++ } + base_ctx->scx_line = 1; +- rem_sz = data_sz; ++ rem_sz = data_sz; // size available for storing def text + + /* + * Our base context will have its currency pointer set to this +@@ -487,6 +498,9 @@ read_defs(void) + if (fp == NULL) + AG_CANT(READ_DEF_OPEN, def_fname); + ++ /* ++ * If we're emitting dependency information, then do so. ++ */ + if (dep_fp != NULL) + add_source_file(def_fname); + } +@@ -521,8 +535,7 @@ read_defs(void) + * See if there is any space left + */ + if (rem_sz == 0) { +- scan_ctx_t * p; +- off_t dataOff; ++ off_t scan_off; + + /* + * IF it is a regular file, then we are done +@@ -532,24 +545,16 @@ read_defs(void) + + /* + * We have more data and we are out of space. +- * Try to reallocate our input buffer. ++ * AGREALOC will succeed or not return. + */ + data_sz += (rem_sz = 0x1000); +- dataOff = data - base_ctx->scx_data; +- p = AGREALOC(VOIDP(base_ctx), data_sz + 4 + sizeof(*base_ctx), +- "expand f buf"); ++ scan_off = data - base_ctx->scx_data; ++ base_ctx = AGREALOC(VOIDP(base_ctx), data_sz + 4 + sizeof(*base_ctx), ++ "expand f buf"); + +- /* +- * The buffer may have moved. Set the data pointer at an +- * offset within the new buffer and make sure our base pointer +- * has been corrected as well. +- */ +- if (p != base_ctx) { +- p->scx_scan = \ +- p->scx_data = (char *)(p + 1); +- data = p->scx_data + dataOff; +- base_ctx = p; +- } ++ base_ctx->scx_scan = \ ++ base_ctx->scx_data = (char *)(base_ctx + 1); ++ data = base_ctx->scx_data + scan_off; + } + } + +-- +2.35.3 + diff --git a/autogen.changes b/autogen.changes index bd1fe19..41dc72a 100644 --- a/autogen.changes +++ b/autogen.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Apr 19 19:22:33 UTC 2022 - Martin Liška + +- Add upstream patch autogen-avoid-GCC-code-analysis-bug.patch + in order to support -D_FORTIFY_SOURCE=3 with GCC 12. +- Use autosetup. + ------------------------------------------------------------------- Wed Jun 10 11:53:58 UTC 2020 - Bernhard Wiedemann diff --git a/autogen.spec b/autogen.spec index 1ed6a8c..2d1abe5 100644 --- a/autogen.spec +++ b/autogen.spec @@ -1,7 +1,7 @@ # # spec file for package autogen # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -36,13 +36,14 @@ Patch4: sprintf-overflow.patch Patch5: gcc9-fix-wrestrict.patch # PATCH-FIX-UPSTREAM Allow building with guile 3.0 Patch6: guile-version.patch +Patch7: autogen-avoid-GCC-code-analysis-bug.patch BuildRequires: fdupes BuildRequires: guile-devel BuildRequires: makeinfo BuildRequires: pkgconfig >= 0.9.0 BuildRequires: pkgconfig(libxml-2.0) Requires(post): %{install_info_prereq} -Requires(preun): %{install_info_prereq} +Requires(preun):%{install_info_prereq} %description AutoGen is a tool designed for generating program files that contain @@ -85,13 +86,7 @@ file options, and the documentation that should go with your program as well. %prep -%setup -q -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 -%patch5 -p1 -%patch6 -p1 +%autosetup -p1 touch aclocal.m4 configure Makefile.in config-h.in %build