From faeb32176e4cd5af6f40f191d7f49ecb4fdb239f Mon Sep 17 00:00:00 2001 From: cenhuilin Date: Fri, 22 Mar 2024 17:33:49 +0800 Subject: [PATCH] sync patches from community --- backport-coverity-utimens.patch | 52 ++++++++++++++++++++ backport-expr-unmatched-par.patch | 81 +++++++++++++++++++++++++++++++ backport-fuse-portal.patch | 38 +++++++++++++++ coreutils.spec | 11 ++++- 4 files changed, 181 insertions(+), 1 deletion(-) create mode 100644 backport-coverity-utimens.patch create mode 100644 backport-expr-unmatched-par.patch create mode 100644 backport-fuse-portal.patch diff --git a/backport-coverity-utimens.patch b/backport-coverity-utimens.patch new file mode 100644 index 0000000..e5422ba --- /dev/null +++ b/backport-coverity-utimens.patch @@ -0,0 +1,52 @@ +From 6ff2aab365a19fdba9ec7f1c6083f0f9f24b8e03 Mon Sep 17 00:00:00 2001 +From: Paul Eggert +Date: Fri, 22 Mar 2024 16:47:50 +0800 +Subject: [PATCH] utimens: fix confusing arg type in internal func +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Although the old code was technically correct, this was accidental +and it understandably confused Coverity. Reported by Ondrej Dubaj in: +https://lists.gnu.org/r/bug-tar/2021-04/msg00000.html +* lib/utimens.c (update_timespec): Change arg type from ‘struct +timespec *[2]’ (pointer to array of 2 pointers to timespecs) to +‘struct timespec **’ (pointer to pointer to the first timespec in +an array of 2 timespecs). Although the old code happened to be +technically correct, it was misleading and confused Coverity. +And though the type ‘struct timespec (**)[2]’ (pointer to pointer +to array of 2 timespecs) would perhaps be more technically +correct, it would be almost as confusing and would require changes +elsewhere in this file; let’s quit while we’re ahead. + +Upstream-commit: a3a946f670718d0dee5a7425ad5ac0a29fb46ea1 +Signed-off-by: Kamil Dudka +--- + lib/utimens.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/lib/utimens.c b/lib/utimens.c +index 3f53942..ea8c672 100644 +--- a/lib/utimens.c ++++ b/lib/utimens.c +@@ -123,14 +123,14 @@ validate_timespec (struct timespec timespec[2]) + return result + (utime_omit_count == 1); + } + +-/* Normalize any UTIME_NOW or UTIME_OMIT values in *TS, using stat +- buffer STATBUF to obtain the current timestamps of the file. If ++/* Normalize any UTIME_NOW or UTIME_OMIT values in (*TS)[0] and (*TS)[1], ++ using STATBUF to obtain the current timestamps of the file. If + both times are UTIME_NOW, set *TS to NULL (as this can avoid some + permissions issues). If both times are UTIME_OMIT, return true + (nothing further beyond the prior collection of STATBUF is + necessary); otherwise return false. */ + static bool +-update_timespec (struct stat const *statbuf, struct timespec *ts[2]) ++update_timespec (struct stat const *statbuf, struct timespec **ts) + { + struct timespec *timespec = *ts; + if (timespec[0].tv_nsec == UTIME_OMIT +-- +2.27.0 + diff --git a/backport-expr-unmatched-par.patch b/backport-expr-unmatched-par.patch new file mode 100644 index 0000000..ef046c8 --- /dev/null +++ b/backport-expr-unmatched-par.patch @@ -0,0 +1,81 @@ +From 04002b64fe0e1178bee0762fd5428625f0731d7e Mon Sep 17 00:00:00 2001 +From: Paul Eggert +Date: Fri, 22 Mar 2024 17:20:05 +0800 +Subject: [PATCH] expr: fix bug with unmatched \(...\) + +Problem reported by Qiuhao Li. +* doc/coreutils.texi (String expressions): +Document the correct behavior, which POSIX requires. +* src/expr.c (docolon): Treat unmatched \(...\) as empty. +* tests/misc/expr.pl: New test. + +Upstream-commit: 735083ba24878075235007b4417982ad5700436d +Signed-off-by: Kamil Dudka +--- + doc/coreutils.texi | 14 ++++++++------ + src/expr.c | 9 +++++++-- + tests/misc/expr.pl | 3 +++ + 3 files changed, 18 insertions(+), 8 deletions(-) + +diff --git a/doc/coreutils.texi b/doc/coreutils.texi +index bed55f7..afcc1fa 100644 +--- a/doc/coreutils.texi ++++ b/doc/coreutils.texi +@@ -13518,12 +13518,14 @@ second is considered to be a (basic, a la GNU @code{grep}) regular + expression, with a @code{^} implicitly prepended. The first argument is + then matched against this regular expression. + +-If the match succeeds and @var{regex} uses @samp{\(} and @samp{\)}, the +-@code{:} expression returns the part of @var{string} that matched the +-subexpression; otherwise, it returns the number of characters matched. +- +-If the match fails, the @code{:} operator returns the null string if +-@samp{\(} and @samp{\)} are used in @var{regex}, otherwise 0. ++If @var{regex} does not use @samp{\(} and @samp{\)}, the @code{:} ++expression returns the number of characters matched, or 0 if the match ++fails. ++ ++If @var{regex} uses @samp{\(} and @samp{\)}, the @code{:} expression ++returns the part of @var{string} that matched the subexpression, or ++the null string if the match failed or the subexpression did not ++contribute to the match. + + @kindex \( @r{regexp operator} + Only the first @samp{\( @dots{} \)} pair is relevant to the return +diff --git a/src/expr.c b/src/expr.c +index e134872..0616a42 100644 +--- a/src/expr.c ++++ b/src/expr.c +@@ -721,8 +721,13 @@ docolon (VALUE *sv, VALUE *pv) + /* Were \(...\) used? */ + if (re_buffer.re_nsub > 0) + { +- sv->u.s[re_regs.end[1]] = '\0'; +- v = str_value (sv->u.s + re_regs.start[1]); ++ if (re_regs.end[1] < 0) ++ v = str_value (""); ++ else ++ { ++ sv->u.s[re_regs.end[1]] = '\0'; ++ v = str_value (sv->u.s + re_regs.start[1]); ++ } + } + else + { +diff --git a/tests/misc/expr.pl b/tests/misc/expr.pl +index e45f8e7..e57f79d 100755 +--- a/tests/misc/expr.pl ++++ b/tests/misc/expr.pl +@@ -84,6 +84,9 @@ my @Tests = + # In 5.94 and earlier, anchors incorrectly matched newlines. + ['anchor', "'a\nb' : 'a\$'", {OUT => '0'}, {EXIT => 1}], + ++ # In 8.32, \( ... \) that did not match caused memory errors. ++ ['emptysub', '"a" : "\\(b\\)*"', {OUT => ''}, {EXIT => 1}], ++ + # These tests are taken from grep/tests/bre.tests. + ['bre1', '"abc" : "a\\(b\\)c"', {OUT => 'b'}], + ['bre2', '"a(" : "a("', {OUT => '2'}], +-- +2.27.0 + diff --git a/backport-fuse-portal.patch b/backport-fuse-portal.patch new file mode 100644 index 0000000..3821fea --- /dev/null +++ b/backport-fuse-portal.patch @@ -0,0 +1,38 @@ +From 330093d8fe5a83d85bb866cf263c671ef737a2be Mon Sep 17 00:00:00 2001 +From: Kamil Dudka +Date: Fri, 22 Mar 2024 17:05:28 +0800 +Subject: [PATCH] mountlist: recognize fuse.portal as dummy file system + +This was originally proposed at: + + https://lists.gnu.org/archive/html/bug-gnulib/2021-02/msg00053.html + +As the full review might take some time, would it be possible to apply +at least the part related to fuse.portal file systems? They started to +cause problems recently: + + https://bugs.launchpad.net/ubuntu/+source/xdg-desktop-portal/+bug/1905623 + https://github.com/muesli/duf/issues/35 + https://bugzilla.redhat.com/1913358 + +Upstream-commit: 9a38d499ca16f2f4304992eb1ab0894cd0b478e1 +Signed-off-by: Kamil Dudka +--- + lib/mountlist.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/lib/mountlist.c b/lib/mountlist.c +index 7abe024..189cc81 100644 +--- a/lib/mountlist.c ++++ b/lib/mountlist.c +@@ -170,6 +170,7 @@ + || strcmp (Fs_type, "debugfs") == 0 \ + || strcmp (Fs_type, "devpts") == 0 \ + || strcmp (Fs_type, "fusectl") == 0 \ ++ || strcmp (Fs_type, "fuse.portal") == 0 \ + || strcmp (Fs_type, "mqueue") == 0 \ + || strcmp (Fs_type, "rpc_pipefs") == 0 \ + || strcmp (Fs_type, "sysfs") == 0 \ +-- +2.27.0 + diff --git a/coreutils.spec b/coreutils.spec index 31ce352..4476c4d 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -1,6 +1,6 @@ Name: coreutils Version: 8.32 -Release: 11 +Release: 12 License: GPLv3+ Summary: A set of basic GNU tools commonly used in shell scripts Url: https://www.gnu.org/software/coreutils/ @@ -48,6 +48,9 @@ Patch30: backport-setenv-Don-t-crash-if-malloc-returns-NULL.patch Patch31: backport-who-don-t-crash-if-clock-gyrates.patch Patch32: backport-doc-od-strings-clarify-operation.patch Patch33: backport-fix-mem-leaks.patch +Patch34: backport-coverity-utimens.patch +Patch35: backport-fuse-portal.patch +Patch36: backport-expr-unmatched-par.patch Conflicts: filesystem < 3 # To avoid clobbering installs @@ -166,6 +169,12 @@ fi %{_mandir}/man*/* %changelog +* Fri Mar 22 2024 cenhuilin - 8.32-12 +- sync patches from community +- add backport-coverity-utimens.patch + backport-fuse-portal.patch + backport-expr-unmatched-par.patch + * Tue Mar 19 2024 cenhuilin - 8.32-11 - sync patches from community - add backport-fix-mem-leaks.patch -- Gitee