"echo: write error: Broken pipe" even when DONT_REPORT_SIGPIPE set
Comparing bash-3.0 (with config-top.h modified so that DONT_REPORT_SIGPIPE is defined) with bash-3.1 (where this is the default anyway) shows up a change in behaviour. bash-3.0: $ bash -c 'trap exit SIGPIPE; echo foo' | : $ bash-3.1: $ bash -c 'trap exit SIGPIPE; echo foo' | : bash: line 0: echo: write error: Broken pipe $ Is this change in behaviour intentional, or a regression? Original bug report: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=177242 Thanks, Tim. */ pgprpHnWZKsa0.pgp Description: PGP signature ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
Re: "echo: write error: Broken pipe" even when DONT_REPORT_SIGPIPE set
Tim Waugh wrote: > Comparing bash-3.0 (with config-top.h modified so that > DONT_REPORT_SIGPIPE is defined) with bash-3.1 (where this is the > default anyway) shows up a change in behaviour. > > bash-3.0: > > $ bash -c 'trap exit SIGPIPE; echo foo' | : > $ > > bash-3.1: > > $ bash -c 'trap exit SIGPIPE; echo foo' | : > bash: line 0: echo: write error: Broken pipe > $ > > Is this change in behaviour intentional, or a regression? It's intentional, and doesn't have anything to do with job control or processes dying from SIGPIPE in general. There were several bug reports filed against bash-3.0 complaining that the only way to check whether or not echo failed to write requested data was to use the exit status. (Mostly in connection with redirected output on a full or unavailable file system.) `echo' now displays an error message on write errors. `printf' does the same thing. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ( ``Discere est Dolere'' -- chet ) Live Strong. Chet Ramey, ITS, CWRU[EMAIL PROTECTED]http://tiswww.tis.case.edu/~chet/ ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
yank-last-arg after a #
I do $ # x y z $ zzz the ESC. doesn't get the last argument these days if there was a #. I get a bell. OK, I'll use ":" then I suppose now. Wait, $ xx yy zz # qq ESC. still gets the qq. And ^P still recalls lines, no matter where the # is. bash3.1.0(1). ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
Bash-3.1 patch 3
BASH PATCH REPORT = Bash-Release: 3.1 Patch-ID: bash31-003 Bug-Reported-by: Adam Buraczewski <[EMAIL PROTECTED]> Bug-Reference-ID: <[EMAIL PROTECTED]> Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2005-12/msg00055.html Bug-Description: A missing #define guard causes bash to not compile when readline is not configured in, either as the result of explicit disabling or when the `--enable-minimal-config' option is given to configure. Patch: *** ../bash-3.1/variables.c Sat Nov 12 21:22:37 2005 --- variables.c Mon Dec 26 13:34:03 2005 *** *** 861,867 --- 863,871 char val[INT_STRLEN_BOUND(int) + 1], *v; + #if defined (READLINE) /* If we are currently assigning to LINES or COLUMNS, don't do anything. */ if (winsize_assignment) return; + #endif v = inttostr (lines, val, sizeof (val)); *** ../bash-3.1/patchlevel.hWed Jul 20 13:58:20 2005 --- patchlevel.hWed Dec 7 13:48:42 2005 *** *** 26,30 looks for to find the patch level (for the sccs version string). */ ! #define PATCHLEVEL 2 #endif /* _PATCHLEVEL_H_ */ --- 26,30 looks for to find the patch level (for the sccs version string). */ ! #define PATCHLEVEL 3 #endif /* _PATCHLEVEL_H_ */ -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ( ``Discere est Dolere'' -- chet ) Live Strong. Chet Ramey, ITS, CWRU[EMAIL PROTECTED]http://tiswww.tis.case.edu/~chet/ ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
Bash-3.1 patch 4
BASH PATCH REPORT = Bash-Release: 3.1 Patch-ID: bash31-004 Bug-Reported-by: Mike Frysinger <[EMAIL PROTECTED]> Bug-Reference-ID: <[EMAIL PROTECTED]> Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2005-12/msg00062.html Bug-Description: A local array variable declared at function scope that shadows a variable of the same name declared in a previous scope did not create a separate variable instance, but used the previous one. Patch: *** ../bash-3.1/subst.c Mon Oct 24 09:51:13 2005 --- subst.c Fri Dec 30 12:11:53 2005 *** *** 2188,2192 { v = find_variable (name); ! if (v == 0 || array_p (v) == 0) v = make_local_array_variable (name); v = assign_array_var_from_string (v, value, flags); --- 2188,2192 { v = find_variable (name); ! if (v == 0 || array_p (v) == 0 || v->context != variable_context) v = make_local_array_variable (name); v = assign_array_var_from_string (v, value, flags); *** ../bash-3.1/patchlevel.hWed Jul 20 13:58:20 2005 --- patchlevel.hWed Dec 7 13:48:42 2005 *** *** 26,30 looks for to find the patch level (for the sccs version string). */ ! #define PATCHLEVEL 3 #endif /* _PATCHLEVEL_H_ */ --- 26,30 looks for to find the patch level (for the sccs version string). */ ! #define PATCHLEVEL 4 #endif /* _PATCHLEVEL_H_ */ -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ( ``Discere est Dolere'' -- chet ) Live Strong. Chet Ramey, ITS, CWRU[EMAIL PROTECTED]http://tiswww.tis.case.edu/~chet/ ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
Bash-3.1 patch 5
BASH PATCH REPORT = Bash-Release: 3.1 Patch-ID: bash31-005 Bug-Reported-by: Bug-Reference-ID: Bug-Reference-URL: Bug-Description: When tilde expansion fails, POSIX leaves it unspecified whether or not the word undergoes the additional word expansions. Bash-3.1 as distributed skipped the rest of the expansions; this patch restores the bash-3.0 behavior. This means that something like USER=ratbert echo ~$USER will echo `~ratbert' rather than `~$USER'. Patch: *** ../bash-3.1/subst.c Mon Oct 24 09:51:13 2005 --- subst.c Fri Dec 30 12:11:53 2005 *** *** 6796,6799 --- 6823,6832 { temp1 = bash_tilde_expand (temp, tflag); + if (temp1 && *temp1 == '~' && STREQ (temp, temp1)) + { + FREE (temp); + FREE (temp1); + goto add_character; /* tilde expansion failed */ + } free (temp); temp = temp1; *** ../bash-3.1/patchlevel.hWed Jul 20 13:58:20 2005 --- patchlevel.hWed Dec 7 13:48:42 2005 *** *** 26,30 looks for to find the patch level (for the sccs version string). */ ! #define PATCHLEVEL 4 #endif /* _PATCHLEVEL_H_ */ --- 26,30 looks for to find the patch level (for the sccs version string). */ ! #define PATCHLEVEL 5 #endif /* _PATCHLEVEL_H_ */ -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ( ``Discere est Dolere'' -- chet ) Live Strong. Chet Ramey, ITS, CWRU[EMAIL PROTECTED]http://tiswww.tis.case.edu/~chet/ ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
man page doesn't say typeset obsolete
But the man page doesn't say obsolete: $ help typeset typeset: typeset [-afFirtx] [-p] name[=value] ... Obsolete. See `declare'. ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
Bash-3.1 patch 2
BASH PATCH REPORT = Bash-Release: 3.1 Patch-ID: bash31-002 Bug-Reported-by: [EMAIL PROTECTED] Bug-Reference-ID: <[EMAIL PROTECTED]> Bug-Reference-URL:http://lists.gnu.org/archive/html/bug-bash/2005-12/msg00021.html Bug-Description: This corrects several omissions in the bash documentation: It adds the new options to `ulimit', the exact expansions for `case' patterns, clarification of the language concerning the return value of `[[', and updated version information. Patch: *** ../bash-3.1/doc/bash.1 Wed Oct 12 11:40:52 2005 --- doc/bash.1 Wed Dec 28 19:58:54 2005 *** *** 7,16 .\" [EMAIL PROTECTED] .\" ! .\" Last Change: Sat Aug 27 13:28:44 EDT 2005 .\" .\" bash_builtins, strip all but Built-Ins section .if \n(zZ=1 .ig zZ .if \n(zY=1 .ig zY ! .TH BASH 1 "2005 Aug 27" "GNU Bash-3.1-beta1" .\" .\" There's some problem with having a `@' --- 7,16 .\" [EMAIL PROTECTED] .\" ! .\" Last Change: Wed Dec 28 19:58:45 EST 2005 .\" .\" bash_builtins, strip all but Built-Ins section .if \n(zZ=1 .ig zZ .if \n(zY=1 .ig zY ! .TH BASH 1 "2005 Dec 28" "GNU Bash-3.1" .\" .\" There's some problem with having a `@' *** *** 678,683 is enabled, the match is performed without regard to the case of alphabetic characters. ! The return value is 0 if the string matches or does not match ! the pattern, respectively, and 1 otherwise. Any part of the pattern may be quoted to force it to be matched as a string. --- 678,683 is enabled, the match is performed without regard to the case of alphabetic characters. ! The return value is 0 if the string matches (\fB==\fP) or does not match ! (\fB!=\fP) the pattern, and 1 otherwise. Any part of the pattern may be quoted to force it to be matched as a string. *** *** 808,811 --- 808,817 .B Pathname Expansion below). + The \fIword\fP is expanded using tilde + expansion, parameter and variable expansion, arithmetic substituion, + command substitution, process substitution and quote removal. + Each \fIpattern\fP examined is expanded using tilde + expansion, parameter and variable expansion, arithmetic substituion, + command substitution, and process substitution. If the shell option .B nocasematch *** *** 8485,8489 none are found. .TP ! \fBulimit\fP [\fB\-SHacdflmnpstuv\fP [\fIlimit\fP]] Provides control over the resources available to the shell and to processes started by it, on systems that allow such control. --- 8485,8489 none are found. .TP ! \fBulimit\fP [\fB\-SHacdfilmnpqstuvx\fP [\fIlimit\fP]] Provides control over the resources available to the shell and to processes started by it, on systems that allow such control. *** *** 8524,8527 --- 8524,8530 The maximum size of files created by the shell .TP + .B \-i + The maximum number of pending signals + .TP .B \-l The maximum size that may be locked into memory *** *** 8537,8540 --- 8540,8546 The pipe size in 512-byte blocks (this may not be set) .TP + .B \-q + The maximum number of bytes in POSIX message queues + .TP .B \-s The maximum stack size *** *** 8548,8551 --- 8554,8560 .B \-v The maximum amount of virtual memory available to the shell + .TP + .B \-x + The maximum number of file locks .PD .PP *** ../bash-3.1/doc/bashref.texiMon Oct 3 15:07:21 2005 --- doc/bashref.texiFri Dec 30 10:50:39 2005 *** *** 962,967 is enabled, the match is performed without regard to the case of alphabetic characters. ! The return value is 0 if the string matches or does not match ! the pattern, respectively, and 1 otherwise. Any part of the pattern may be quoted to force it to be matched as a string. --- 962,967 is enabled, the match is performed without regard to the case of alphabetic characters. ! The return value is 0 if the string matches (@samp{==}) or does not ! match (@samp{!=})the pattern, and 1 otherwise. Any part of the pattern may be quoted to force it to be matched as a string. *** *** 2599,2603 or inconvenient to obtain with separate utilities. ! This section briefly the builtins which Bash inherits from the Bourne Shell, as well as the builtin commands which are unique to or have been extended in Bash. --- 2597,2601 or inconvenient to obtain with separate utilities. ! This section briefly describes the builtins which Bash inherits from the Bourne Shell, as well as the builtin commands which are unique to or have been extended in Bash. *** *** 3834,3838 @btindex ulimit @example ! ulimit [-acdflmnpstuvSH] [EMAIL PROTECTED] @end example @code{ulimit} provides control over the resources available to processes --- 3834,3838 @btindex ulimit @example ! ulimit [-acdfilmnpqstuvxSH] [EMAIL PROTECT
Re: yank-last-arg after a #
> $ xx yy zz # qq > ESC. still gets the qq. I get `zz'. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ( ``Discere est Dolere'' -- chet ) Live Strong. Chet Ramey, ITS, CWRU[EMAIL PROTECTED]http://tiswww.tis.case.edu/~chet/ ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
Passing command line to scripts and programs
Item: No environment variable or other easy means is currently available to pass the complete command line to daughter scripts and programs. Maybe this is a feature request rather than a bug per se, but I'd appreciate those who know better than me bearing with me (I'm happy to hear suggestions where else I might send this). I am trying (badly!) to find a means that any program or script can obtain the command line that invoked it as a string. I want to avoid hacks that rely on the user remembering anything like pre-pending the command line by setting an environment variable (ugly, untrustworthy). This is *not* the program/script name and its arguments, but the complete command line, including any pipes, redirects, etc. For example, I want do_stuff to be able to get the complete command line that evoked it: echo -n "Saving.." ; more some_stuff | \ do_stuff -D first_*.lst second_*.lst > save_here & and through this record that the output went to "save_here" and that the original input of save_here was first_*.lst and second_*.lst, for example. It seems to me that a lack of an easy way of doing this leaves something rather useful missing. (That, or I'm badly missing something! -- in which case if anyone can suggest an existing way of doing this, I'd be most grateful. If you can reply directly that'd be a help as I've yet to locate the mailing list reigstration instructions, etc.!). A couple of environment variables holding the current unprocessed and shell-processed command lines that are set by the shell for each new command line before its evoked would be ideal and surely not especially hard to implement (?). Another generic solution might be an equivalent to PROMPT_COMMAND that is evoked before each line, i.e. NEWLINE_COMMAND, although this raises a few questions. The user could then place something like: NEWLINE_COMMAND="THISCMD=`history 1`" export THISCMD into their .bash_profile to have THISCMD set up before each line is executed. This could be extended to cover a variety of signal events within the bash shell. Grant [gjacobs:gjacobs] bash --version GNU bash, version 2.05b.0(1)-release (powerpc-apple-darwin7.0) Copyright (C) 2002 Free Software Foundation, Inc. (No bugbash on OSX bash, at least by default; same version of bash on darwin8.0, too.) -- --- Grant Jacobs Ph.D. BioinfoTools ph. +64 3 478 0095 (office, after 10am) PO Box 6129, or +64 27 601 5917 (mobile) Dunedin, [EMAIL PROTECTED] NEW ZEALAND. Bioinformatics tools: deriving knowledge from biological data Bioinformatics tools - software development - consulting - training 15 years experience in bioinformatics ready to solve your problem Check out the website for more details: http://www.bioinfotools.com The information contained in this mail message is confidential and may be legally privileged. Readers of this message who are not the intended recipient are hereby notified that any use, dissemination, distribution or reproduction of this message is prohibited. If you have received this message in error please notify the sender immed- iately and destroy the original message. This applies also to any attached documents. ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
bash -c error
Configuration Information [Automatically generated, do not change]: Machine: i686 OS: cygwin Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash.exe' -DCONF_HOSTTYPE='i686' -DCONF_OSTYPE='cygwin' -DCONF_MACHTYPE='i686-pc-cygwin' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -DRECYCLES_PIDS -I. -I/tmp/bash-3.0 -I/tmp/bash-3.0/include -I/tmp/bash-3.0/lib -O2 uname output: CYGWIN_NT-5.1 DULI2 1.5.19s(0.141/4/2) 20051020 10:37:08 i686 unknown unknown Cygwin Machine Type: i686-pc-cygwin Bash Version: 3.0 Patch Level: 16 Release Status: release Description: bash -c time stackdumps. Not Cygwin specific. Repeat-By: bash -c time ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
tmp file creation in bash provided scripts
I noticed bashbug attempts creating temp file first with mktemp, and then falls back to tempfile, and then to just using its own $TMPDIR/bbug.$$. A malicious user could attempt prepulating bogus files to make it so that mktemp and tempfile fail, and create many symlinks covering your PID range for the $TMPDIR/bbug.$$ to point to your important files. I see bashbug.sh does remove the temp file name is chose and then overwrites it. It has a comment: # this is raceable unless (hopefully) we used mktemp(1) or tempfile(1) Maybe as a third choice use the temp file creation from your configure script as an idea. Use umask 077 and create directory then user can't place symlinks in it. Jeremy C. Reed technical support & remote administration http://www.pugetsoundtechnology.com/ ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
Single quotes are lost from v="$(cmd $'A\tB')"
Configuration Information [Automatically generated, do not change]: Machine: ia64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='ia64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='ia64-unknown-linux-gnu' -DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I../bash -I../bash/include -I../bash/lib -g -O2 uname output: Linux hpstryn3 2.6.12.3 #1 Fri Jul 29 12:58:27 MDT 2005 ia64 GNU/Linux Machine Type: ia64-unknown-linux-gnu Bash Version: 3.1 Patch Level: 0 Release Status: release Description: Single quotes are lost inside of command substitution inside double quotes. The difference in known_hosts() function actually comes from a side effect of an intentional change to bash. A quoting change that first appeared in bash-3.1-beta1 has caused a new problem with quoting. The description for the change was- t. Fixed a bug that caused the expanded value of a $'...' string to be incorrectly re-quoted if it occurred within a double-quoted ${...} parameter expansion. The 'fix' in bash-3.1/bash/parse.y checks for double quoting and suppresses requoting of $'' single quotes. if ((rflags & P_DQUOTE) == 0) { nestret = sh_single_quote (ttrans); free (ttrans); nestlen = strlen (nestret); } else { nestret = ttrans; nestlen = ttranslen; } But that test is fooled when double quoting is used around command substitution. The single quotes are dropped even though the string will be evaluated first by the command substitution inside of the double quotes. That breaks the _known_hosts() function for command completion code in debian's /etc/bash_completion. The loss of quoting breaks up input to sed that was intended to be a single argument. Repeat-By: Here is an example showing first the intended change to ${} and then the unintended change to $(). $ cat quote_bugs function args for a in "$@";do echo "'$a'";done unset mytab echo "${mytab:-$'\t'}" | od -c echo "$( args $'A\tB' )" $ bash_source/bash-3.0/build-bash/bash -v quote_bugs function args for a in "$@";do echo "'$a'";done unset mytab echo "${mytab:-$'\t'}" | od -c 000 ' \t ' \n 004 echo "$( args $'A\tB' )" args 'AB' 'A B' $ bash_source/bash-3.1/build-bash/bash -v quote_bugs function args for a in "$@";do echo "'$a'";done unset mytab echo "${mytab:-$'\t'}" | od -c 000 \t \n 002 echo "$( args $'A\tB' )" args A B 'A' 'B' $ Fix: The problem can be avoided by removing the P_DQUOTE bit from rflags when calling parse_matched_pair for $() expansion. Here is a patch. --- bash/parse.y~ 2006-01-07 16:11:12.0 -0700 +++ bash/parse.y2006-01-07 16:12:40.0 -0700 @@ -2906,8 +2906,8 @@ { if (open == ch) /* undo previous increment */ count--; - if (ch == '(')/* ) */ - nestret = parse_matched_pair (0, '(', ')', &nestlen, rflags); + if (ch == '(')/* ) */ /* disable P_DQUOTE for $() */ + nestret = parse_matched_pair (0, '(', ')', &nestlen, rflags & ~P_DQUOTE); else if (ch == '{') /* } */ nestret = parse_matched_pair (0, '{', '}', &nestlen, P_FIRSTCLOSE|rflags); else if (ch == '[') /* ] */ -- Mike Stroyan, [EMAIL PROTECTED] ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
Still not stable
# uname -rmo 2.4.22-rmap15k i586 GNU/Linux # bash --version GNU bash, version 3.1.5(1)-release (i586-pc-linux-gnu) (configured with --without-bash-malloc) There are still very many errors reported by the test suite, including three segmentation faults and several instances of not locating test commands (attached). I've also just observed bash allocate about 60M of memory and take a few minutes trying to delete a single quote; when it was done, it had managed to transform "'echo" into "'echo[echo", but not delete the quote. Also, very mysteriously, I find the following errors when starting bash: bash: sed: No such file or directory bash: [: `)' expected, found -h bash: sed: No such file or directory bash: [: `)' expected, found -h bash: sed: No such file or directory bash: [: `)' expected, found -h bash: sed: No such file or directory bash: [: `)' expected, found -h I suspect these are somewhere in the bash_completion initialization script, but there's just no way to tell what's wrong from this output, and --verbose is no help either. bash_completion works fine with 2.05b. bash-check.log Description: Binary data ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash