use of set -e inside parenthesis and conditionnal second command

2020-11-17 Thread Pierre Colombier via Bug reports for the GNU Bourne Again SHell
the manual suggests it should not act like this. The solution may be to improve the manual instead of fixing the software. Please, consider the 3 next lines #1 pierre@zebulon: ~ $ (set -e ; echo A ; false ; echo B ) ; echo C.$? A C.1 #Works fine #2 pierre@zebulon: ~ $ (set -e ; echo A ; fa

Re: Undocumented feature: Unnamed fifo '<(:)'

2020-06-28 Thread Pierre Gaston
On Sun, Jun 28, 2020 at 3:50 PM felix wrote: > There is maybe something to document or even create a new feature > about open2 and open3... > Maybe "coproc" is already the feature you need (limited to only 1 though)?

binfalse is set to true in the lastpipe test

2020-05-31 Thread Pierre Labastie
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -g -O2 -Wno-parentheses -Wno-format-security uname output: Linux turboli 5.6.15-lfs-1 #1 SMP Wed May 27 21:46:33 CEST 2020 x86_64 GNU/Linux Machine Type: x86_64-pc-lin

Re: local failure

2020-05-31 Thread Pierre Gaston
On Sun, May 31, 2020 at 5:22 PM Oğuz wrote: > 31 Mayıs 2020 Pazar tarihinde Laurent Picquet yazdı: > > > Ok, thanks for the clarification. > > > > This behaviour is not fully documented and I believe this should be > > addressed. > > > > > I think it is very well documented in the Simple Command

Re: alias problem -- conflict found

2019-07-10 Thread Pierre Gaston
On Wed, Jul 10, 2019 at 2:03 PM L A Walsh wrote: > > > On 2019/07/10 00:04, Robert Elz wrote: > > Date:Tue, 09 Jul 2019 20:24:30 -0700 > > From:L A Walsh > > Message-ID: <5d255a6e.4060...@tlinx.org> > > > > | Why? What makes clarity "horrible". > > > > It isn'

Re: Mozilla's Security Warning for Link For Maintainer's "Bash Page" Link ......

2019-05-05 Thread Pierre Gaston
w.linux-magazine.com/Issues/2019/222/New-Commands-for-Old-Purposes, I can only see the first of these commands and it's not a bash builtin command but an external executable. I suspect most of these commands are like this one, so look for them in your software repository. (eg sudo apt-get install

Re: How to compile hashlib.c for testing?

