Re: $"text" TEXTDOMAIN{,DIR} ordering relevance
On 11/4/13 3:15 PM, Michael Arlt wrote: > Bash Version: 4.2 > Patch Level: 25 > Release Status: release > Description: > TEXTDOMAIN must be defined before TEXTDOMAINDIR - otherwise it does not > work. > Use of $"text" in functions does not work if TEXTDOMAIN{,DIR} is defined > below the defined function - regardless of application flow. Thanks for the report. This will be fixed for the next release of bash. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/
Re: declare -g var should return a nonzero return code when it fails
On 11/4/13 4:24 AM, Peggy Russell wrote: >>> "declare -g var" should return a nonzero return code when it fails. > >> There is a problem here, and the problem that causes the spurious error >> message from test_error has been fixed in bash-4.3. However, I don't think >> you completely understand what bash scoping is, or what makes a variable >> set or unset. > > Is the problem that is fixed in 4.3, that "declare -p" returns "bash: > declare: var: not found" for variables that are unset? No. The problem is that there is a bug in the declare -g code that makes subsequent lookups report a variable not found error instead of finding the local instance of `var' with value `data2'. I didn't look too far to see exactly what it was, since it's fixed in bash-4.3. >> First, using declare without assigning a value creates a variable >> "placeholder". The variable exists as more-or-less invisible, but is not >> considered set until it is assigned a value. Therefore, declare -g var >> just creates a placeholder at the global scope if there is no existing >> global variable with that name. If there is such a variable, it's a >> no-op. The `redeclare local variable as global' comment is just > incorrect. > > Poor choice of words. Just experimenting here to understand the bounds. A > local variable is "unset", and a new globally scoped variable with the same > name is created. But a globally scoped variable is not created... Sort of. A local variable is created and given a value (`data2'). That changes its state to set. It's true that a `placeholder' global variable is created when you run `declare -g var', but since it has not been given a value it is unset. The easiest thing to remember is that a variable is not set until it's been given a value, even if it has been given attributes using `declare'. > The "placeholder" is still there for the locally scoped variable, isn't it, > and this goes back to the beginning of this thread and the fix for 4.3... > "declare -p" gives the impression that bash knows nothing about the locally > scoped variable. Correct, that's the bug. The local variable still exists and is set, and bash should find it when you run `declare -p'. > This makes a lot more sense. As far as return codes go it is 0 because it > isn't failing at all. Declaring a global variable that already exists as a > globally scoped variable is a no-op, and in a function declaring a global > variable that already exists as a locally scoped variable, bash uses the > locally scoped variable. Yes. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/
Re: Bash-4.3-beta2 available for FTP
> > I'm interested in the patch if cd -@ file works like in ksh. Or > > whatever, just send the patch that I can test it. > > > > Thank you. > > Again. Any patch or git pull tarball which we could try? The cd -@ option is available in the `devel' branch of the git tree on savannah: http://git.savannah.gnu.org/cgit/bash.git/?h=devel It first appears in the bash-20131025 snapshot. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/
Build failure with cd -@ / O_XATTR
On systems with O_XATTR the bash git devel branch fails due a misnamed buffer used for cd -@ support: gcc -c -DHAVE_CONFIG_H -DSHELL -I. -I.. -I.. -I../include -I../lib -I. -DSOLARIS -DDEBUG -g -O2 cd.c || ( rm -f cd.c ; exit 1 ) ./cd.def: In function `cdxattr': ./cd.def:219: error: `buff' undeclared (first use in this function) ./cd.def:219: error: (Each undeclared identifier is reported only once ./cd.def:219: error: for each function it appears in.) gmake[1]: *** [cd.o] Error 1 The fix is straightforward: diff --git a/builtins/cd.def b/builtins/cd.def index 498cf88..c448c5a 100644 --- a/builtins/cd.def +++ b/builtins/cd.def @@ -194,7 +194,7 @@ cdxattr (dir, ndirp) { #if defined (O_XATTR) int apfd, fd, r, e; - char buf[11+40+40]; /* construct new `fake' path for pwd */ + char buff[11+40+40]; /* construct new `fake' path for pwd */ apfd = openat (AT_FDCWD, dir, O_RDONLY|O_NONBLOCK); if (apfd < 0) And thanks for cd -@ - keep up the good work :) Lionel
Re: Bash-4.3-beta2 available for FTP
On 5 November 2013 22:56, Chet Ramey wrote: >> > I'm interested in the patch if cd -@ file works like in ksh. Or >> > whatever, just send the patch that I can test it. >> > >> > Thank you. >> >> Again. Any patch or git pull tarball which we could try? > > The cd -@ option is available in the `devel' branch of the git tree on > savannah: > > http://git.savannah.gnu.org/cgit/bash.git/?h=devel > > It first appears in the bash-20131025 snapshot. Chet, thank you Build instructions: git clone --branch devel git://git.savannah.gnu.org/bash.git Apply this patch and then build as usual: diff --git a/builtins/cd.def b/builtins/cd.def index 498cf88..c448c5a 100644 --- a/builtins/cd.def +++ b/builtins/cd.def @@ -194,7 +194,7 @@ cdxattr (dir, ndirp) { #if defined (O_XATTR) int apfd, fd, r, e; - char buf[11+40+40]; /* construct new `fake' path for pwd */ + char buff[11+40+40]; /* construct new `fake' path for pwd */ apfd = openat (AT_FDCWD, dir, O_RDONLY|O_NONBLOCK); if (apfd < 0) Lionel
Testcase for cd -@ / O_XATTR
Chet, below is a simple testcase for cd -@ / O_XATTR support: ./bash -c 'set -o errexit ; touch foo ; runat foo "echo hello1 >myxattr" ; cd -@ foo ; exec {n}<>myxattr ; cd -P .. ; cat <&$n ; true' This should print 'hello1'. Any suggestion where this test can be placed? Lionel
Re: Bash-4.3-beta2 available for FTP
On 2013-11-05 23:12:00 +0100, Lionel Cons wrote: > Build instructions: > git clone --branch devel git://git.savannah.gnu.org/bash.git If you're only planning on sending in e-mail patches, then you might as well use --depth 1. pgpCGcGWdbeAL.pgp Description: PGP signature