Re: [PATCH] fix uneccesary copy of function bodies for BASH_SOURCE

2024-06-04 Thread Chet Ramey
On 6/4/24 2:10 AM, konsolebox wrote: I haven't looked at this but it will keep lazy functions safe to implement right? Yes. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRUc...@case.eduhttp

Re: [PATCH] fix uneccesary copy of function bodies for BASH_SOURCE

2024-06-03 Thread Koichi Murase
2024年6月4日(火) 15:11 konsolebox : > I haven't looked at this but it will keep lazy functions safe to > implement right? Right. The fix shouldn't change the observable behavior. The functions are saved in two hash tables, `shell_functions' and `shell_function_defs'. The function bodies are supposed

Re: [PATCH] fix uneccesary copy of function bodies for BASH_SOURCE

2024-06-03 Thread konsolebox
On Sat, Jun 1, 2024 at 7:16 PM Koichi Murase wrote: > > --- > variables.c | 4 > 1 file changed, 4 insertions(+) > > diff --git a/variables.c b/variables.c > index 84b30d93..0e785742 100644 > --- a/variables.c > +++ b/variables.c > @@ -3507,7 +3507,11 @@ bind_function_def (const char *name,

Re: [PATCH] fix uneccesary copy of function bodies for BASH_SOURCE

2024-06-03 Thread Chet Ramey
On 6/1/24 7:15 AM, Koichi Murase wrote: This patch fixes `bind_function_def' so that it skips the function body also for the second and later calls. This reduces the memory uses of Bash for shell functions by almost half. Thanks for the analysis and patch. This should not have any negative si

Re: [PATCH] fix uneccesary copy of function bodies for BASH_SOURCE

2024-06-01 Thread Koichi Murase
To add some contexts not in the commit message, I knew that recent versions of Bash consume more memory when the same shell script is loaded. After bisecting, I realized that the increase in memory use was actually caused by a single commit ba4ab055 (see the attached image. The vertical axis is t

[PATCH] fix uneccesary copy of function bodies for BASH_SOURCE

2024-06-01 Thread Koichi Murase
The function `bind_function_def' (variables.c) stores the function metadata in the hash map `shell_function_defs' in variables.c. The saved information is used by BASH_SOURCE (execute_cmd.c) and the output of `declare -F func' with `shopt -s extdebug' (builtin/declare.def) through the interface `f

is there no copy of vars declared for every function but one global 'local' only ?

2021-03-21 Thread Alex fxmbsw7 Ratchev
is to make a for copy instead of [[ -v args[++i] but with that how to make it extend-able for anyone who cares about the code, attached is ogt.tgz in the code ( ogt/ogt ) there is . "$_hd"/function/per '. "$_hd"/init/"$per"' \ set_n_shopt mktermv var

Re: bash doesn't display user-typed characters; can interfere with COPY/PASTE

2020-12-09 Thread L A Walsh
On 2020/12/08 06:07, Chet Ramey wrote: On 12/7/20 8:02 PM, L A Walsh wrote: The problem is that bash isn't displaying a 'tab' character where one was typed. It's readline and redisplay. Readline expands tabs to spaces using an internal tab stop of 8. This allows it to be sure of

Re: bash doesn't display user-typed characters; can interfere with COPY/PASTE

2020-12-08 Thread L A Walsh
On 2020/12/08 06:28, Greg Wooledge wrote: The end result is that it's basically impossible to preserve the original whitespace of your source material across a terminal copy/paste operation. So don't count on that. If you use a random terminal to copy/paste, sure, but if

Re: bash doesn't display user-typed characters; can interfere with COPY/PASTE

2020-12-08 Thread Greg Wooledge
aces using an > internal tab stop of 8. This allows it to be sure of the physical cursor > location, especially when you're doing things like wrapping lines, and > insulates it from varying terminal behavior. In addition to what I said earlier, there is a distinction between things that

Re: bash doesn't display user-typed characters; can interfere with COPY/PASTE

2020-12-08 Thread Chet Ramey
On 12/7/20 8:02 PM, L A Walsh wrote: The problem is that bash isn't displaying a 'tab' character where one was typed. It's readline and redisplay. Readline expands tabs to spaces using an internal tab stop of 8. This allows it to be sure of the physical cursor location, especially when you'r

Re: bash doesn't display user-typed characters; can interfere with COPY/PASTE

2020-12-08 Thread felix
On Tue, Dec 08, 2020 at 08:07:18PM +0700, pepa65 wrote: > On 08/12/2020 19.55, Greg Wooledge wrote: > > Some terminals, when fed a tab character, will preserve that knowledge > > in memory; then, when you copy text from that part of the terminal > > window using your mouse, th

Re: bash doesn't display user-typed characters; can interfere with COPY/PASTE

2020-12-08 Thread pepa65
On 08/12/2020 19.55, Greg Wooledge wrote: > Some terminals, when fed a tab character, will preserve that knowledge > in memory; then, when you copy text from that part of the terminal > window using your mouse, the terminal will put a tab byte into the > selection/clipboard. Intere

Re: bash doesn't display user-typed characters; can interfere with COPY/PASTE

2020-12-08 Thread Greg Wooledge
notok; fi > ok Bash doesn't "display" things. Your terminal displays that. > if I now copy the 'if' line and paste it > > if [[ ' ' == $'\t' ]]; then echo ok; else echo notok; fi > notok Some terminals, when fed a tab character, will preserv

Re: bash doesn't display user-typed characters; can interfere with COPY/PASTE

2020-12-08 Thread Andreas Schwab
Just use history or fc -l to display the line as is. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."

Re: bash doesn't display user-typed characters; can interfere with COPY/PASTE

2020-12-08 Thread Chris Elvidge
On 08/12/2020 01:02 am, L A Walsh wrote: If I type in ( + are keypresses) if [[ '' == $'\t' ]]; then echo ok; else echo notok; fi bash displays: if [[ ' ' == $'\t' ]]; then echo ok; else echo notok; fi ok if I now copy the 'if' line and p

bash doesn't display user-typed characters; can interfere with COPY/PASTE

2020-12-07 Thread L A Walsh
If I type in ( + are keypresses) if [[ '' == $'\t' ]]; then echo ok; else echo notok; fi bash displays: if [[ ' ' == $'\t' ]]; then echo ok; else echo notok; fi ok if I now copy the 'if' line and paste it if [[ ' ' == $'\t

Re: copy

2016-02-25 Thread Dave Finlay
st'; mkdir -p "${dest_dir}" && find . -type f -mtime +10 -name "*.txt" -exec cp --preserve {} "${dest_dir}" \; Dave Finlay On Thu, Feb 25, 2016 at 5:41 PM, Val Krem wrote: > Hi, > > I want to copy files which are older than 10 days with the ex

Hard-copy terminals

2014-11-06 Thread Ryan Cunningham
Darwin Kernel Version 14.0.0: Sat Sep 27 03:58:47 PDT 2014; root:xnu-2782.1.97~11/RELEASE_X86_64 x86_64 Machine Type: x86_64-apple-darwin14.0.0 Bash Version: 4.3 Patch Level: 30 Release Status: release Description: Some features of Bash don't recognize hard-copy terminals.

Re: Copy in bash

2011-06-07 Thread Bob Proulx
vin_eets wrote: > I am using windows Then you will need to be aware of windows specific conventions. > I wanna copy a file in folder from one location to another folder in another > drive. > > Its working fine but not when file name contain spaces i.e. if the filename >

Copy in bash

2011-06-07 Thread vin_eets
I am using windows I wanna copy a file in folder from one location to another folder in another drive. Its working fine but not when file name contain spaces i.e. if the filename is a b c What would be script to acheive this functionality -- View this message in context: http

Re: cp command will copy to subdirectory without appending /

2009-10-23 Thread Marc Herbert
> The problem is dead-simple. You cannot run this command multiple times: > > cp -R ./dirfoo ./dirfoo.backup > Sorry to add yet another (last) off topic message but I must do justice to GNU cp. GNU cp actually does support the above thanks to a (non-standard) option: cp -R -T ./dir

Re: cp command will copy to subdirectory without appending /

2009-10-21 Thread Marc Herbert
to the source directory. >> Appending a / would imply the directory: >> cp -R test2 test/ >> This usage will remove the ambiguity of the command between the copy >> function and the rename function. > Please rephrase your question and send it to bug-coreut...@gnu.org. This is probably not worth the hassle considering that any change would break decades of scripts.

Re: cp command will copy to subdirectory without appending /

2009-10-21 Thread Todd Partridge
On Tue, Oct 20, 2009 at 12:59 AM, Bob Proulx wrote: > Todd Partridge wrote: >> The cp command will copy to a subdirectory without an appending / > > You have reached bug-bash, not bug-coreutils.  The 'cp' program is in > the GNU Coreutils project and so bug reports

Re: cp command will copy to subdirectory without appending /

2009-10-19 Thread Bob Proulx
Todd Partridge wrote: > The cp command will copy to a subdirectory without an appending / You have reached bug-bash, not bug-coreutils. The 'cp' program is in the GNU Coreutils project and so bug reports for 'cp' should go to bug-coreut...@gnu.org and not to bug-bash. T

cp command will copy to subdirectory without appending /

2009-10-19 Thread Todd Partridge
The cp command will copy to a subdirectory without an appending / mkdir test test2 touch abc test touch bcd test2 cp -R test2 test ls test test2 abc Since the cp command can also rename I think the proper behavior here for 'cp -R test2 test' would be to error and print that '