代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/bash 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 7f7ee0e9c6766ff5d3de542d03c59590c4a5a44a Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Mon, 17 Jul 2023 17:35:59 -0400
Subject: [PATCH] fix for leak when completing command word with glob pattern
that matches multiple files; preserve export attribute when unsetting local
variable in case it is reset; fix for using nl_langinfo when performing
charset conversions
---
bashline.c | 6 +++++-
lib/sh/unicode.c | 6 +++++-
variables.c | 6 ++++++
3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/bashline.c b/bashline.c
index c85b05b..2e0c0c7 100644
--- a/bashline.c
+++ b/bashline.c
@@ -2203,7 +2203,11 @@ globword:
local_index = 0;
if (glob_matches[1] && rl_completion_type == TAB) /* multiple matches are bad */
- return ((char *)NULL);
+ {
+ strvec_dispose (glob_matches);
+ glob_matches = (char **)NULL;
+ return ((char *)NULL);
+ }
}
while (val = glob_matches[local_index++])
diff --git a/lib/sh/unicode.c b/lib/sh/unicode.c
index d781353..9e3c9da 100644
--- a/lib/sh/unicode.c
+++ b/lib/sh/unicode.c
@@ -35,6 +35,10 @@
# include <iconv.h>
#endif
+#if HAVE_LANGINFO_CODESET
+# include <langinfo.h>
+#endif
+
#include <xmalloc.h>
#ifndef USHORT_MAX
@@ -277,7 +281,7 @@ u32cconv (c, s)
{
#if HAVE_LOCALE_CHARSET
charset = locale_charset ();
-#elif HAVE_NL_LANGINFO
+#elif HAVE_LANGINFO_CODESET
charset = nl_langinfo (CODESET);
#else
charset = stub_charset ();
diff --git a/variables.c b/variables.c
index 1a0c2c4..f08575a 100644
--- a/variables.c
+++ b/variables.c
@@ -4016,10 +4016,16 @@ makunbound (name, vc)
FREE (nameref_cell (old_var));
else
FREE (value_cell (old_var));
+#if 0
/* Reset the attributes. Preserve the export attribute if the variable
came from a temporary environment. Make sure it stays local, and
make it invisible. */
old_var->attributes = (exported_p (old_var) && tempvar_p (old_var)) ? att_exported : 0;
+#else /* TAG:bash-5.3 look at this again */
+ /* Reset the attributes, but preserve the export attribute.
+ Make sure it stays local, and make it invisible. */
+ old_var->attributes = exported_p (old_var) ? att_exported : 0;
+#endif
VSETATTR (old_var, att_local);
VSETATTR (old_var, att_invisible);
var_setvalue (old_var, (char *)NULL);
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。