2018-12-27 Thread Pierre Gaston
ot; instead of main in my test programs. (basically what is used by cmocka to mock C functions https://lwn.net/Articles/558106/) I'm aware that it may raise more questions and difficulties for you than actually solving anything but it is my 2 cents. Pierre

Re: Assignment of $* to a var removes spaces on unset IFS.

2018-08-14 Thread Pierre Gaston
On Tue, Aug 14, 2018 at 6:18 AM Eduardo A. Bustamante López < dual...@gmail.com> wrote: > On Mon, Aug 13, 2018 at 10:52:20PM -0400, Bize Ma wrote: > (...) > > That version is not even beta, it is still alpha, are you asking that > > everyone should use > > non-released (and not yet tested as beta)

Re: bash brace issues (similar to shellshock)

2018-08-06 Thread Pierre Gaston
On Mon, Aug 6, 2018 at 4:32 PM, martins dada wrote: > Find attached details regarding bash brace issues. King regards. > you are simply assigning (){ to a temporary environment before running the command $ n=(){ bash -c 'echo $n' (){ just like: a=foo bash -c 'echo $a' I'd agree that I would

Re: Number with sign is read as octal despite a leading 10#

2018-07-10 Thread Pierre Gaston
On Tue, Jul 10, 2018 at 1:44 PM, Ilkka Virta wrote: > I think the problematic case here is when the number comes as input from > some program, which might or might not print a leading sign or leading > zeroes, but when we know that the number is, in any case, decimal. > > E.g. 'date' prints leadi

Re: Directing into a variable doesn't work

2018-06-24 Thread Pierre Gaston
On Sun, Jun 24, 2018 at 8:35 PM, Peter Passchier wrote: > On 06/25/2018 12:27 AM, Robert Elz wrote: > > That's not the real issue - rather it is that a here doc is presented to > the > > command beng run as a file descrptior > > OK, thanks, that makes sense. In the case of a here-variable, that w

Re: Conditions with logical operators and nested groups execute "if" and "else"

2018-05-21 Thread Pierre Gaston
On Tue, May 22, 2018 at 12:17 AM, Uriel wrote: > Configuration Information: > Machine: x86_64 > OS: linux-gnu > Compiler: gcc > Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' > -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' > -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/s

Re: ind=`expr index "${string}" is` -----bug

2018-03-18 Thread Pierre Gaston
> From: zangwenkuo > > To: bug-bash@gnu.org > when i use the fun as title (expr) > i got a "expr: syntax error" > > expr is an external tool, and expr is the one giving you an error, so it's not a problem of "bash" The error may be that your "expr" tool is not the gnu version and thus doesn't suppo

Re: which paradigms does bash support

2018-03-14 Thread Pierre Gaston
On Mon, Jan 26, 2015 at 6:05 PM, Pádraig Brady wrote: > On 26/01/15 13:43, Greg Wooledge wrote: > > On Sun, Jan 25, 2015 at 08:11:41PM -0800, garegi...@gmail.com wrote: > >> As a programming language which paradigms does bash support. > Declarative, procedural, imperative? > > > > This belongs on

Re: Arm machine does not execute background statement correctly

2018-02-28 Thread Pierre Gaston
On Wed, Feb 28, 2018 at 4:03 PM, Chet Ramey wrote: > On 2/28/18 5:31 AM, Lakshman Garlapati wrote: > > > The following snippet is working fine in x86 processor machine not > working > > in arm processor machine from bash 4.3 version onwards. > > > > test.sh > > = > > #!/bin/bash > > rm out.tx

Re: Function definitions

2018-02-26 Thread Pierre Gaston
On Mon, Feb 26, 2018 at 12:45 PM, wrote: > > Configuration Information [Automatically generated, do not change]: > Machine: x86_64 > OS: linux-gnu > Compiler: gcc > Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' > -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu

Re: Quoting and string comparison

2018-02-08 Thread Pierre Gaston
On Thu, Feb 8, 2018 at 4:27 PM, Jaan Vajakas wrote: > So should Bash report a syntax error? > You do not have a syntax error, the rules for quoting inside $( ) are the same as outside, whether you use outside quotes "$( )" or not So in your case you are escaping the double quotes and concatena

Re: ~/.profile and ~/.bash_profile aren't executed on login

2017-12-09 Thread Pierre Gaston
On Sun, Dec 10, 2017 at 1:41 AM, Yuri wrote: > On 12/09/17 15:24, Chet Ramey wrote: > >> Of course not: that's not a login shell. As the documentation says, >> >> "A login shell is one whose first character of argument zero is a -, or >> one started with the --login option." >> >> The INVOCATIO

Re: help complete: mention remove all AND restore all

2017-11-05 Thread Pierre Gaston
On Sun, Nov 5, 2017 at 6:58 PM, 積丹尼 Dan Jacobson wrote: > $ help complete > > -rremove a completion specification for each NAME, or, if no > NAMEs are supplied, all completion specifications > > Add > To later restore them do ... > > as one often want

Re: Documentation issue

2017-10-26 Thread Pierre Gaston
On Thu, Oct 26, 2017 at 8:18 AM, Eli Barzilay wrote: > Bash surprised me with the behavior mentioned here: > > https://stackoverflow.com/questions/15897473 > > This can be pretty bad in that it's very unexpected (see the comments). > Also, the surprise can be triggered without nullglob as wel

Re: RFE & RFC: testing executability

2017-10-01 Thread Pierre Gaston
On Sun, Oct 1, 2017 at 7:31 AM, L A Walsh wrote: > I was looking at a script that tested command for execute before > executing them. > The script used: > > cmd=$(PATH=/stdpath type -p cmd) > > and later tested executability with "-x $cmd", raising 2 problems. The > first was "-p" returning empt

Re: [BUG] Bash segfaults on an infinitely recursive funcion (resend)

2017-09-24 Thread Pierre Gaston
On Sun, Sep 24, 2017 at 5:01 PM, Shlomi Fish wrote: > Hi all, > > With bash git master on Mageia v7 x86-64, bash on Debian Stable and other > reported sytems: > > shlomif@telaviv1:~$ /home/shlomif/apps/bash/bin/bash -c 'run() { run; } ; > run' > Segmentation fault (core dumped) > shlomif@telaviv1

Re: extension of file-test primitives?

2017-08-23 Thread Pierre Gaston
On Wed, Aug 23, 2017 at 3:55 PM, L A Walsh wrote: > > > Greg Wooledge wrote: > >> >> >> They're not intended to work that way. If you want to test f+x+s then >> you just make another function: >> >> -fxs() { test -f "$1" && test -x "$1" && test -s "$1"; } >> >> > How many different single-ops?

Re: Document bug of 'for' compound command

2017-08-18 Thread Pierre Gaston
On Fri, Aug 18, 2017 at 6:22 PM, vanou wrote: > Hello, > > I think, there is document bug related to 'for' compound command in both > Man page and Info doc. > > > In man page, description of 'for' compound command ... > > >

Re: Performance issue of find function in Gluster File System

2017-08-16 Thread Pierre Gaston
On Wed, Aug 16, 2017 at 11:02 PM, Zhao Li wrote: > Hi, > > I found there is a big difference of time performance between "ls" function > and "find" function in Gluster File System > ide/GlusterFS%20Introduction/>. > Here is the minima

Re: bash 4.4 null byte warning!!

2017-08-03 Thread Pierre Gaston
On Thu, Aug 3, 2017 at 1:56 PM, emlyn.j...@wipro.com wrote: > Hi guys! > > My organization is receiving repeated alerts for using my mail id here : > https://mail-archive.com/bug-bash@gnu.org/msg19561.html > > Could you please remove my maid id? > > Thank you! > > Regards, > Emlyn Jose. > > This

Re: bash segfaults on a recursive command

2017-07-28 Thread Pierre Gaston
On Fri, Jul 28, 2017 at 5:01 PM, wrote: > Configuration Information [Automatically generated, do not change]: > Machine: x86_64 > OS: linux-gnu > Compiler: gcc -I/home/abuild/rpmbuild/BUILD/bash-4.3 > -L/home/abuild/rpmbuild/BUILD/bash-4.3/../readline-6.3 > Compilation CFLAGS: -DPROGRAM='bash' -

Re: Regression -- can't read input w/stderr redirect

2017-06-19 Thread Pierre Gaston
ese years of trolling the list, Chet is going to great length to explain the rationale of his choices while you keep whining for the shell to just do what you want in the random particular case you happen to work at the moment. Your response: you accuse him to lie to you. I don't think this is constructive in any way and I'm sure that, even if Chet has probably experienced this kind of online situation more than most, it's not a pleasant one. Pierre.

Re: Storing NUL in variables

2017-06-10 Thread Pierre Gaston
On Sat, Jun 10, 2017 at 2:06 AM, George wrote: > On Fri, 2017-06-09 at 20:58 +0300, Pierre Gaston wrote: > > On Fri, Jun 9, 2017 at 8:40 PM, Peter & Kelly Passchier > wrote: > > > > On 09/06/2560 23:38, L A Walsh wrote: > > > Chet Ramey wrote: > >

Re: Trailing newlines disappear

2017-06-09 Thread Pierre Gaston
On Fri, Jun 9, 2017 at 8:40 PM, Peter & Kelly Passchier < peterke...@passchier.net> wrote: > On 09/06/2560 23:38, L A Walsh wrote: > > Chet Ramey wrote: > >> > >> Should mapfile silently drop the NULs? > > > > Maybe add a flag to ignore NUL bytes that could be used in the 'read' > > statement as

Re: History Feature issue

2017-05-22 Thread Pierre Gaston
re is little documentation so as a result you kind have to look around in bash source code, and cool builtins could be a way to contribute to bash. At least that's what I do ( https://github.com/pgas ), even though I have no real ambition doing this :D Pierre On Mon, May 22, 2017 at 1:27

Re: {varname} redirection for a command or group leaves the file open

2017-05-19 Thread Pierre Gaston
On Sat, May 20, 2017 at 5:38 AM, Eduardo Bustamante wrote: > On Fri, May 19, 2017 at 3:32 PM, wrote: > [...] > > I'd really like to see Bash get on the right side of this issue - and > > the sooner the better. > > There is no right side. Only two opposing viewpoints. I don't think > it's enough

Re: {varname} redirection for a command or group leaves the file open

2017-05-10 Thread Pierre Gaston
efined inside the subshell. With > groups it will remain defined after the group: > > { echo "inside the grouping: $var1"; } {var1}>/dev/null > echo "outside the grouping: $var1" > (echo "inside the subshell: $var2") {var2}>/dev/null > echo "outside the subshells: $var2" > > So in summary, I would expect groups to work like subshells, both in > regards to closing the file descriptor but also in regards to the scope > of the variable. > > See: https://lists.gnu.org/archive/html/bug-bash/2012-11/msg00040.html Pierre PS: I'm with you ;)

Re: Brace expansion fail compilation

2017-04-26 Thread Pierre Gaston
On Wed, Apr 26, 2017 at 1:13 PM, Florian Mayer wrote: > $ echo $BASH_VERSION > 4.4.12(1)-release > $ echo $BASH_VERSION{nobraceexpansion} > 4.4.12(1)-release{nobraceexpansion} > $ echo ${BASH_VERSION}{brace,expansion} > 4.4.12(1)-releasebrace 4.4.12(1)-releaseexpansion > $ echo $BASH_VERSION{brac

Re: Syntax error near unexpected token `newline' within loops

2017-04-24 Thread Pierre Gaston
On Mon, Apr 24, 2017 at 1:59 PM, wrote: > (...) > > and yes > > V_NAME=Friday > for (( INDEX=0; INDEX<$((10-${#V_NAME})) ; INDEX++ )) > do > echo $INDEX > done > > does also work, nevertheless using $(...) in the very first example is > allowed > > or e

Re: Curious case of arithmetic expansion

2017-04-23 Thread Pierre Gaston
On Sun, Apr 23, 2017 at 4:07 PM, Florian Mayer wrote: > It does not matter, how this construct in this particular context is > called. > The difference between $(()) and (()) is that $(()) actually expands to > something > whereas (()) just executes a C-like expression. In (()) > can also > incl

Re: Curious case of arithmetic expansion

2017-04-23 Thread Pierre Gaston
On Sun, Apr 23, 2017 at 3:28 PM, Florian Mayer wrote: > What I’m saying is, that if bash does recursively apply expansion > mechanisms on the identifiers until it can retrieve a number, > it should do it symmetrically. That is, > it should remember what chain of expansion had been necessary for >

Re: Curious case of arithmetic expansion

2017-04-23 Thread Pierre Gaston
On Sun, Apr 23, 2017 at 1:12 PM, Florian Mayer wrote: > Consider > > $ foo=bar; bar=moo; moo=123 > $ echo $foo $bar $moo > => bar moo 123 > $ echo $((foo)) > => 123 > $ echo $foo $bar $moo > => bar moo 123 > $ # so far so good but > $ ((foo++)) > $ echo $foo $bar $moo > => 123 moo 123 > > Now my

builtins.h missing include guard

2017-04-19 Thread Pierre Gaston
I'm toying with loadable builtins and I noticed that builtins.h does not have include guard. Basically I needed the definition of WORLD_LIST and I was using (not sure if there is a better way): #include #include #include That's all Pierre

Re: ``shopt -s extglob'' and ``function @() { true; }''

2017-03-30 Thread Pierre Gaston
On Fri, Mar 31, 2017 at 7:00 AM, Clark Wang wrote: > There is a post on stackoverflow: http://stackoverflow.com/ > questions/43117707/bashs-strange-behavior-on-a-function-named/ > > The *problem*: > > bash-4.4# shopt -s extglob > bash-4.4# function @() { echo foo; } > bash-4.4# @() > foo > bash-4

Re: process substitution flawed by design

2017-02-21 Thread Pierre Gaston
On Tue, Feb 21, 2017 at 3:18 PM, Florian Mayer wrote: > The following code assumes the lock to be in state not-taken before the > snippet runs. > > echo foo | tee \ > >(mutex --lock; echo before; cat; echo after; mutex --unlock) \ > >(mutex --lock; echo foobar; mutex --unlock) \ > >

Re: process substitution flawed by design

2017-02-21 Thread Pierre Gaston
On Tue, Feb 21, 2017 at 4:00 PM, Pierre Gaston wrote: > > > On Tue, Feb 21, 2017 at 3:18 PM, Florian Mayer > wrote: > >> The following code assumes the lock to be in state not-taken before the >> snippet runs. >> >> echo foo | tee \ >> >(m

Re: Does bash treat segment fault causing by scripts as security bugs ?

2017-02-15 Thread Pierre Gaston
ashing > bash. > > I think you should feel free to submit your bug report, since the number of reports is low, false reports are not a problem and you may have a genuine bug. > 2017-02-15 21:01 GMT+08:00 Pierre Gaston : > >> >> >> On Wed, Feb 15, 2017 at

Re: Does bash treat segment fault causing by scripts as security bugs ?

2017-02-15 Thread Pierre Gaston
On Wed, Feb 15, 2017 at 11:44 AM, kkk K <3n4t...@gmail.com> wrote: > for example, > simple bash recur function call: > > == > #!/bin/bash > > function test() > { > test $1 > } > > test 1 > == > > sincerely for your reply > > bash has a special variable FUNCN

Re: echo -n

2017-02-02 Thread Pierre Gaston
On Thu, Feb 2, 2017 at 11:02 AM, Sangamesh Mallayya < sangamesh.sw...@in.ibm.com> wrote: > Hi, > > description: > in bash echo -n , echo -e , echo -E has a special meaning. But we do not > have a way in bash shell if we want to print > -n , -e and -E using echo command. Other shells supports print

Re: Terminal stop when a group of pipelines is piped to a pager

2016-09-28 Thread Pierre Gaston
On Wed, Sep 28, 2016 at 10:35 AM, Abhijit Dasgupta wrote: > Configuration Information [Automatically generated, do not change]: > Machine: x86_64 > OS: linux-gnu > Compiler: gcc > Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' > -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc

Re: redirection inside a process-substitution

2016-08-23 Thread Pierre Gaston
On Mon, Aug 22, 2016 at 10:38 PM, wrote: > When doing redirection inside a sub-process to a descriptor that is > redirected to a file the output of the subshell goes into the file. > > Now when the same descriptor is again redirected to another descriptor for > this whole > command-list, the outp

Re: smart indented HERE docs

2016-08-21 Thread Pierre Gaston
On Mon, Aug 22, 2016 at 6:47 AM, Derek Schrock wrote: > > Would it be possible to add a new character (+) to the here-doc such > that the number of tabs remove are the number after the closing > delimiter (EOF in the above example): > > > cat <<+ EOF > Testing

Re: echo builtin command will give the wrong value of the variable when there is a file named: 11 in the current directory

2016-07-27 Thread Pierre Gaston
On Wed, Jul 27, 2016 at 2:28 PM, Lingfei Kong <466701...@qq.com> wrote: > Another reproducer: > > # c='[1][1][1]' > # touch 111 > # echo $c > 111 > # rm 111 > # echo $c > [1][1][1] > > -- Original -- > *From: * "Lingfei Kong";<466701...@qq.com>; > *Date: * Wed, Jul

Re: Array variables still seen by test -v as unset even after assignment

2016-07-26 Thread Pierre Gaston
On Tue, Jul 26, 2016 at 8:29 PM, wrote: > Configuration Information [Automatically generated, do not change]: > Machine: x86_64 > OS: linux-gnu > Compiler: x86_64-pc-linux-gnu-gcc > Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' > -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-

Re: ordering of printed lines changes when redirecting

2016-07-18 Thread Pierre Gaston
On Mon, Jul 18, 2016 at 11:22 AM, walter harms wrote: > > Configuration Information [Automatically generated, do not change]: > Machine: x86_64 > OS: linux-gnu > Compiler: gcc -I/home/abuild/rpmbuild/BUILD/bash-4.2 > -L/home/abuild/rpmbuild/BUILD/bash-4.2/../readline-6.2 > Compilation CFLAGS: -D

Re: Officially document that we allow other characters in function names

2016-06-27 Thread Pierre Gaston
On Mon, Jun 27, 2016 at 8:15 PM, Pierre Gaston wrote: > > > On Mon, Jun 27, 2016 at 7:17 PM, konsolebox wrote: > >> On Mon, Jun 27, 2016 at 10:41 PM, Chet Ramey wrote: >> > On 6/27/16 3:11 AM, konsolebox wrote: >> >> Hi, I think it's time that

Re: Officially document that we allow other characters in function names

2016-06-27 Thread Pierre Gaston
On Mon, Jun 27, 2016 at 7:17 PM, konsolebox wrote: > On Mon, Jun 27, 2016 at 10:41 PM, Chet Ramey wrote: > > On 6/27/16 3:11 AM, konsolebox wrote: > >> Hi, I think it's time that we officially specify in the manual of Bash > >> that we allow other characters besides [[:alnum:]_] when declaring >

Re: Leak in BASH "named" file descriptors?

2016-04-13 Thread Pierre Gaston
On Wed, Apr 13, 2016 at 3:51 PM, Chet Ramey wrote: > On 4/13/16 1:54 AM, George Caswell wrote: > > > Personally, I don't think it makes sense for a redirection on a command > to > > persist beyond the scope of that command. A redirection with a > > dynamically-assigned fd is basically equivalent

Re: bash "while do echo" can't function correctly

2016-04-13 Thread Pierre Gaston
On Wed, Apr 13, 2016 at 2:34 PM, John McKown wrote: > On Wed, Apr 13, 2016 at 1:10 AM, Geir Hauge wrote: > > ​... > > >> though printf should be preferred over echo: >> >> while read -r line; do printf '%s\n' "$line"; done < test.txt >> > > ​I've never read about using printf in preference t

Re: mv to a non-existent path now renames instead of failing

2016-03-19 Thread Pierre Gaston
On Thu, Mar 17, 2016 at 1:37 PM, wrote: > Configuration Information [Automatically generated, do not change]: > Machine: x86_64 > OS: linux-gnu > Compiler: gcc > Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' > -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu' >

Re: `${PARAMETER:OFFSET}' does not work for negative offset

2016-02-12 Thread Pierre Gaston
On Fri, Feb 12, 2016 at 10:22 AM, Ulrich Windl < ulrich.wi...@rz.uni-regensburg.de> wrote: > Configuration Information [Automatically generated, do not change]: > Machine: x86_64 > OS: linux-gnu > Compiler: gcc -I/home/abuild/rpmbuild/BUILD/bash-4.2 > -L/home/abuild/rpmbuild/BUILD/bash-4.2/../read

Re: Bug on function.

2015-12-08 Thread Pierre Gaston
On Tue, Dec 8, 2015 at 10:29 AM, Kelvin Tan Thiam Teck wrote: > dumbass@Lucifer:~$ ./report.sh 'echo' 1 2 3 4 5 6 7 8 9 10 > param 1 : echo > param 2 : 1 > param 3 : 2 > param 4 : 3 > param 5 : 4 > param 6 : 5 > param 7 : 6 > param 8 : 7 > param 9 : 8 > param 10 : echo0 > param 11 : ec

Re: Bug on function.

2015-12-08 Thread Pierre Gaston
On Tue, Dec 8, 2015 at 9:58 AM, Kelvin Tan Thiam Teck wrote: > dumbass@Lucifer:~$ ./report.sh "echo ln -s /sbin/halt; mv halt ;reboot8 ;* > reboot*" AAA AAA AAA AAA AAA AAA AAA AAA AAA AAA AAA AAA AAA AAA AAA AAA > AAA AAA AAA AAA > Before Passing Thru Function: echo ln -s /sbin/halt; mv halt ;re

Re: Bug on function.

2015-12-07 Thread Pierre Gaston
On Tue, Dec 8, 2015 at 9:16 AM, Kelvin Tan Thiam Teck wrote: > Hi, > Please try my payload on that script, before telling me what $@ and $* > does. and see if my param1 injection will cause your system to reboot on > 18th param. it has nothing to do with $@ & $*, it's another bugs on bash > which

Re: Lower case construction does not working properly

2015-11-24 Thread Pierre Gaston
On Tue, Nov 24, 2015 at 2:23 PM, Michael Kazakov wrote: > Hellol. > I have founded a bug in variable manipulation behavior of bash version > 4.2.53. > Constructions ${parameter,pattern} and ${parameter,,pattern} does not > working properly: > michael@kazakov:~> VAR=COLORADO > michael@kazakov:~> e

Re: Design question(s), re: why use of tmp-files or named-pipes(/dev/fd/N) instead of plain pipes?

2015-10-22 Thread Pierre Gaston
On Thu, Oct 22, 2015 at 5:57 AM, Linda Walsh wrote: > > But only as a pointer to something one can do I/O on. > You can't set any file attributes or metadata on "pipe:[]" It's not a > real file somewhere. > Yes, it's not a regular file, but it not the less true that <( ) gives you a

Re: GNU Guile integration

2015-07-14 Thread Pierre Gaston
On Tue, Jul 14, 2015 at 11:13 AM, Charles Daffern wrote: > On 14/07/15 06:49, Dmitry Bogatov wrote: > > Guile is for situations, when script is mainly calls other programs, > > but still needs moderately complex logic of text manipulation, > > compraison and mapping. Recently I wrote script, that

Re: Weird background crashing bug

2015-06-28 Thread Pierre Gaston
On Mon, Jun 29, 2015 at 5:54 AM, Braden Best wrote: > Re-send: > > > I noticed it when I tried to branch an xterm off into multiple sessions > and mistyped its name: > > `xter m&` > > So after experimenting with a ton of different scenarios I've come to this > conclusion: > > * both xterm and gno

Re: Bug Reporting

2015-06-09 Thread Pierre Gaston
On Tue, Jun 9, 2015 at 11:16 AM, Avinash Thapa wrote: > Hi, I'll report the bug via email only. > > In this, you are able to get the /etc/passwd file inside an error, this > thing looks weird to me so I thought to report you this thing. > > Just write in your terminal > bash -i '/etc/passwd'

Re: (read -r var) vs <(read -r var) behavior

2015-05-22 Thread Pierre Gaston
On Wed, May 20, 2015 at 4:12 AM, Chet Ramey wrote: > On 5/19/15 1:42 AM, Pierre Gaston wrote: > > > The question really is (I discussed this with him on IRC) why can you do: > > > > $ cat <(read var > blah > > blah > > > > but not: > > >

Re: (read -r var) vs <(read -r var) behavior

2015-05-18 Thread Pierre Gaston
On Mon, May 18, 2015 at 10:26 PM, Chet Ramey wrote: > On 5/16/15 1:11 PM, marz...@gmail.com wrote: > > > Bash Version: 4.3 > > Patch Level: 30 > > Release Status: release > > > > Description: > > from interactive shell running cat < <(read -r var) prints: > > bash: read: rea

Re: The restricted shell can be easily circumvented.

2015-04-04 Thread Pierre Gaston
On Sat, Apr 4, 2015 at 8:22 AM, David Bonner wrote: > Bash Bug Report > > Configuration Information [Automatically generated, do not change]: > Machine: x86_64 > OS: linux-gnu > Compiler: gcc > Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' > -DCONF_OSTYPE='linux-gnu' -DCONF_MACHT

Re: bang-hash behavior change?

2015-02-26 Thread Pierre Gaston
On Thu, Feb 26, 2015 at 2:40 AM, Milo H. Fields wrote: > Greetings, > > I noticed that the 'bang-hash' behavior seems to have changed somewhere > between bash version 4.1.17 and 4.3.33. > > > > e.g. for the script 'jnk' containing: > > echo "plain: !#" > > echo " parens: ${!#}" > > > > bash 4.3.

Re: how to search for commands

2015-02-24 Thread Pierre Gaston
On Tue, Feb 24, 2015 at 1:51 PM, wrote: > hmm. but can I use a wildcard with any of them. For example search for all > commands which contain the word "nice". Which would bring up ionice. > compgen -c | grep nice

Re: how to search for commands

2015-02-24 Thread Pierre Gaston
On Tue, Feb 24, 2015 at 7:11 AM, Dan Douglas wrote: > On Mon, Feb 23, 2015 at 10:50 PM, wrote: > > How do you search for commands? In powershell you have the get-command > cmdlet. Is there anything equivalent in unix? > > Depends on the type of command. For shell builtins, bash has `help': > >

Re: how to search for commands

2015-02-24 Thread Pierre Gaston
Thanks for your useful input. On Tue, Feb 24, 2015 at 12:54 PM, Hans J Albertsson < hans.j.alberts...@gmail.com> wrote: > Help in bash seems to do most of what's actually needed. > > Hans J. Albertsson > From my Nexus 5 > Den 24 feb 2015 11:48 skrev "Hans J Albertsson" < > hans.j.alberts...@g

Re: Nested calls to getopts incorrectly parses clustered options

2015-01-14 Thread Pierre Gaston
On Wed, Jan 14, 2015 at 12:35 PM, Øyvind 'bolt' Hvidsten wrote: > Nobody else having issues with this? > It's still a case in bash 4.3.30 > > > On 31/05/14 18:40, Øyvind Hvidsten wrote: > >> For a simple test: >> >> $ f() { local OPTIND=1 OPTARG OPTERR opt; while getopts ":abcxyz" opt; >> do echo

Re: Random loss of bash history

2014-10-10 Thread Pierre Gaston
On Fri, Oct 10, 2014 at 11:40 AM, Linda Walsh wrote: > You DID read the release notes and changes from 4.2->4.3. > > Someone had the bright idea that .. in 4.2, '0' meant no limit in > history (in bash and readline)... but in 4.3, '0' means 0 and throw > away history while negative values mean ke

Re: bash uses tmp files for inter-process communication instead of pipes?

2014-10-07 Thread Pierre Gaston
On Tue, Oct 7, 2014 at 8:45 PM, Linda Walsh wrote: > > > Greg Wooledge wrote: > >> OK, then use a function to give you an escapable block: >> >> declare -A ... >> create_maps() { >> cd "$sysnet" || return >> for ifname in ...; do >> hwaddr=$(<"$ifname"/address) >> act_hw2i

Re: bash uses tmp files for inter-process communication instead of pipes?

2014-10-06 Thread Pierre Gaston
On Tue, Oct 7, 2014 at 12:00 AM, Linda Walsh wrote: According to Chet , only way to do a multi-var assignment in bash is > > >>> read a b c d <<<$(echo ${array[@]}) >>> >> >> The redundant $(echo...) there is pretty bizarre. Then again, that >> whole command is strange. You have a nice friendl

Re: bash uses tmp files for inter-process communication instead of pipes?

2014-10-06 Thread Pierre Gaston
On Mon, Oct 6, 2014 at 10:38 PM, Linda Walsh wrote: > Greg Wooledge wrote: > >> On Mon, Oct 06, 2014 at 12:14:57PM -0700, Linda Walsh wrote: >> >>>done <<<"$(get_net_IFnames_hwaddrs)" >>> >> >> Where am I using a HERE doc? >>> >> >> <<< and << both create temporary files. >> > > > According

Re: Issues with exported functions

2014-09-25 Thread Pierre Gaston
On Thu, Sep 25, 2014 at 1:04 PM, lolilolicon wrote: > On Thu, Sep 25, 2014 at 5:51 PM, Pierre Gaston > wrote: > > > > > > On Thu, Sep 25, 2014 at 12:42 PM, lolilolicon > wrote: > >> > >> On Thu, Sep 25, 2014 at 7:19 AM, Linda Walsh wrote: >

Re: Issues with exported functions

2014-09-25 Thread Pierre Gaston
On Thu, Sep 25, 2014 at 12:42 PM, lolilolicon wrote: > On Thu, Sep 25, 2014 at 7:19 AM, Linda Walsh wrote: > > lolilolicon wrote: > >> > >> I don't expect more than a dozen who rely on this... but bash > >> programmers can be quite the perverts, so... > >> > > > > Personally I find those who don

Re: Issues with exported functions

2014-09-25 Thread Pierre Gaston
On Thu, Sep 25, 2014 at 11:06 AM, lolilolicon wrote: > On Thu, Sep 25, 2014 at 9:35 AM, Chet Ramey wrote: > > On 9/24/14, 3:44 PM, lolilolicon wrote: > > > >> Personally, I have never needed this feature. I would vote for its > >> removal: It's very surprising, creates bugs, and is not very usef

Re: Difference between assignment via nameref vs `printf -v`?

2014-08-31 Thread Pierre Gaston
On Sun, Aug 31, 2014 at 7:19 PM, lolilolicon wrote: > On Sun, Aug 31, 2014 at 12:20 PM, lolilolicon > wrote: > > Assignment to a subscripted array variable behaves differently for > > nameref vs `printf -v`, as shown below. > > > > Assignment via nameref variable: > > > > declare -a arr=() > > f

Re: Some kind of file descriptor overflow

2014-06-13 Thread Pierre Gaston
On Fri, Jun 13, 2014 at 9:56 PM, Jorge Sivil wrote: > Yes, sorry. The minimum reproduceable code is: > > #!/bin/bash > function something() { > while true > do > while read VAR > do > dummyvar="a" > done < <(find "/run/shm/debora" -type f | sort) > sleep 3 > done > } >

Re: Arithmetic + array allows for code injection

2014-06-02 Thread Pierre Gaston
On Mon, Jun 2, 2014 at 4:44 PM, Chet Ramey wrote: > On 6/2/14, 8:21 AM, Greg Wooledge wrote: > > On Fri, May 30, 2014 at 09:28:13PM -0500, Dan Douglas wrote: > >> The problem is most people don't realize how "variables" are evaluated. > >> Any time the shell needs to reference a variable, it take

Re: Arithmetic + array allows for code injection

2014-05-30 Thread Pierre Gaston
On Fri, May 30, 2014 at 9:08 PM, Greg Wooledge wrote: > On Fri, May 30, 2014 at 08:57:42PM +0300, Pierre Gaston wrote: > > It doesn't seem right for code looking as innocent as $((a[$i])) or > > $((a["$i"])) to allow running arbitrary commands for some value of

Arithmetic + array allows for code injection

2014-05-30 Thread Pierre Gaston
It doesn't seem right for code looking as innocent as $((a[$i])) or $((a["$i"])) to allow running arbitrary commands for some value of i, that are no even that clever: $ i='$( echo >&2 an arbitrary command )';: $((a["$i"])) an arbitrary command $ i='"$( echo >&2 an arbitrary command)"';: $((a[$i

Re: Bind builtin does not run readline commands

2014-05-27 Thread Pierre Gaston
On Tue, May 27, 2014 at 8:19 AM, wrote: > Configuration Information [Automatically generated, do not change]: > Machine: x86_64 > OS: linux-gnu > Compiler: x86_64-pc-linux-gnu-gcc > Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' > -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-

Re: winch trap delayed until keypress

2014-05-22 Thread Pierre Gaston
On Thu, May 22, 2014 at 4:02 PM, Linda Walsh wrote: > > > Pierre Gaston wrote: > >> >> As I understand it, this is now broken in 4.3?: >> >> # display new size of terminal when resized >> function showsize () {\ >> loca

Re: winch trap delayed until keypress

2014-05-22 Thread Pierre Gaston
On Thu, May 22, 2014 at 8:16 AM, Linda Walsh wrote: > > > Chet Ramey wrote: > >> On 5/20/14, 8:28 AM, Egmont Koblinger wrote: >> >>> Hi, >>> >>> Execute this in an interactive bash and then resize the window: >>> trap 'stty size' winch >>> >>> In bash-4.2, the trap was executed immediately upon r

couple of bugs

2014-04-29 Thread Pierre Gaston
A couple of 4.3 bugs have surfaced on IRC, I'm not sure they are reported here, so just in case here they are 1) bash gets stuck shopt -s extglob echo !(*/) # never returns, cannot be interrupted 2) $0 is not always expanded: echo "without \$1 ${@:0:1}";set -- one;echo "with \$1 ${@:0:1}" witho

Re: Command name dequote does not work

2014-04-15 Thread Pierre Gaston
On Tue, Apr 15, 2014 at 10:32 AM, wrote: > Configuration Information [Automatically generated, do not change]: > Machine: x86_64 > OS: linux-gnu > Compiler: gcc > Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' > -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' > -DC

Re: jobs -p falsely reports the last background pid

2014-04-09 Thread Pierre Gaston
On Wed, Apr 9, 2014 at 3:28 PM, Greg Wooledge wrote: > On Wed, Apr 09, 2014 at 02:16:22PM +0200, Håkon Bugge wrote: > > That is not the issue. Try it out. > > Very well. I can confirm that this script does not terminate on HP-UX > 10.20 under bash 4.3.8: > > #!/bin/bash > set -m > for x in 1 2 3

Re: jobs -p falsely reports the last background pid

2014-04-09 Thread Pierre Gaston
On Wed, Apr 9, 2014 at 3:16 PM, Håkon Bugge wrote: > > On 9. apr. 2014, at 14.04, Greg Wooledge wrote: > > > On Wed, Apr 09, 2014 at 12:43:40PM +0200, Håkon Bugge wrote: > >> This script never terminates: > >> -- > >> #!/bin/bash > >> > >> for P in

Re: /dev/fd/62: No such file or directory

2014-04-05 Thread Pierre Gaston
mp;& return 0 >>> >>> --- the $1 doesn't need quotes in [[]] and '*' won't expand or >>> am missing something? Thanks for the tip Pierre, I often >>> don't see forests because of all the trees... >>> >> >> Th

Re: /dev/fd/62: No such file or directory

2014-04-01 Thread Pierre Gaston
On Wed, Apr 2, 2014 at 6:04 AM, Linda Walsh wrote: > > > Greg Wooledge wrote: > >> On Fri, Mar 28, 2014 at 06:14:27PM -0700, Linda Walsh wrote: >> >>> Does read varname <<<$(...) use process substitution? >>> >> >> I wouldn't dare write it like that, because who knows how the parser >> will treat

Re: easier construction of arrays

2014-03-27 Thread Pierre Gaston
On Thu, Mar 27, 2014 at 5:53 PM, Mike Frysinger wrote: > On Thu 27 Mar 2014 08:01:45 Greg Wooledge wrote: > > files=() > > while IFS= read -r -d '' file; do > > files+=("$file") > > done < <(find . -iname '*.mp3' ! -iname '*abba*' -print0) > > i've seen this construct duplicated so many times :

Re: Special built-ins not persisting assignments

2014-03-24 Thread Pierre Gaston
On Tue, Mar 25, 2014 at 2:39 AM, Pollock, Wayne wrote: > $ echo $BASH_VERSION > 4.2.45(1)-release > > $ unset foo > > $ foo=bar : > > $ echo $foo > > > $ > > === > > According to POSIX/SUS issue 7, assignments for special builtins > should persist. So the output should be ``bar''. >

Re: Top does not handle more than 100 cores

2014-03-24 Thread Pierre Gaston
On Mon, Mar 24, 2014 at 12:08 PM, Alexandre De Champeaux wrote: > Configuration Information [Automatically generated, do not change]: > Machine: x86_64 > OS: linux-gnu > Compiler: gcc > Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' > -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_

Re: Please accept M-p as well as C-p

2014-02-13 Thread Pierre Gaston
On Thu, Feb 13, 2014 at 1:35 PM, Ed Avis wrote: > Bash accepts the Emacs keybinding C-p to go back in the history, and C-n > to go forward. > But most of the time in Emacs (when using its minibuffer) the keys you use > are Meta-p > and Meta-n, or on a modern PC keyboard Alt-p and Alt-n. > > Curre

Re: Segmentation fault when -x is added and variable contains nulls

2014-02-06 Thread Pierre Gaston
On Thu, Feb 6, 2014 at 4:07 PM, Pierre Gaston wrote: > > > > On Thu, Feb 6, 2014 at 3:38 PM, Chet Ramey wrote: > >> On 2/5/14 10:51 PM, Dan Jacobson wrote: >> > # su - nobody >> > No directory, logging in with HOME=/ >> > $ cat /tmp/r >> >

Re: Segmentation fault when -x is added and variable contains nulls

2014-02-06 Thread Pierre Gaston
On Thu, Feb 6, 2014 at 3:38 PM, Chet Ramey wrote: > On 2/5/14 10:51 PM, Dan Jacobson wrote: > > # su - nobody > > No directory, logging in with HOME=/ > > $ cat /tmp/r > > LC_CTYPE=zh_TW.UTF-8 N=$(echo 統一|iconv -t big5 -f utf-8) sh -xc ': $N' > > $ sh /tmp/r > > /tmp/r: line 1: 4551 Segmentation

  1   2   3   4   >