diff --git a/0001-fix-utshell-continue-help-countine.patch b/0001-fix-utshell-continue-help-countine.patch new file mode 100644 index 0000000000000000000000000000000000000000..a05e8a80c607ef56e27cfb86154d04161a1d4671 --- /dev/null +++ b/0001-fix-utshell-continue-help-countine.patch @@ -0,0 +1,67 @@ +From d4b94557da630e74bf4128d82b5cc6942225456e Mon Sep 17 00:00:00 2001 +From: wangmengc +Date: Mon, 8 Apr 2024 15:02:35 +0800 +Subject: [PATCH 1/8] =?UTF-8?q?fix=20utshell=20continue=20--help=20?= + =?UTF-8?q?=E5=92=8Ccountine=20=E5=AD=98=E5=9C=A8=E5=A4=9A=E4=BD=99?= + =?UTF-8?q?=E6=8F=90=E7=A4=BA?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + builtins_rust/break_1/src/lib.rs | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/builtins_rust/break_1/src/lib.rs b/builtins_rust/break_1/src/lib.rs +index 9da3f71..d333247 100644 +--- a/builtins_rust/break_1/src/lib.rs ++++ b/builtins_rust/break_1/src/lib.rs +@@ -13,7 +13,7 @@ use rcommon::{WordList, EXECUTION_FAILURE, EXECUTION_SUCCESS, EX_USAGE}; + use rhelp::r_builtin_help; + + type intmax_t = c_long; +-/* ++ + #[macro_export] + macro_rules! ISHELP { + ($s:expr) => { +@@ -25,12 +25,12 @@ macro_rules! ISHELP { + macro_rules! CHECK_HELPOPT { + ($l:expr) => { + if $l !=std::ptr::null_mut() && (*$l).word !=std::ptr::null_mut() && ISHELP!((*(*$l).word).word) ==0 { +- builtin_help (); ++ r_builtin_help (); + return EX_USAGE; + } + } + } +-*/ ++ + fn checkhelp(l: *mut WordList) -> i32 { + unsafe { + let tmp = CString::new("--help").unwrap(); +@@ -64,8 +64,8 @@ pub extern "C" fn r_break_builtin(list: *mut WordList) -> i32 { + //println!("enter r_break_builtin"); + let mut newbreak: intmax_t = 1 as intmax_t; + unsafe { +- checkhelp(list); +- //CHECK_HELPOPT! (list); ++ //checkhelp(list); ++ CHECK_HELPOPT! (list); + if check_loop_level() == 0 { + return EXECUTION_SUCCESS!(); + } +@@ -92,8 +92,8 @@ pub extern "C" fn r_break_builtin(list: *mut WordList) -> i32 { + pub extern "C" fn r_continue_builtin(list: *mut WordList) -> i32 { + let mut newcont: intmax_t = 0 as intmax_t; + unsafe { +- //CHECK_HELPOPT! (list); +- checkhelp(list); ++ CHECK_HELPOPT! (list); ++ //checkhelp(list); + } + if check_loop_level() == 0 { + return EXECUTION_SUCCESS!(); +-- +2.43.0 + diff --git a/0002-fix-kill-l.patch b/0002-fix-kill-l.patch new file mode 100644 index 0000000000000000000000000000000000000000..eefe07db135b5bc88c75d2b3fa8aab6b5c9a5a1e --- /dev/null +++ b/0002-fix-kill-l.patch @@ -0,0 +1,29 @@ +From 4a7427984d2937dfa99cb76ff2c4c07479079852 Mon Sep 17 00:00:00 2001 +From: wangmengc +Date: Mon, 8 Apr 2024 15:24:17 +0800 +Subject: [PATCH 2/8] =?UTF-8?q?fix=20=20kill=20-l=E5=BA=8F=E5=8F=B7?= + =?UTF-8?q?=E6=9C=89=E8=AF=AF?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + builtins_rust/common/src/lib.rs | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/builtins_rust/common/src/lib.rs b/builtins_rust/common/src/lib.rs +index 78566eb..1184461 100644 +--- a/builtins_rust/common/src/lib.rs ++++ b/builtins_rust/common/src/lib.rs +@@ -1516,7 +1516,7 @@ pub extern "C" fn r_display_signal_list(mut list: *mut WordList, forcecols: i32) + } + } else { + print!( +- "{:02}{} {}", ++ "{:>2}{} {}", + i, + ")", + CStr::from_ptr(name).to_str().unwrap().to_owned() +-- +2.43.0 + diff --git a/0003-fix-exec-c-exec-l-Redundant-output.patch b/0003-fix-exec-c-exec-l-Redundant-output.patch new file mode 100644 index 0000000000000000000000000000000000000000..6467387259c153dfab0707342ae5a6a01e3f071b --- /dev/null +++ b/0003-fix-exec-c-exec-l-Redundant-output.patch @@ -0,0 +1,24 @@ +From 4b0f8a65e71da4ba05ac7850cd2f20fb11f1e174 Mon Sep 17 00:00:00 2001 +From: wangmengc +Date: Mon, 8 Apr 2024 15:31:41 +0800 +Subject: [PATCH 4/8] fix exec -c exec -l Redundant output + +--- + builtins_rust/exec/src/lib.rs | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/builtins_rust/exec/src/lib.rs b/builtins_rust/exec/src/lib.rs +index 4edefab..2e14b41 100644 +--- a/builtins_rust/exec/src/lib.rs ++++ b/builtins_rust/exec/src/lib.rs +@@ -199,7 +199,6 @@ pub extern "C" fn r_exec_builtin(mut list: *mut WordList) -> i32 { + } else { + //exec后直接给命令 + command = search_for_command(*args.offset(0), 1); +- println!("command:{}", CStr::from_ptr(command).to_str().unwrap()); + } + + if command.is_null() { +-- +2.43.0 + diff --git a/0004-fix-complete-p-no-display.patch b/0004-fix-complete-p-no-display.patch new file mode 100644 index 0000000000000000000000000000000000000000..02f9ee3c64bad94f72e2c96849509c04523cc107 --- /dev/null +++ b/0004-fix-complete-p-no-display.patch @@ -0,0 +1,99 @@ +From f52a22e4cf9271cf0774ee652b37bd06a6a672f0 Mon Sep 17 00:00:00 2001 +From: wangmengc +Date: Mon, 8 Apr 2024 16:22:23 +0800 +Subject: [PATCH 6/8] fix complete -p no display + +--- + configure | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +diff --git a/configure b/configure +index 285b377..57aca43 100755 +--- a/configure ++++ b/configure +@@ -1,7 +1,7 @@ + #! /bin/sh + # From configure.ac for Bash 5.1, version 5.022. + # Guess values for system-dependent variables and create Makefiles. +-# Generated by GNU Autoconf 2.71 for utshell 0.1-release. ++# Generated by GNU Autoconf 2.71 for utshell 5.1-release. + # + # Report bugs to . + # +@@ -612,8 +612,8 @@ MAKEFLAGS= + # Identity of this package. + PACKAGE_NAME='utshell' + PACKAGE_TARNAME='utshell' +-PACKAGE_VERSION='0.1-release' +-PACKAGE_STRING='utshell 0.1-release' ++PACKAGE_VERSION='5.1-release' ++PACKAGE_STRING='utshell 5.1-release' + PACKAGE_BUGREPORT='bug-utshell@gnu.org' + PACKAGE_URL='' + +@@ -1461,7 +1461,7 @@ if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +-\`configure' configures utshell 0.1-release to adapt to many kinds of systems. ++\`configure' configures utshell 5.1-release to adapt to many kinds of systems. + + Usage: $0 [OPTION]... [VAR=VALUE]... + +@@ -1527,7 +1527,7 @@ fi + + if test -n "$ac_init_help"; then + case $ac_init_help in +- short | recursive ) echo "Configuration of utshell 0.1-release:";; ++ short | recursive ) echo "Configuration of utshell 5.1-release:";; + esac + cat <<\_ACEOF + +@@ -1729,7 +1729,7 @@ fi + test -n "$ac_init_help" && exit $ac_status + if $ac_init_version; then + cat <<\_ACEOF +-utshell configure 0.1-release ++utshell configure 5.1-release + generated by GNU Autoconf 2.71 + + Copyright (C) 2021 Free Software Foundation, Inc. +@@ -2386,7 +2386,7 @@ cat >config.log <<_ACEOF + This file contains any messages produced by compilers while + running configure, to aid debugging if configure makes a mistake. + +-It was created by utshell $as_me 0.1-release, which was ++It was created by utshell $as_me 5.1-release, which was + generated by GNU Autoconf 2.71. Invocation command line was + + $ $0$ac_configure_args_raw +@@ -3164,7 +3164,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + ac_config_headers="$ac_config_headers config.h" + + +-BASHVERS=0.1 ++BASHVERS=5.1 + RELSTATUS=release + + case "$RELSTATUS" in +@@ -22732,7 +22732,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + # report actual input values of CONFIG_FILES etc. instead of their + # values after options handling. + ac_log=" +-This file was extended by utshell $as_me 0.1-release, which was ++This file was extended by utshell $as_me 5.1-release, which was + generated by GNU Autoconf 2.71. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES +@@ -22800,7 +22800,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\ + cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_cs_config='$ac_cs_config_escaped' + ac_cs_version="\\ +-utshell config.status 0.1-release ++utshell config.status 5.1-release + configured by $0, generated by GNU Autoconf 2.71, + with options \\"\$ac_cs_config\\" + +-- +2.43.0 + diff --git a/0005-fix-translation-files-correlation.patch b/0005-fix-translation-files-correlation.patch new file mode 100644 index 0000000000000000000000000000000000000000..e6b7cf85f3ddadcf806ddbc882bb9c5b1ea9d570 --- /dev/null +++ b/0005-fix-translation-files-correlation.patch @@ -0,0 +1,272 @@ +From 96968ffb832cf368d9ba13a420a2a516e076204c Mon Sep 17 00:00:00 2001 +From: wangmengc +Date: Tue, 9 Apr 2024 17:02:28 +0800 +Subject: [PATCH] fix translation files correlation + +--- + resources/en-US/message.ftl | 46 +++++++++++++++++++---------------- + resources/zh-CN/message.ftl | 48 +++++++++++++++++++------------------ + resources/zh-HK/message.ftl | 47 ++++++++++++++++++------------------ + 3 files changed, 74 insertions(+), 67 deletions(-) + +diff --git a/resources/en-US/message.ftl b/resources/en-US/message.ftl +index 8e6800c..26c2a3c 100644 +--- a/resources/en-US/message.ftl ++++ b/resources/en-US/message.ftl +@@ -645,6 +645,9 @@ $cmdName -> + Arguments: + NAME Each NAME is searched for in $PATH and added to the list + of remembered commands. ++ ++ Exit Status: ++ Returns success unless NAME is not found or an invalid option is given. + + + [help] +@@ -821,7 +824,7 @@ $cmdName -> + Exit Status: + Returns success unless job control is not enabled or an error occurs. + +-[eval] ++[test] + Evaluate conditional expression. + + Exits with a status of 0 (true) or 1 (false) depending on +@@ -902,6 +905,16 @@ $cmdName -> + Returns success if EXPR evaluates to true; fails if EXPR evaluates to + false or an invalid argument is given. + ++[eval] ++ Execute arguments as a shell command. ++ ++ Combine ARGs into a single string, use the result as input to the shell, ++ and execute the resulting commands. ++ ++ Exit Status: ++ Returns exit status of command or success if command is null. ++ ++ + [times] + Display process times. + +@@ -1398,26 +1411,17 @@ $cmdName -> + Returns success unless an invalid option is given or a NAME is read-only. + + [local] +- Remember or display program locations. +- +- Determine and remember the full pathname of each command NAME. If +- no arguments are given, information about remembered commands is +- displayed. +- +- Options: +- -d forget the remembered location of each NAME +- -l display in a format that may be reused as input +- -p pathname use PATHNAME as the full pathname of NAME +- -r forget all remembered locations +- -t print the remembered location of each NAME, preceding +- each location with the corresponding NAME if multiple +- NAMEs are given +- Arguments: +- NAME Each NAME is searched for in $PATH and added to the list +- of remembered commands. +- +- Exit Status: +- Returns success unless NAME is not found or an invalid option is given. ++ Define local variables. ++ ++ Create a local variable called NAME, and give it VALUE. OPTION can ++ be any option accepted by `declare'. ++ ++ Local variables can only be used within a function; they are visible ++ only to the function where they are defined and its children. ++ ++ Exit Status: ++ Returns success unless an invalid option is supplied, a variable ++ assignment error occurs, or the shell is not executing a function. + + [export] + Set export attribute for shell variables. +diff --git a/resources/zh-CN/message.ftl b/resources/zh-CN/message.ftl +index 4cb92a5..aaff61e 100644 +--- a/resources/zh-CN/message.ftl ++++ b/resources/zh-CN/message.ftl +@@ -249,6 +249,7 @@ $cmdName -> + 信号名称大小写敏感且可以使用 SIG 前缀。信号可用 \kill -信号 $$\ + 发送给 shell。 + ++ 退出状态: + 返回成功,除非使用了无效的选项或者 SIGSPEC。 + + [alias] +@@ -652,7 +653,7 @@ $cmdName -> + -s 以单条记录追加 ARG 到历史列表中 + + 如果给定了 FILENAME 文件名,则它将被作为历史文件。否则 +- 如果 $HISTFILE 变量有值的话使用之,不然使用 ~/.bash_history 文件。 ++ 如果 $HISTFILE 变量有值的话使用之,不然使用 ~/.utshell_history 文件。 + + 如果 $HISTTIMEFORMAT 变量被设定并且不为空,它的值会被用于 + strftime(3) 的格式字符串来打印与每一个显示的历史条目想关联的 +@@ -749,6 +750,9 @@ $cmdName -> + + 操作符按照优先级进行估值。括号中的子表达式将被先估值,并可取代上述表达式 + 规则。 ++ ++ 退出状态: ++ 如果最后一个 ARG 参数估值为 0,则 let 返回 1; 否则 let 返回 0。 + + [shift] + 移位位置参数。 +@@ -772,7 +776,7 @@ $cmdName -> + 退出状态: + 返回成功,除非没有启用任务控制或者有错误发生。 + +-[eval] ++[test] + 对条件表达式进行估值。 + + 根据 EXPR 表达式的估值以状态 0 (真) 或 1 (伪) 退出。 +@@ -844,6 +848,15 @@ $cmdName -> + 退出状态: + 如果 EXPR 表达式估值为真则返回成功;如果 EXPR 表达式估值 + 为假或者使用了无效的参数则返回失败。 ++ ++[eval] ++ 将参数作为 shell 命令执行。 ++ ++ 将 ARGs 合成一个字符串,用结果作为 shell 的输入, ++ 并且执行得到的命令。 ++ ++ 退出状态: ++ 以命令的状态退出,或者在命令为空的情况下返回成功。 + + [times] + 显示进程时间 +@@ -1260,27 +1273,16 @@ $cmdName -> + 返回成功,除非使用了无效的选项或者 NAME 名称为只读。 + + [local] +- 记住或显示程序位置。 +- +- 确定并记住每一个给定 NAME 名称的命令的完整路径。 +- 如果不提供参数,则显示已经记住的命令的信息。 +- +- 选项: +- -d 忘记每一个已经记住的 NAME 的位置 +- -l 以可作为输入重用的格式显示 +- -p pathname 使用 pathname 路径作为 NAME 命令的全路径 +- -r 忘记所有记住的位置 +- -t 打印记住的每一个 NAME 名称的位置,如果指定了多个 +- NAME 名称,则每个位置前面会加上相应的 NAME 名称 +- +- 参数: +- NAME 每个 NAME 名称会在 $PATH 路径变量中被搜索,并且添加到记住的命 +- 令 +- 列表中。 +- +- 退出状态: +- 返回成功,除非 NAME 命令没有找到或者使用了无效的选项。 +- 返回成功,除非使用了无效的选项或者 NAME 名称为只读。 ++ 定义本地变量。 ++ ++ 创建一个以 NAME 为名称的变量,并且将 VALUE 赋值给它。 ++ OPTION 选项可以是任何能被 `declare' 接受的选项。 ++ ++ 本地变量只能在函数内部被使用,它们只能在定义它们的函数内 ++ 部以及子函数中可见。 ++ ++ 退出状态: ++ 返回成功,除非使用了无效的选项、发生了赋值错误或者 shell 不在执行一个函数。 + + [export] + 为 shell 变量设定导出属性。 +diff --git a/resources/zh-HK/message.ftl b/resources/zh-HK/message.ftl +index b668058..bf75e84 100644 +--- a/resources/zh-HK/message.ftl ++++ b/resources/zh-HK/message.ftl +@@ -652,7 +652,7 @@ $cmdName -> + -s 以单条记录追加 ARG 到历史列表中 + + 如果给定了 FILENAME 文件名,则它将被作为历史文件。否则 +- 如果 $HISTFILE 变量有值的话使用之,不然使用 ~/.bash_history 文件。 ++ 如果 $HISTFILE 变量有值的话使用之,不然使用 ~/.utshell_history 文件。 + + 如果 $HISTTIMEFORMAT 变量被设定并且不为空,它的值会被用于 + strftime(3) 的格式字符串来打印与每一个显示的历史条目想关联的 +@@ -749,6 +749,9 @@ $cmdName -> + + 操作符按照优先级进行估值。括号中的子表达式将被先估值,并可取代上述表达式 + 规则。 ++ ++ 退出状态: ++ 如果最后一个 ARG 参数估值为 0,则 let 返回 1; 否则 let 返回 0。 + + [shift] + 移位位置参数。 +@@ -772,7 +775,7 @@ $cmdName -> + 退出状态: + 返回成功,除非没有启用任务控制或者有错误发生。 + +-[eval] ++[test] + 对条件表达式进行估值。 + + 根据 EXPR 表达式的估值以状态 0 (真) 或 1 (伪) 退出。 +@@ -845,6 +848,15 @@ $cmdName -> + 如果 EXPR 表达式估值为真则返回成功;如果 EXPR 表达式估值 + 为假或者使用了无效的参数则返回失败。 + ++[eval] ++ 将参数作为 shell 命令执行。 ++ ++ 将 ARGs 合成一个字符串,用结果作为 shell 的输入, ++ 并且执行得到的命令。 ++ ++ 退出状态: ++ 以命令的状态退出,或者在命令为空的情况下返回成功。 ++ + [times] + 显示进程时间 + +@@ -1260,27 +1272,16 @@ $cmdName -> + 返回成功,除非使用了无效的选项或者 NAME 名称为只读。 + + [local] +- 记住或显示程序位置。 +- +- 确定并记住每一个给定 NAME 名称的命令的完整路径。 +- 如果不提供参数,则显示已经记住的命令的信息。 +- +- 选项: +- -d 忘记每一个已经记住的 NAME 的位置 +- -l 以可作为输入重用的格式显示 +- -p pathname 使用 pathname 路径作为 NAME 命令的全路径 +- -r 忘记所有记住的位置 +- -t 打印记住的每一个 NAME 名称的位置,如果指定了多个 +- NAME 名称,则每个位置前面会加上相应的 NAME 名称 +- +- 参数: +- NAME 每个 NAME 名称会在 $PATH 路径变量中被搜索,并且添加到记住的命 +- 令 +- 列表中。 +- +- 退出状态: +- 返回成功,除非 NAME 命令没有找到或者使用了无效的选项。 +- 返回成功,除非使用了无效的选项或者 NAME 名称为只读。 ++ 定義本機變數。 ++ ++ 建立一個以 <名稱> 為名稱的變數,並且將 VALUE 指派給它。 ++ OPTION 選項可以是任何能被「declare」接受的選項。 ++ ++ 本機變數只能在函數內部被使用,它們只能在定義它們的函數內 ++ 部以及子函數中可見。 ++ ++ 退出狀態: ++ 回傳成功,除非使用了無效的選項、發生了指派錯誤或者 shell 不在執行一個函數。 + + [export] + 为 shell 变量设定导出属性。 +-- +2.43.0 + diff --git a/0006-fix-select-error.patch b/0006-fix-select-error.patch new file mode 100644 index 0000000000000000000000000000000000000000..0722f2b6f418fe571186fe16dfdf42cbd2b0d8f6 --- /dev/null +++ b/0006-fix-select-error.patch @@ -0,0 +1,29 @@ +From e7dfff81605834dcc6b879963d820c60aef972b0 Mon Sep 17 00:00:00 2001 +From: wangmengc +Date: Thu, 9 May 2024 10:58:58 +0800 +Subject: [PATCH] fix select error + +--- + builtins_rust/read/src/lib.rs | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/builtins_rust/read/src/lib.rs b/builtins_rust/read/src/lib.rs +index d08da49..de8bbd8 100644 +--- a/builtins_rust/read/src/lib.rs ++++ b/builtins_rust/read/src/lib.rs +@@ -770,10 +770,10 @@ pub extern "C" fn r_read_builtin(mut list: *mut WordList) -> i32 { + //和-d相关 -n 0可以退出,有显示 + if saw_escape != 0 { + let t = dequote_string(input_string); +- var = bind_variable("REPLY".as_ptr() as *const c_char, t, 0); ++ var = bind_variable( b"REPLY\0" as *const u8 as *const libc::c_char,t, 0); + libc::free(t as *mut c_void); + } else { +- var = bind_variable("REPLY".as_ptr() as *const c_char, input_string, 0); ++ var = bind_variable( b"REPLY\0" as *const u8 as *const libc::c_char,input_string, 0); + } + let cond = var.is_null() + || ((*var).attributes & 0x0000002) != 0 +-- +2.39.3 + diff --git a/0007-fix-compile-error-on-riscv64.patch b/0007-fix-compile-error-on-riscv64.patch new file mode 100644 index 0000000000000000000000000000000000000000..7e65a7e2bf6db0b07985312c655c261a8121916c --- /dev/null +++ b/0007-fix-compile-error-on-riscv64.patch @@ -0,0 +1,29 @@ +From b93998a221ad9e78540253016eadd634a39c1598 Mon Sep 17 00:00:00 2001 +From: wangyaoyong +Date: Thu, 23 May 2024 17:59:49 +0800 +Subject: [PATCH 1/1] fix compile error on riscv64 + +--- + Makefile.in | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Makefile.in b/Makefile.in +index 6affd14..0e8ff16 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -598,10 +598,10 @@ $(Program): .build $(OBJECTS) $(BUILTINS_DEP) $(LIBDEP) rust_builtins_lib rust + @echo " ***********************************************************" + @echo + +-rust_mainland_lib: ++rust_mainland_lib: $(SHLIB_LIBRARY) + @for it in $(RUST_MAINLAND_DIRS); do cd $$it ; cargo build; cd -; done + +-rust_builtins_lib: ++rust_builtins_lib: $(SHLIB_LIBRARY) + @for it in $(RUST_BUILTINS_DIRS); do cd $$it ; cargo build; cd -; done + + +-- +2.25.1 + diff --git a/0008-fix-echo-a.z.patch b/0008-fix-echo-a.z.patch new file mode 100644 index 0000000000000000000000000000000000000000..2c5471de5900291274e8b0cbaa2b62fcb9473d3c --- /dev/null +++ b/0008-fix-echo-a.z.patch @@ -0,0 +1,36 @@ +From 35f29adb96c082cd94ec0c72c62556b4fde1e05c Mon Sep 17 00:00:00 2001 +From: wangmengc +Date: Fri, 13 Dec 2024 17:15:50 +0800 +Subject: [PATCH] fix echo {a..z} + +--- + r_braces/src/lib.rs | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/r_braces/src/lib.rs b/r_braces/src/lib.rs +index ee83ac1..d36ff1f 100644 +--- a/r_braces/src/lib.rs ++++ b/r_braces/src/lib.rs +@@ -378,7 +378,7 @@ pub unsafe extern "C" fn brace_expand( + loop { + if *amble.offset(j as isize) as libc::c_int == 0 as libc::c_int { + tack = expand_seqterm (amble, alen); +- if tack.is_null() { ++ if !tack.is_null() { + break; + } + else if !text.offset((i+1) as isize).is_null() { +@@ -692,7 +692,9 @@ unsafe extern "C" fn expand_seqterm( + lhs = substring(text, 0 as libc::c_int, lhs_l); + rhs = substring( + text, +- (lhs_l + std::mem::size_of::<[libc::c_char; 3]> as libc::c_int - 1 as libc::c_int ), ++ (lhs_l as libc::c_ulong) ++ .wrapping_add(::std::mem::size_of::<[libc::c_char; 3]>() as libc::c_ulong) ++ .wrapping_sub(1 as libc::c_int as libc::c_ulong) as libc::c_int, + tlen as libc::c_int, + ); + if *lhs.offset(0 as libc::c_int as isize) as libc::c_int == 0 as libc::c_int +-- +2.39.3 + diff --git a/0009-fix-type-return-error.patch b/0009-fix-type-return-error.patch new file mode 100644 index 0000000000000000000000000000000000000000..c135976af204e94881e887c428bd72649c68b07a --- /dev/null +++ b/0009-fix-type-return-error.patch @@ -0,0 +1,38 @@ +From 7af7b30f2dc162ff4999a5c0e11132796f62b0be Mon Sep 17 00:00:00 2001 +From: wangmengc +Date: Fri, 13 Dec 2024 17:35:33 +0800 +Subject: [PATCH] fix type return error + +--- + builtins_rust/type/src/lib.rs | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +diff --git a/builtins_rust/type/src/lib.rs b/builtins_rust/type/src/lib.rs +index 4940fae..c1b470e 100644 +--- a/builtins_rust/type/src/lib.rs ++++ b/builtins_rust/type/src/lib.rs +@@ -555,17 +555,16 @@ pub unsafe extern "C" fn r_type_builtin(mut list: *mut WordList) -> i32 { + sh_notfound((*(*list).word).word); + } + } +- any_failed = found + any_failed; +- let _ = any_failed == 0; +- // (any_failed += found) == 0; ++ ++ any_failed += (found == 0 as libc::c_int) as libc::c_int; + unsafe { + list = (*list).next; + } + } + if any_failed == 0 { +- EXECUTION_SUCCESS!(); ++ opt = EXECUTION_SUCCESS!(); + } else { +- EXECUTION_FAILURE!(); ++ opt = EXECUTION_FAILURE!(); + } + return unsafe { sh_chkwrite(opt) }; + } +-- +2.39.3 + diff --git a/0010-fix-coproc-command-error.patch b/0010-fix-coproc-command-error.patch new file mode 100644 index 0000000000000000000000000000000000000000..c49d03708cb2606e30764fab1ec6effd82c575b2 --- /dev/null +++ b/0010-fix-coproc-command-error.patch @@ -0,0 +1,34 @@ +From 963b01517eb7ff9823987643515d0818ad8e037c Mon Sep 17 00:00:00 2001 +From: wangmengc +Date: Thu, 13 Mar 2025 14:55:55 +0800 +Subject: [PATCH] fix coproc command error + +--- + r_print_cmd/src/lib.rs | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/r_print_cmd/src/lib.rs b/r_print_cmd/src/lib.rs +index fee41ed..ffdded9 100644 +--- a/r_print_cmd/src/lib.rs ++++ b/r_print_cmd/src/lib.rs +@@ -185,14 +185,14 @@ unsafe fn make_command_string_internal(command:*mut COMMAND) + indent(indentation); + } + +- if (*command).flags != 0 && CMD_TIME_PIPELINE != 0{ ++ if (*command).flags & CMD_TIME_PIPELINE as i32 != 0{ + cprintf(b"time \0" as *const u8 as *const c_char); +- if (*command).flags != 0 && CMD_TIME_POSIX != 0{ ++ if (*command).flags & CMD_TIME_POSIX as i32 != 0{ + cprintf(b"-p \0" as *const u8 as *const c_char); + } + } + +- if (*command).flags != 0 && CMD_INVERT_RETURN != 0{ ++ if (*command).flags & CMD_INVERT_RETURN as i32 != 0{ + cprintf(b"! \0" as *const u8 as *const c_char); + } + // (*command).type_ = 11; +-- +2.39.3 + diff --git a/0011-fix-arch-display.patch b/0011-fix-arch-display.patch new file mode 100644 index 0000000000000000000000000000000000000000..5877385e1b64f9a0cfed8ea2a19f5ef539ae5823 --- /dev/null +++ b/0011-fix-arch-display.patch @@ -0,0 +1,34 @@ +From b4d841e78086b7b5c4aa42d7b7f49520a5ca4e8f Mon Sep 17 00:00:00 2001 +From: wangmengc +Date: Wed, 5 Mar 2025 11:29:45 +0800 +Subject: [PATCH] fix arch display + +--- + r_shell/src/lib.rs | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/r_shell/src/lib.rs b/r_shell/src/lib.rs +index 38b6207..897302e 100644 +--- a/r_shell/src/lib.rs ++++ b/r_shell/src/lib.rs +@@ -14,7 +14,7 @@ extern "C" { + static mut rl_deprep_term_function: Option::; + static mut rl_readline_state: libc::c_ulong; + +- ++ fn get_mach_type() -> *mut libc::c_char; + fn getpwuid(__uid: __uid_t) -> *mut passwd; + fn endpwent(); + fn sh_setlinebuf(_: *mut FILE) -> libc::c_int; +@@ -1901,7 +1901,7 @@ unsafe extern "C" fn show_shell_usage(fp: *mut FILE, extra: libc::c_int) { + fp, + b"utshell, version %s-(%s)\n\0" as *const u8 as *const libc::c_char, + shell_version_string(), +- MACHTYPE!(), ++ get_mach_type(), + ); + } + fprintf( +-- +2.39.3 + diff --git a/utshell-0.4.tar.gz b/utshell-0.5.tar.gz similarity index 62% rename from utshell-0.4.tar.gz rename to utshell-0.5.tar.gz index 00023904b7dbed6ac8cf8aedb2ea5f9e5504f415..404a96c1e276e6a65cdf8d655e0db64b24e31e61 100644 Binary files a/utshell-0.4.tar.gz and b/utshell-0.5.tar.gz differ diff --git a/utshell.spec b/utshell.spec index 5a248b58d8ff29d4c3e8f6e31ac0f4a5fb0a5d3b..aa24a40fc9b2ceb1605f40d488ebb35dfca9494a 100644 --- a/utshell.spec +++ b/utshell.spec @@ -1,18 +1,28 @@ #% define beta_tag rc2 -%define patchleveltag .30411 -%define baseversion 0.4 +%define patchleveltag .0 +%define baseversion 0.5 %bcond_with tests -Version: 0.4.30411 +Version: %{baseversion}%{patchleveltag} Name: utshell Summary: The utshell respect Bash -Release: 0%{?dist}.01 +Release: 4%{?dist} License: GPLv3+ Source0: utshell-%{baseversion}.tar.gz # Official upstream patches # Patches are converted to apply with '-p1' - +Patch0001: 0001-fix-utshell-continue-help-countine.patch +Patch0002: 0002-fix-kill-l.patch +Patch0003: 0003-fix-exec-c-exec-l-Redundant-output.patch +Patch0004: 0004-fix-complete-p-no-display.patch +Patch0005: 0005-fix-translation-files-correlation.patch +Patch0006: 0006-fix-select-error.patch +Patch0007: 0007-fix-compile-error-on-riscv64.patch +Patch0008: 0008-fix-echo-a.z.patch +Patch0009: 0009-fix-type-return-error.patch +Patch0010: 0010-fix-coproc-command-error.patch +Patch0011: 0011-fix-arch-display.patch # Other patches # We don't want to add '/etc:/usr/etc' in standard utils path. @@ -25,7 +35,7 @@ Requires: filesystem >= 3 #Provides: /bin/sh Provides: /bin/utshell -ExclusiveArch: x86_64 aarch64 arm +ExclusiveArch: x86_64 aarch64 arm riscv64 %description The GNU Bourne Again shell (Bash) is a shell or command language interpreter that is compatible with the Bourne shell (sh). Bash @@ -129,6 +139,44 @@ end %{_includedir}/%{name} %changelog +* Wed Mar 5 2025 wangmeng - 0.5.0-4 +- feat: 修复coproc命令错误问题 +- feat: 修复utshell --help 显示信息问题 + +* Fri Dec 13 2024 wangmeng - 0.5.0-3 +- feat: add patch 0003-fix-echo-a.z.patch +- feat: add patch 0004-fix-type-return-error.patch +- 修复echo {a..z} 执行错误和type命令返回值错误 + +* Fri Jun 21 2024 wangmeng - 0.5.0-1 +- fix:IA4DBK Change the verson number to be consistent with other software packages + +* Thu May 23 2024 wangyaoyong - 0.5.0-0.4 +- fix:I9KZET riscv64 下cargo build编译时出现缺少依赖的问题 + +* Thu May 9 2024 wangmeng - 0.5.0-0.3 +- fix:I9CANW select 关键字没有输出 + +* Thu Apr 11 2024 wangyaoyong - 0.5.0-0.2 +- update ExclusiveArch: riscv to riscv64 + +* Tue Apr 09 2024 wangmeng - 0.5.0-0.1 +- fix:I9CC1Z trap --help 与trap -l 缺少部分提示 +- fix:I9CBXT help local中英文提示不符 +- fix:I9CBPP hash --help中英文提示不一致 +- fix:I9CBKZ exec -c exec -l存在多余输出 +- fix:I9CBG7 let --help 提示不全 +- fix:I9CAZZ ulimit -S命令不支持 +- fix:I9CAS8 kill -l序号有误 +- fix:I9CA9S continue --help 和countine 存在多余提示 +- fix:I9CBRG complete -p无输出 + +* Mon Apr 01 2024 wangmeng - 0.5.0 +- update to version 0.5 + +* Tue Mar 26 2024 wangyaoyong - 0.4.30411-0.02 +- add ExclusiveArch: riscv + * Tue Apr 11 2023 Zhanghuanhuan - 0.4.30411-0.01 - fix:193533 utshell环境,Ctrl+D退出会话时,提示exit_builtin(刘彤) - fix:193535 history -p mount和用例中预期不符(刘彤)