From 11535646289613add35b52a6494d648915c5e824 Mon Sep 17 00:00:00 2001 From: liutong Date: Sun, 2 Jul 2023 15:08:33 +0800 Subject: [PATCH] fixed declare -p error --- bash-5.1/Makefile.in | 34 +++++----- bash-5.1/builtins/fc.def | 7 +- bash-5.1/builtins_rust/declare/Cargo.toml | 1 + bash-5.1/builtins_rust/declare/src/lib.rs | 37 +++++----- bash-5.1/builtins_rust/setattr/Cargo.toml | 4 -- bash-5.1/builtins_rust/setattr/src/lib.rs | 65 ++++++++++-------- bash-5.1/configure | 82 +++++++++++------------ bash-5.1/configure.ac | 50 +++++++------- bash-5.1/execute_cmd.c | 1 - record.txt | 1 + 10 files changed, 145 insertions(+), 137 deletions(-) diff --git a/bash-5.1/Makefile.in b/bash-5.1/Makefile.in index 75e657d0..dd1c8a4f 100644 --- a/bash-5.1/Makefile.in +++ b/bash-5.1/Makefile.in @@ -1,4 +1,4 @@ -# Makefile for bash-5.0, version 4.30 +# Makefile for utshell, version 4.30 # # Copyright (C) 1996-2018 Free Software Foundation, Inc. @@ -104,10 +104,10 @@ EXEEXT = @EXEEXT@ OBJEXT = @OBJEXT@ # The name of this program and some version information. -VERSPROG = rashversion$(EXEEXT) -VERSOBJ = rashversion.$(OBJEXT) +VERSPROG = utshellversion$(EXEEXT) +VERSOBJ = utshellversion.$(OBJEXT) -Program = rash$(EXEEXT) +Program = utshell$(EXEEXT) Version = @BASHVERS@ PatchLevel = `$(BUILD_DIR)/$(VERSPROG) -p` RELSTATUS = @RELSTATUS@ @@ -191,7 +191,7 @@ SUBDIR_INCLUDES = -I. @RL_INCLUDE@ -I$(topdir) -I$(topdir)/$(LIBSUBDIR) BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ -# the bash library +# the utshell library # the library is a mix of functions that the C library does not provide on # some platforms and general shell utility functions SH_LIBSRC = $(LIBSRC)/sh @@ -241,7 +241,7 @@ SHLIB_LIBRARY = ${SH_LIBDIR}/${SHLIB_LIBNAME} SHLIB_LDFLAGS = -L${SH_LIBDIR} SHLIB_DEP = ${SHLIB_LIBRARY} -# we assume for now that readline source is being shipped with bash +# we assume for now that readline source is being shipped with utshell RL_LIBSRC = $(LIBSRC)/readline # RL_LIBDOC = $(RL_LIBSRC)/doc RL_LIBDIR = @RL_LIBDIR@ @@ -577,7 +577,7 @@ RUST_BUILTINS_DIRS = $(RUST_DIR)/alias $(RUST_DIR)/bind $(RUST_DIR)/break_1 $(RU # Keep GNU Make from exporting the entire environment for small machines. .NOEXPORT: -.made: $(Program) rashbug $(SDIR)/man2html$(EXEEXT) +.made: $(Program) utshellbug $(SDIR)/man2html$(EXEEXT) @echo "$(Program) last made for a $(Machine) running $(OS)" >.made $(Program): .build $(OBJECTS) $(BUILTINS_DEP) $(LIBDEP) rust_builtins_lib @@ -599,10 +599,10 @@ rust_builtins_lib: @for it in $(RUST_BUILTINS_DIRS); do cd $$it ; cargo build; cd -; done -rashbug: $(SDIR)/rashbug.sh $(VERSPROG) +utshellbug: $(SDIR)/utshellbug.sh $(VERSPROG) @sed -e "s%!PATCHLEVEL!%$(PatchLevel)%" \ - $(SDIR)/rashbug.sh > $@ - @chmod a+rx rashbug + $(SDIR)/utshellbug.sh > $@ + @chmod a+rx utshellbug strip: $(Program) .made $(STRIP) $(Program) @@ -635,8 +635,8 @@ version.h: $(SOURCES) config.h Makefile patchlevel.h $(SHELL) $(SUPPORT_SRC)mkversion.sh -b -S ${topdir} -s $(RELSTATUS) -d $(Version) -o newversion.h \ && mv newversion.h version.h -rashversion$(EXEEXT): buildversion.o $(SUPPORT_SRC)rashversion.c - $(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) ${LDFLAGS_FOR_BUILD} -o $@ $(SUPPORT_SRC)rashversion.c buildversion.o ${LIBS_FOR_BUILD} +utshellversion$(EXEEXT): buildversion.o $(SUPPORT_SRC)utshellversion.c + $(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) ${LDFLAGS_FOR_BUILD} -o $@ $(SUPPORT_SRC)utshellversion.c buildversion.o ${LIBS_FOR_BUILD} buildversion.o: $(srcdir)/version.c $(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -DBUILDTOOL -c -o $@ $(srcdir)/version.c @@ -820,7 +820,7 @@ installdirs: install: .made installdirs $(INSTALL_PROGRAM) $(INSTALLMODE) $(Program) $(DESTDIR)$(bindir)/$(Program) - $(INSTALL_SCRIPT) $(INSTALLMODE2) rashbug $(DESTDIR)$(bindir)/rashbug + $(INSTALL_SCRIPT) $(INSTALLMODE2) utshellbug $(DESTDIR)$(bindir)/utshellbug -( cd $(DEFDIR) ; $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ ) -( cd $(PO_DIR) ; $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ ) -($(INSTALL_DATA) -D $(INSTALLMODE2) $(LANGSRC)/zh-CN/* -t $(DESTDIR)$(datadir)/utshell/${LANGSRC}/zh-CN ) @@ -855,17 +855,17 @@ install-headers: install-headers-dirs ${INSTALL_DATA} $(srcdir)/"$$hf" $(DESTDIR)$(headersdir)/$$hf || exit 1; \ fi ; \ done - -$(INSTALL_DATA) $(SDIR)/bash.pc $(DESTDIR)$(pkgconfigdir)/bash.pc + -$(INSTALL_DATA) $(SDIR)/utshell.pc $(DESTDIR)$(pkgconfigdir)/utshell.pc uninstall-headers: -( cd $(DESTDIR)$(headersdir) && $(RM) $(INSTALLED_HEADERS) ) -( cd $(DESTDIR)$(headersdir)/include && $(RM) $(INSTALLED_INCFILES) ) -( cd $(DESTDIR)$(headersdir)/builtins && $(RM) $(INSTALLED_BUILTINS_HEADERS) ) -( cd $(DESTDIR)$(headersdir) && $(RM) $(CREATED_HEADERS) ) - -( $(RM) $(DESTDIR)$(pkgconfigdir)/bash.pc ) + -( $(RM) $(DESTDIR)$(pkgconfigdir)/utshell.pc ) uninstall: .made - $(RM) $(DESTDIR)$(bindir)/$(Program) $(DESTDIR)$(bindir)/rashbug + $(RM) $(DESTDIR)$(bindir)/$(Program) $(DESTDIR)$(bindir)/utshellbug -( cd $(PO_DIR) ; $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ ) $(RM) -r $(DESTDIR)$(datadir)/utshell @@ -875,7 +875,7 @@ LIB_SUBDIRS = ${RL_LIBDIR} ${HIST_LIBDIR} ${TERM_LIBDIR} ${GLOB_LIBDIR} \ ${INTL_LIBDIR} ${TILDE_LIBDIR} ${ALLOC_LIBDIR} ${SH_LIBDIR} basic-clean: - $(RM) $(OBJECTS) $(Program) rashbug + $(RM) $(OBJECTS) $(Program) utshellbug $(RM) .build .made version.h cargo clean diff --git a/bash-5.1/builtins/fc.def b/bash-5.1/builtins/fc.def index 3a164ee9..846e6abd 100644 --- a/bash-5.1/builtins/fc.def +++ b/bash-5.1/builtins/fc.def @@ -246,6 +246,7 @@ return r_fc_builtin (list); if (execute) { rlist = (REPL *)NULL; +// 如果list->word->word存在=,rl是逆序存所有带=的list while (list && ((sep = (char *)strchr (list->word->word, '=')) != NULL)) { *sep++ = '\0'; @@ -267,12 +268,14 @@ return r_fc_builtin (list); /* If we have a list of substitutions to do, then reverse it to get the replacements in the proper order. */ +//把逆序正过来 rlist = REVERSE_LIST (rlist, REPL *); hlist = history_list (); /* If we still have something in list, it is a command spec. Otherwise, we use the most recent command in time. */ +//找到历史记录中的command command = fc_gethist (list ? list->word->word : (char *)NULL, hlist, 0); if (command == NULL) @@ -286,6 +289,7 @@ return r_fc_builtin (list); if (rlist) { +//做替换 newcom = fc_dosubs (command, rlist); free (command); FREE_RLIST (); @@ -579,13 +583,14 @@ fc_gethnum (command, hlist, mode) calculation as if it were on. */ rh = remember_on_history || ((subshell_environment & SUBSHELL_COMSUB) && enable_history_list); last_hist = i - rh - hist_last_line_added; - +//last_hist 总数减去一些东西 if (i == last_hist && hlist[last_hist] == 0) while (last_hist >= 0 && hlist[last_hist] == 0) last_hist--; if (last_hist < 0) return (-1); +//real_last表中的最后一个 real_last = i; i = last_hist; diff --git a/bash-5.1/builtins_rust/declare/Cargo.toml b/bash-5.1/builtins_rust/declare/Cargo.toml index 01673f70..dbe006b6 100644 --- a/bash-5.1/builtins_rust/declare/Cargo.toml +++ b/bash-5.1/builtins_rust/declare/Cargo.toml @@ -11,6 +11,7 @@ libc = "*" nix = "*" rcommon = {path = "../common"} rhelp = {path ="../help"} +rsetattr = {path = "../setattr"} [lib] crate-type = ["staticlib","rlib"] diff --git a/bash-5.1/builtins_rust/declare/src/lib.rs b/bash-5.1/builtins_rust/declare/src/lib.rs index 19548a7e..0fc92c78 100644 --- a/bash-5.1/builtins_rust/declare/src/lib.rs +++ b/bash-5.1/builtins_rust/declare/src/lib.rs @@ -5,7 +5,8 @@ use libc::{c_char, c_long, c_void}; use std::{ffi::CString}; use rcommon::{WordList, WordDesc, EX_USAGE, EXECUTION_SUCCESS, EXECUTION_FAILURE}; use rhelp::r_builtin_help; - +use rsetattr::show_name_attributes; +use std::ffi::CStr; #[repr(u8)] enum command_type { cm_for, cm_case, cm_while, cm_if, cm_simple, cm_select, cm_connection, cm_function_def, cm_until, cm_group, @@ -468,7 +469,6 @@ extern "C" { fn sh_chkwrite (ret:i32)->i32; fn show_func_attributes (name:* mut c_char, nodefs:i32)->i32; fn show_localname_attributes (name:* mut c_char, nodefs:i32)->i32; - fn show_name_attributes (name:* mut c_char, nodefs:i32)->i32; fn sh_notfound (name:* mut c_char); static assoc_expand_once:i32; fn assignment (str1:* const c_char, flags:i32)->i32; @@ -589,7 +589,7 @@ unsafe fn var_setvalue(var:*mut SHELL_VAR,str1:* mut c_char) } unsafe fn VSETATTR(var:*mut SHELL_VAR, attr:i32) { - (*var).attributes=attr; + (*var).attributes |= attr; } unsafe fn readonly_p(var:*mut SHELL_VAR) ->i32 { @@ -608,8 +608,8 @@ unsafe fn function_cell(var:*mut SHELL_VAR) ->* mut COMMAND { return (*var).value as * mut COMMAND; } -unsafe fn VUNSETATTR(var:*mut SHELL_VAR,attr:i32) ->i32 { - return (*var).attributes & !attr; +unsafe fn VUNSETATTR(var:*mut SHELL_VAR,attr:i32) { + (*var).attributes &= !attr; } unsafe fn array_p(var:*mut SHELL_VAR) ->i32 { @@ -727,7 +727,6 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i } opt = internal_getopt (list, tmp.as_ptr() as * mut c_char); } - list = loptend; /* If there are no more arguments left, then we just want to show some variables. */ @@ -760,12 +759,11 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i } else { pflag = show_name_attributes ((*(*list).word).word, nodefs); } - if pflag !=0 { sh_notfound ((*(*list).word).word); any_failed += 1; } - list = (*list).next; + list = (*list).next; } if any_failed !=0 { @@ -775,7 +773,6 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i } } - /* There are arguments left, so we are making variables. */ 'outter: while list !=std::ptr::null_mut() { /* declare [-aAfFirx] name [name ...] */ let mut value:* mut c_char; @@ -892,7 +889,7 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i shell function names don't have to be valid identifiers when the shell's not in posix mode), check whether or not the argument is a valid, well-formed shell identifier. */ - if (posixly_correct !=0 || (flags_on & att_function!()) == 0) && legal_identifier (name) == 0 { + if (posixly_correct !=0 || (flags_on & att_function!()) == 0) && legal_identifier(name) == 0 { sh_invalidid (name); assign_error+=1; libc::free (name as * mut c_void); @@ -914,16 +911,18 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i var = find_variable (name); if var == std::ptr::null_mut() { newname = nameref_transform_name (name, ASS_MKLOCAL!()); - } else if (flags_on & att_nameref!()) == 0 && (flags_off & att_nameref!()) == 0 { + } + else if (flags_on & att_nameref!()) == 0 && (flags_off & att_nameref!()) == 0 { /* Ok, we're following namerefs here, so let's make sure that if we followed one, it was at the same context (see below for more details). */ refvar = find_variable_last_nameref (name, 1); if refvar != std::ptr::null_mut() && (*refvar).context != variable_context { newname = name ; - } else { - newname = (*var).name; } + else { + newname = (*var).name; + } refvar = std::ptr::null_mut(); } else { newname = name; /* dealing with nameref attribute */ @@ -1015,9 +1014,9 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i if nodefs !=0 && debugging_mode !=0 { shell_fn = find_function_def ((*var).name); if shell_fn !=std::ptr::null_mut() { - libc::printf (CString::new("%s %d %s\n").unwrap().as_ptr(), (*var).name, (*shell_fn).line, (*shell_fn).source_file); + println!("{} {} {}",CStr::from_ptr((*var).name).to_str().unwrap(),(*shell_fn).line,CStr::from_ptr((*shell_fn).source_file).to_str().unwrap()); } else { - libc::printf (CString::new("%s\n").unwrap().as_ptr(), (*var).name); + println!("{}",CStr::from_ptr((*var).name).to_str().unwrap()); } } else { if nodefs !=0 { @@ -1025,7 +1024,7 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i } else { named_function_string (name, function_cell (var), FUNC_MULTILINE!()|FUNC_EXTERNAL!()); } - libc::printf (CString::new("%s\n").unwrap().as_ptr(), t); + println!("{}",CStr::from_ptr(t).to_str().unwrap()); any_failed = sh_chkwrite (any_failed); } } else { /* declare -[fF] -[rx] name [name...] */ @@ -1040,7 +1039,8 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i list = (*list).next; continue 'outter; } - } else { /* declare -[aAinrx] name [name...] */ + } else { + /* declare -[aAinrx] name [name...] */ /* Non-null if we just created or fetched a local variable. */ /* Here's what ksh93 seems to do as of the 2012 version: if we are @@ -1381,7 +1381,7 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i /* ksh93 seems to do this */ offref = flags_off & att_nameref!(); flags_off &= !att_nameref!(); - + VSETATTR (var, flags_on); VUNSETATTR (var, flags_off); @@ -1515,4 +1515,3 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i } } } - diff --git a/bash-5.1/builtins_rust/setattr/Cargo.toml b/bash-5.1/builtins_rust/setattr/Cargo.toml index 92f9f82b..3eb07121 100644 --- a/bash-5.1/builtins_rust/setattr/Cargo.toml +++ b/bash-5.1/builtins_rust/setattr/Cargo.toml @@ -11,12 +11,8 @@ authors = ["lvgenggeng"] name = "rsetattr" crate-type = ["staticlib","rlib"] -[build-dependencies] -rdeclare = {path = "../declare"} - [dependencies] libc = "*" nix = "*" -rdeclare = {path = "../declare"} rcommon = {path = "../common"} rhelp = {path ="../help"} \ No newline at end of file diff --git a/bash-5.1/builtins_rust/setattr/src/lib.rs b/bash-5.1/builtins_rust/setattr/src/lib.rs index e6e76681..f151ba1f 100644 --- a/bash-5.1/builtins_rust/setattr/src/lib.rs +++ b/bash-5.1/builtins_rust/setattr/src/lib.rs @@ -3,7 +3,7 @@ use std::mem::size_of_val; use libc::{c_int, c_uint, c_char, c_long, PT_NULL, c_void}; use rhelp::r_builtin_help; include!(concat!("intercdep.rs")); - +use std::ffi::CStr; #[no_mangle] pub extern "C" fn r_export_builtin(list: *mut WordList) -> c_int { return set_or_show_attributes(list, att_exported, 0); @@ -239,7 +239,7 @@ unsafe { } loop { - var = (variable_list as usize + 8 * i) as *mut SHELL_VAR; + var = variable_list.offset(i) as *mut SHELL_VAR; if var.is_null() { break; } @@ -273,7 +273,7 @@ unsafe { } loop { - var = (variable_list as usize + 8 * i) as *mut SHELL_VAR; + var = variable_list.offset(i) as *mut SHELL_VAR; if var.is_null() { break; } @@ -298,54 +298,61 @@ unsafe { pub extern "C" fn show_var_attributes(var: *mut SHELL_VAR, pattr: c_int, mut nodefs: c_int) -> c_int { let mut flags = [0;16]; - unsafe { let i = var_attribute_string(var, pattr, flags.as_mut_ptr()); - if ((*var).attributes & att_function) != 0 && nodefs == 0 && (pattr == 0 || posixly_correct == 0) { - libc::printf("%s\n\0".as_ptr() as *const c_char, - named_function_string((*var).name, (*var).value as *mut COMMAND, FUNC_MULTILINE | FUNC_EXTERNAL)); - + println!("{}",CStr::from_ptr(named_function_string((*var).name, (*var).value as *mut COMMAND, FUNC_MULTILINE | FUNC_EXTERNAL)).to_str().unwrap()); nodefs += 1; if pattr == 0 && i == 1 && flags[0] == b'f' as c_char { return 0; } } - if pattr == 0 || posixly_correct == 0 { - libc::printf("declare -%s \0".as_ptr() as *const c_char, if i != 0 {flags.as_ptr()} else {"-\0".as_ptr() as *const c_char}); - } else if i != 0 { - libc::printf("%s -%s \0".as_ptr() as *const c_char, this_command_name, flags.as_ptr()); - } else { - libc::printf("%s \0".as_ptr() as *const c_char, this_command_name); + if i !=0 { + print!("declare -{} ", CStr::from_ptr(flags.as_ptr()).to_str().unwrap()); + } + else { + print!("declare -- "); + } + } + else if i != 0 { + print!("{} {}", CStr::from_ptr(this_command_name).to_str().unwrap(),CStr::from_ptr(flags.as_ptr()).to_str().unwrap()); + } + else { + print!("{}", CStr::from_ptr(this_command_name).to_str().unwrap()); } if ((*var).attributes & att_invisible) != 0 && ((*var).attributes & att_array) != 0 && ((*var).attributes & att_assoc) != 0 { - libc::printf("%s\n\0".as_ptr() as *const c_char, (*var).name); - } else if ((*var).attributes & att_array) != 0 { + println!("{}",CStr::from_ptr((*var).name).to_str().unwrap()); + } + else if ((*var).attributes & att_array) != 0 { print_array_assignment(var, 0); - } else if ((*var).attributes & att_assoc) != 0 { + } + else if ((*var).attributes & att_assoc) != 0 { print_assoc_assignment(var, 0); - } else if nodefs != 0 || - (((*var).attributes & att_function) != 0 && pattr != 0 && posixly_correct != 0) { - libc::printf("%s\n\0".as_ptr() as *const c_char, (*var).name); - } else if ((*var).attributes & att_function) != 0 { - libc::printf("%s\n\0".as_ptr() as *const c_char, - named_function_string((*var).name, (*var).value as *mut COMMAND, FUNC_MULTILINE | FUNC_EXTERNAL)); - } else if ((*var).attributes & att_invisible) != 0 && (*var).value.is_null() { - libc::printf("%s\n\0".as_ptr() as *const c_char, (*var).name); + } + else if nodefs != 0 || (((*var).attributes & att_function) != 0 && pattr != 0 && posixly_correct != 0) { + println!("{}",CStr::from_ptr((*var).name).to_str().unwrap()); + } + else if ((*var).attributes & att_function) != 0 { + println!("{}",CStr::from_ptr(named_function_string((*var).name, (*var).value as *mut COMMAND, FUNC_MULTILINE | FUNC_EXTERNAL)).to_str().unwrap()); + } else if ((*var).attributes & att_invisible) != 0 || (*var).value.is_null() { + println!("{}",CStr::from_ptr((*var).name).to_str().unwrap()); } else { - let x = sh_double_quote((*var).value); - libc::printf("%s=%s\n\0".as_ptr() as *const c_char, (*var).name, x); - libc::free(x as *mut c_void); + println!("{} = {}",CStr::from_ptr((*var).name).to_str().unwrap(),CStr::from_ptr(sh_double_quote(value_cell(var))).to_str().unwrap()); } } return 0; } +unsafe fn value_cell(var:*mut SHELL_VAR)->* mut c_char +{ + return (*var).value; +} + #[no_mangle] pub extern "C" fn show_name_attributes(name: *mut c_char, nodefs: c_int) -> c_int { unsafe { @@ -493,7 +500,7 @@ unsafe { i += 1; } if ((*var).attributes & att_readonly) != 0 { - *((flags as usize + i) as *mut c_char) = b'r' as c_char; + *(flags.offset(i as isize)) = b'r' as c_char; i += 1; } if ((*var).attributes & att_trace) != 0 { diff --git a/bash-5.1/configure b/bash-5.1/configure index 79ce2902..6fadbbd3 100755 --- a/bash-5.1/configure +++ b/bash-5.1/configure @@ -1,9 +1,9 @@ #! /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.69 for rash 0.1-release. +# Generated by GNU Autoconf 2.69 for utshell 0.1-release. # -# Report bugs to . +# Report bugs to . # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -267,11 +267,11 @@ fi $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else - $as_echo "$0: Please tell bug-autoconf@gnu.org and bug-rash@gnu.org -$0: about your system, including any error possibly output -$0: before this message. Then install a modern shell, or -$0: manually run the script under such a shell if you do -$0: have one." + $as_echo "$0: Please tell bug-autoconf@gnu.org and +$0: bug-utshell@gnu.org about your system, including any +$0: error possibly output before this message. Then install +$0: a modern shell, or manually run the script under such a +$0: shell if you do have one." fi exit 1 fi @@ -579,11 +579,11 @@ MFLAGS= MAKEFLAGS= # Identity of this package. -PACKAGE_NAME='rash' -PACKAGE_TARNAME='rash' +PACKAGE_NAME='utshell' +PACKAGE_TARNAME='utshell' PACKAGE_VERSION='0.1-release' -PACKAGE_STRING='rash 0.1-release' -PACKAGE_BUGREPORT='bug-rash@gnu.org' +PACKAGE_STRING='utshell 0.1-release' +PACKAGE_BUGREPORT='bug-utshell@gnu.org' PACKAGE_URL='' ac_unique_file="shell.h" @@ -1437,7 +1437,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 rash 0.1-release to adapt to many kinds of systems. +\`configure' configures utshell 0.1-release to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1486,7 +1486,7 @@ Fine tuning of the installation directories: --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/rash] + --docdir=DIR documentation root [DATAROOTDIR/doc/utshell] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] @@ -1503,7 +1503,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of rash 0.1-release:";; + short | recursive ) echo "Configuration of utshell 0.1-release:";; esac cat <<\_ACEOF @@ -1530,7 +1530,7 @@ Optional Features: conditional commands --enable-coprocesses enable coprocess support and the coproc reserved word - --enable-debugger enable support for bash debugger + --enable-debugger enable support for utshell debugger --enable-dev-fd-stat-broken enable this option if stat on /dev/fd/N and fstat on file descriptor N don't return the same results @@ -1547,8 +1547,8 @@ Optional Features: force extended pattern matching to be enabled by default --enable-function-import - allow bash to import exported function definitions - by default + allow utshell to import exported function + definitions by default --enable-glob-asciiranges-default force bracket range expressions in pattern matching to use the C locale by default @@ -1573,7 +1573,7 @@ Optional Features: store help documentation as a single string to ease translation --enable-strict-posix-default - configure bash to be posix-conformant by default + configure utshell to be posix-conformant by default --enable-usg-echo-default a synonym for --enable-xpg-echo-default --enable-xpg-echo-default @@ -1581,7 +1581,7 @@ Optional Features: default --enable-mem-scramble scramble memory on calls to malloc and free --enable-profiling allow profiling with gprof - --enable-static-link link bash statically, for use as a root shell + --enable-static-link link utshell statically, for use as a root shell --disable-largefile omit support for large files --disable-nls do not use Native Language Support --enable-threads={posix|solaris|pth|windows} @@ -1611,7 +1611,7 @@ Optional Packages: Some influential environment variables: DEBUGGER_START_FILE - location of bash debugger initialization file + location of utshell debugger initialization file CC_FOR_BUILD C compiler used when compiling binaries used only at build time CFLAGS_FOR_BUILD @@ -1641,7 +1641,7 @@ Some influential environment variables: Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. -Report bugs to . +Report bugs to . _ACEOF ac_status=$? fi @@ -1704,7 +1704,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -rash configure 0.1-release +utshell configure 0.1-release generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1909,9 +1909,9 @@ $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( $as_echo "## ------------------------------- ## -## Report this to bug-rash@gnu.org ## -## ------------------------------- ##" +( $as_echo "## ---------------------------------- ## +## Report this to bug-utshell@gnu.org ## +## ---------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac @@ -2413,7 +2413,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 rash $as_me 0.1-release, which was +It was created by utshell $as_me 0.1-release, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2891,7 +2891,7 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac -opt_bash_malloc=yes +opt_bash_malloc=no opt_afs=no opt_curses=no opt_with_installed_readline=no @@ -2997,7 +2997,7 @@ if test "$opt_curses" = yes; then fi if test -z "${DEBUGGER_START_FILE}"; then - DEBUGGER_START_FILE='${datadir}/bashdb/bashdb-main.inc' + DEBUGGER_START_FILE='${datadir}/utshelldb/utshelldb-main.inc' fi opt_minimal_config=no @@ -3411,7 +3411,7 @@ fi HELPDIR= HELPDIRDEFINE= HELPINSTALL= HELPFILES_TARGET= if test "$opt_separate_help" != no; then if test "$opt_separate_help" = "yes" ; then - HELPDIR='${datadir}/bash' + HELPDIR='${datadir}/utshell' else HELPDIR=$opt_separate_help fi @@ -3446,7 +3446,7 @@ if test -z "$CFLAGS"; then fi echo "" -echo "Beginning configuration for bash-$BASHVERS-$RELSTATUS for ${host_cpu}-${host_vendor}-${host_os}" +echo "Beginning configuration for utshell-$BASHVERS-$RELSTATUS for ${host_cpu}-${host_vendor}-${host_os}" echo "" ac_ext=c @@ -5519,10 +5519,10 @@ fi case "$ac_cv_rl_version" in 8*|9*) ;; *) opt_with_installed_readline=no - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: installed readline library is too old to be linked with bash" >&5 -$as_echo "$as_me: WARNING: installed readline library is too old to be linked with bash" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using private bash version" >&5 -$as_echo "$as_me: WARNING: using private bash version" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: installed readline library is too old to be linked with utshell" >&5 +$as_echo "$as_me: WARNING: installed readline library is too old to be linked with utshell" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using private utshell version" >&5 +$as_echo "$as_me: WARNING: using private utshell version" >&2;} ;; esac fi @@ -20510,7 +20510,7 @@ fi # this should be packaged into a script accessible via ${srcdir}/support case "$srcdir" in .) ;; -*) for d in doc tests support lib ; do # dirs +*) for d in doc tests support lib; do # dirs test -d $d || mkdir $d done for ld in readline glob tilde malloc sh termcap; do # libdirs @@ -20567,7 +20567,7 @@ fi #AC_SUBST(ALLOCA_SOURCE) #AC_SUBST(ALLOCA_OBJECT) -ac_config_files="$ac_config_files Makefile builtins/Makefile lib/readline/Makefile lib/glob/Makefile lib/intl/Makefile lib/malloc/Makefile lib/sh/Makefile lib/termcap/Makefile lib/tilde/Makefile support/Makefile po/Makefile.in support/rash.pc support/rashbug.sh" +ac_config_files="$ac_config_files Makefile builtins/Makefile lib/readline/Makefile lib/glob/Makefile lib/intl/Makefile lib/malloc/Makefile lib/sh/Makefile lib/termcap/Makefile lib/tilde/Makefile support/Makefile po/Makefile.in support/utshell.pc support/utshellbug.sh" ac_config_commands="$ac_config_commands default" @@ -21078,7 +21078,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 rash $as_me 0.1-release, which was +This file was extended by utshell $as_me 0.1-release, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -21138,13 +21138,13 @@ $config_headers Configuration commands: $config_commands -Report bugs to ." +Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -rash config.status 0.1-release +utshell config.status 0.1-release configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -21290,8 +21290,8 @@ do "lib/tilde/Makefile") CONFIG_FILES="$CONFIG_FILES lib/tilde/Makefile" ;; "support/Makefile") CONFIG_FILES="$CONFIG_FILES support/Makefile" ;; "po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; - "support/rash.pc") CONFIG_FILES="$CONFIG_FILES support/rash.pc" ;; - "support/rashbug.sh") CONFIG_FILES="$CONFIG_FILES support/rashbug.sh" ;; + "support/utshell.pc") CONFIG_FILES="$CONFIG_FILES support/utshell.pc" ;; + "support/utshellbug.sh") CONFIG_FILES="$CONFIG_FILES support/utshellbug.sh" ;; "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; diff --git a/bash-5.1/configure.ac b/bash-5.1/configure.ac index dc6dd53e..fcf7ddc8 100644 --- a/bash-5.1/configure.ac +++ b/bash-5.1/configure.ac @@ -1,5 +1,5 @@ dnl -dnl Configure script for bash-5.1 +dnl Configure script for utshell dnl dnl report bugs to chet@po.cwru.edu dnl @@ -23,10 +23,10 @@ dnl Process this file with autoconf to produce a configure script. AC_REVISION([for Bash 5.1, version 5.022])dnl -define(rashvers, 0.1) +define(utshellvers, 0.1) define(relstatus, release) -AC_INIT([rash], rashvers-relstatus, [bug-rash@gnu.org]) +AC_INIT([utshell], utshellvers-relstatus, [bug-utshell@gnu.org]) dnl make sure we are using a recent autoconf version AC_PREREQ(2.61) @@ -37,7 +37,7 @@ AC_CONFIG_AUX_DIR(./support) AC_CONFIG_HEADERS(config.h) dnl checks for version info -BASHVERS=rashvers +BASHVERS=utshellvers RELSTATUS=relstatus dnl defaults for debug settings @@ -52,14 +52,14 @@ AC_CANONICAL_HOST AC_CANONICAL_BUILD dnl configure defaults -opt_bash_malloc=yes +opt_bash_malloc=no opt_afs=no opt_curses=no opt_with_installed_readline=no #htmldir= -dnl some systems should be configured without the bash malloc by default +dnl some systems should be configured without the utshell malloc by default dnl and some need a special compiler or loader dnl look in the NOTES file for more case "${host_cpu}-${host_os}" in @@ -101,10 +101,10 @@ sco3.2v5*|sco3.2v4*) opt_memscramble=no ;; esac dnl -dnl macros for the bash debugger +dnl macros for the utshell debugger dnl dnl AM_PATH_LISPDIR -AC_ARG_VAR(DEBUGGER_START_FILE, [location of bash debugger initialization file]) +AC_ARG_VAR(DEBUGGER_START_FILE, [location of utshell debugger initialization file]) dnl arguments to configure dnl packages @@ -140,7 +140,7 @@ if test "$opt_curses" = yes; then fi if test -z "${DEBUGGER_START_FILE}"; then - DEBUGGER_START_FILE='${datadir}/bashdb/bashdb-main.inc' + DEBUGGER_START_FILE='${datadir}/utshelldb/utshelldb-main.inc' fi dnl optional shell features in config.h.in @@ -183,7 +183,7 @@ opt_globascii_default=yes opt_function_import=yes opt_dev_fd_stat_broken=no -dnl options that affect how bash is compiled and linked +dnl options that affect how utshell is compiled and linked opt_static_link=no opt_profiling=no @@ -216,7 +216,7 @@ AC_ARG_ENABLE(command-timing, AC_HELP_STRING([--enable-command-timing], [enable AC_ARG_ENABLE(cond-command, AC_HELP_STRING([--enable-cond-command], [enable the conditional command]), opt_cond_command=$enableval) AC_ARG_ENABLE(cond-regexp, AC_HELP_STRING([--enable-cond-regexp], [enable extended regular expression matching in conditional commands]), opt_cond_regexp=$enableval) AC_ARG_ENABLE(coprocesses, AC_HELP_STRING([--enable-coprocesses], [enable coprocess support and the coproc reserved word]), opt_coproc=$enableval) -AC_ARG_ENABLE(debugger, AC_HELP_STRING([--enable-debugger], [enable support for bash debugger]), opt_debugger=$enableval) +AC_ARG_ENABLE(debugger, AC_HELP_STRING([--enable-debugger], [enable support for utshell debugger]), opt_debugger=$enableval) AC_ARG_ENABLE(dev-fd-stat-broken, AC_HELP_STRING([--enable-dev-fd-stat-broken], [enable this option if stat on /dev/fd/N and fstat on file descriptor N don't return the same results]), opt_dev_fd_stat_broken=$enableval) AC_ARG_ENABLE(direxpand-default, AC_HELP_STRING([--enable-direxpand-default], [enable the direxpand shell option by default]), opt_dircomplete_expand_default=$enableval) AC_ARG_ENABLE(directory-stack, AC_HELP_STRING([--enable-directory-stack], [enable builtins pushd/popd/dirs]), opt_dirstack=$enableval) @@ -224,7 +224,7 @@ AC_ARG_ENABLE(disabled-builtins, AC_HELP_STRING([--enable-disabled-builtins], [a AC_ARG_ENABLE(dparen-arithmetic, AC_HELP_STRING([--enable-dparen-arithmetic], [include ((...)) command]), opt_dparen_arith=$enableval) AC_ARG_ENABLE(extended-glob, AC_HELP_STRING([--enable-extended-glob], [include ksh-style extended pattern matching]), opt_extended_glob=$enableval) AC_ARG_ENABLE(extended-glob-default, AC_HELP_STRING([--enable-extended-glob-default], [force extended pattern matching to be enabled by default]), opt_extglob_default=$enableval) -AC_ARG_ENABLE(function-import, AC_HELP_STRING([--enable-function-import], [allow bash to import exported function definitions by default]), opt_function_import=$enableval) +AC_ARG_ENABLE(function-import, AC_HELP_STRING([--enable-function-import], [allow utshell to import exported function definitions by default]), opt_function_import=$enableval) AC_ARG_ENABLE(glob-asciiranges-default, AC_HELP_STRING([--enable-glob-asciiranges-default], [force bracket range expressions in pattern matching to use the C locale by default]), opt_globascii_default=$enableval) AC_ARG_ENABLE(help-builtin, AC_HELP_STRING([--enable-help-builtin], [include the help builtin]), opt_help=$enableval) AC_ARG_ENABLE(history, AC_HELP_STRING([--enable-history], [turn on command history]), opt_history=$enableval) @@ -239,14 +239,14 @@ AC_ARG_ENABLE(restricted, AC_HELP_STRING([--enable-restricted], [enable a restri AC_ARG_ENABLE(select, AC_HELP_STRING([--enable-select], [include select command]), opt_select=$enableval) AC_ARG_ENABLE(separate-helpfiles, AC_HELP_STRING([--enable-separate-helpfiles], [use external files for help builtin documentation]), opt_separate_help=$enableval) AC_ARG_ENABLE(single-help-strings, AC_HELP_STRING([--enable-single-help-strings], [store help documentation as a single string to ease translation]), opt_single_longdoc_strings=$enableval) -AC_ARG_ENABLE(strict-posix-default, AC_HELP_STRING([--enable-strict-posix-default], [configure bash to be posix-conformant by default]), opt_strict_posix=$enableval) +AC_ARG_ENABLE(strict-posix-default, AC_HELP_STRING([--enable-strict-posix-default], [configure utshell to be posix-conformant by default]), opt_strict_posix=$enableval) AC_ARG_ENABLE(usg-echo-default, AC_HELP_STRING([--enable-usg-echo-default], [a synonym for --enable-xpg-echo-default]), opt_xpg_echo=$enableval) AC_ARG_ENABLE(xpg-echo-default, AC_HELP_STRING([--enable-xpg-echo-default], [make the echo builtin expand escape sequences by default]), opt_xpg_echo=$enableval) -dnl options that alter how bash is compiled and linked +dnl options that alter how utshell is compiled and linked AC_ARG_ENABLE(mem-scramble, AC_HELP_STRING([--enable-mem-scramble], [scramble memory on calls to malloc and free]), opt_memscramble=$enableval) AC_ARG_ENABLE(profiling, AC_HELP_STRING([--enable-profiling], [allow profiling with gprof]), opt_profiling=$enableval) -AC_ARG_ENABLE(static-link, AC_HELP_STRING([--enable-static-link], [link bash statically, for use as a root shell]), opt_static_link=$enableval) +AC_ARG_ENABLE(static-link, AC_HELP_STRING([--enable-static-link], [link utshell statically, for use as a root shell]), opt_static_link=$enableval) dnl So-called `precious' variables AC_ARG_VAR([CC_FOR_BUILD], [C compiler used when compiling binaries used only at build time]) @@ -368,7 +368,7 @@ fi HELPDIR= HELPDIRDEFINE= HELPINSTALL= HELPFILES_TARGET= if test "$opt_separate_help" != no; then if test "$opt_separate_help" = "yes" ; then - HELPDIR='${datadir}/bash' + HELPDIR='${datadir}/utshell' else HELPDIR=$opt_separate_help fi @@ -405,7 +405,7 @@ if test -z "$CFLAGS"; then fi echo "" -echo "Beginning configuration for bash-$BASHVERS-$RELSTATUS for ${host_cpu}-${host_vendor}-${host_os}" +echo "Beginning configuration for utshell-$BASHVERS-$RELSTATUS for ${host_cpu}-${host_vendor}-${host_os}" echo "" dnl compilation checks @@ -476,7 +476,7 @@ dnl default values CFLAGS=${CFLAGS-"$AUTO_CFLAGS"} # LDFLAGS=${LDFLAGS="$AUTO_LDFLAGS"} # XXX -dnl handle options that alter how bash is compiled and linked +dnl handle options that alter how utshell is compiled and linked dnl these must come after the test for cc/gcc if test "$opt_profiling" = "yes"; then PROFILE_FLAGS=-pg @@ -543,9 +543,9 @@ AC_SUBST(LIBS_FOR_BUILD) AC_PROG_GCC_TRADITIONAL dnl BEGIN READLINE and HISTORY LIBRARY SECTION -dnl prepare to allow bash to be linked against an already-installed readline +dnl prepare to allow utshell to be linked against an already-installed readline -dnl first test that the readline version is new enough to link bash against +dnl first test that the readline version is new enough to link utshell against if test "$opt_readline" = yes && test "$opt_with_installed_readline" != "no" then # If the user specified --with-installed-readline=PREFIX and PREFIX @@ -557,8 +557,8 @@ then case "$ac_cv_rl_version" in 8*|9*) ;; *) opt_with_installed_readline=no - AC_MSG_WARN([installed readline library is too old to be linked with bash]) - AC_MSG_WARN([using private bash version]) + AC_MSG_WARN([installed readline library is too old to be linked with utshell]) + AC_MSG_WARN([using private utshell version]) ;; esac fi @@ -786,7 +786,7 @@ AC_FUNC_SETVBUF_REVERSED AC_FUNC_VPRINTF AC_FUNC_STRCOLL -dnl if we're not using the bash malloc but require the C alloca, set things +dnl if we're not using the utshell malloc but require the C alloca, set things dnl up to build a libmalloc.a containing only alloca.o if test "$ac_cv_func_alloca_works" = "no" && test "$opt_bash_malloc" = "no"; then @@ -1235,7 +1235,7 @@ fi # this should be packaged into a script accessible via ${srcdir}/support case "$srcdir" in .) ;; -*) for d in doc tests support lib examples; do # dirs +*) for d in doc tests support lib; do # dirs test -d $d || mkdir $d done for ld in readline glob tilde malloc sh termcap; do # libdirs @@ -1296,7 +1296,7 @@ AC_OUTPUT([Makefile builtins/Makefile lib/readline/Makefile lib/glob/Makefile \ lib/intl/Makefile \ lib/malloc/Makefile lib/sh/Makefile lib/termcap/Makefile \ lib/tilde/Makefile support/Makefile po/Makefile.in \ - support/rash.pc support/rashbug.sh], + support/utshell.pc support/utshellbug.sh], [ # Makefile uses this timestamp file to record whether config.h is up to date. echo timestamp > stamp-h diff --git a/bash-5.1/execute_cmd.c b/bash-5.1/execute_cmd.c index b2933f7f..2c7f2ea7 100644 --- a/bash-5.1/execute_cmd.c +++ b/bash-5.1/execute_cmd.c @@ -5499,7 +5499,6 @@ execute_disk_command (words, redirects, command_line, pipe_in, pipe_out, if (command) { - //printf("command is %s ========== ======= \n",command); /* If we're optimizing out the fork (implicit `exec'), decrement the shell level like `exec' would do. */ #if 0 /* TAG: bash-5.2 psmith 10/11/2020 */ diff --git a/record.txt b/record.txt index db833e5a..66eccd1e 100644 --- a/record.txt +++ b/record.txt @@ -69,3 +69,4 @@ 91 92 93 +94 -- Gitee