Should [[ -v 1 ]] be supported?

2018-12-26 Thread Peng Yu
Hi, [[ -v 1 ]] does not work for $1. $ [ -v 1 ]; echo "$?" 1 $ set -- a $ [ -v 1 ]; echo "$?" 1 Although [[ -z ${1+s} ]] and (($#)) works for testing if $1 is set, neither of them are uniformly better performance wise. In this case, should [[ -v 1 ]] be supported? set -- $(seq 1) time for ((i=

How to compile hashlib.c for testing?

2018-12-26 Thread Peng Yu
Hi, I'd like to compile hashlib.c to try its main(). But I got the following error. What is the correct commands to compile it? Thanks. $ gcc -DPROGRAM='"bash"' -DCONF_HOSTTYPE='"x86_64"' -DCONF_OSTYPE='"darwin17.7.0"' -DCONF_MACHTYPE='"x86_64-apple-darwin17.7.0"' -DCONF_VENDOR='"apple"' -DLOCAL

Re: difference between /tmp and other directory for loadable mkdir?

2018-12-26 Thread Eduardo A . Bustamante López
On Wed, Dec 26, 2018 at 12:40:09PM -0600, Peng Yu wrote: > Hi, > > I can not mkdir -p . in /tmp/ via the loadable mkdir. What is the > difference between /tmp/ and other directories? I am on Mac OS X. Is > this a bug in mkdir? > > $ cd /tmp > $ mkdir -p -- . > -bash: mkdir: .: Operation not permi

difference between /tmp and other directory for loadable mkdir?

2018-12-26 Thread Peng Yu
Hi, I can not mkdir -p . in /tmp/ via the loadable mkdir. What is the difference between /tmp/ and other directories? I am on Mac OS X. Is this a bug in mkdir? $ cd /tmp $ mkdir -p -- . -bash: mkdir: .: Operation not permitted $ cd ~/ $ mkdir -p -- . -- Regards, Peng

Re: bug in dirname loadable?

2018-12-26 Thread Chet Ramey
On 12/24/18 10:35 PM, Peng Yu wrote: > dirname loadable gives the following error. I think the coreutils' > direname's convention is better. Should it be considered as a bug to > fix? > > $ dirname -- -a > dirname: usage: dirname string > $(type -P dirname) -- -a > . Yes, dirname should skip over

Re: write() not retried after EINTR in printf and echo

2018-12-26 Thread Chet Ramey
On 12/25/18 3:01 PM, Bize Ma wrote: > No, that is not the intent. I merely failed to correctly convey the > perception that others have of your code: > > https://unix.stackexchange.com/a/487260/265604 That is, of course, their privilege. > And, having failed, I am trying again. > > But, probab

Re: Unexpected delay in using arguments.

2018-12-26 Thread Chet Ramey
On 12/23/18 12:07 PM, Bize Ma wrote: > Chet Ramey (mailto:chet.ra...@case.edu>>) wrote: > > On 8/15/18 3:36 AM, Bob Proulx wrote: > > > It does look like bash can be more efficient with argument handling. > > Since, for example, dash does it. > > Yes, it just needs new primitives

Re: Error on arithmetic evaluation of `~0`.

2018-12-26 Thread Chet Ramey
On 12/23/18 12:01 PM, Bize Ma wrote: > Chet Ramey (mailto:chet.ra...@case.edu>>) wrote: > > > > > While this works: > > > > var=(hello); echo "${var[ ~0]}" > > hello > > Because negative array subscripts count backwards from the end of the > array. > > > Doh!, yes. A

Re: readline fails to understand options.

2018-12-26 Thread Chet Ramey
On 12/21/18 12:52 AM, Bize Ma wrote: > This works: > >      $ bind 'set enable-bracketed-paste on'; bind -v | grep 'bracketed' > set enable-bracketed-paste on > > However, almost any variation of the parameter "on" is not understood by > readline: > > $ bind 'set enable-bracketed-paste

Re: Memory continusely increase

2018-12-26 Thread Chet Ramey
On 12/26/18 12:35 AM, Eduardo A. Bustamante López wrote: > On Mon, Dec 24, 2018 at 10:51:00AM +0800, chen liu wrote: >> Chet Ramey 于2018年12月22日周六 上午12:51写道: > (...) >>> What is the hard limit on the number of processes for a process started in >>> this environment? (The value of `ulimit -n'.) > >

Re: Terminating background bash kills the parent?

2018-12-26 Thread Chet Ramey
On 12/20/18 12:02 AM, Bize Ma wrote: > Open a new terminal like xterm, change prompt to something like: > >     PS1=' $SHLVL $ ' > > Start a couple of bash subshells: > >     1 $ bash >     2 $ bash >     3 $ echo $$ >     9371 > > Suspend the last one: > >     3 $ suspend >     [1]+ Stopped  

Re: 'eval' exit behaviour in posix mode

2018-12-26 Thread Chet Ramey
On 12/23/18 7:42 PM, Martijn Dekker wrote: > Op 14-12-18 om 14:29 schreef Chet Ramey: >> On 12/14/18 6:46 AM, Martijn Dekker wrote: >>> In current git, 'bash -o posix' no longer exits the shell on a syntax error >>> in the argument to the special builtin 'eval'. Bash 4.2-4.4 exit as POSIX >>> speci

Re: memory leak in bash only during boot up in Bash-3.2.48

2018-12-26 Thread Chet Ramey
On 12/22/18 3:47 AM, ABHISHEK PALIWAL wrote: > Hi Chet, > >>What is the hard limit on the number of processes for a process started in >>this environment? (The value of `ulimit -n'.) > > Here are the Hard and soft limits for open files and max user processes. > root@localhost:/root> ulimit -Hn >

Re: Memory continusely increase

2018-12-26 Thread chen liu
Eduardo A. Bustamante López 于2018年12月26日周三 下午1:35写道: > > On Mon, Dec 24, 2018 at 10:51:00AM +0800, chen liu wrote: > > Chet Ramey 于2018年12月22日周六 上午12:51写道: > (...) > > > What is the hard limit on the number of processes for a process started in > > > this environment? (The value of `ulimit -n'.)