builtin exit status on write failure

2007-04-29 Thread Eric
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' -

Re: [Patch] .gitignore TAGS and tags

2021-03-15 Thread Eric Blake
rawback of not having these in the repo and not in .gitignore >> is that a 'git status' complains about untracked files. > > OK, this is a good reason. But even if the upstream repo doesn't want to ignore a file in the (checked-in) .gitignore, you can always edit your (local-

zsh style associative array assignment bug

2021-03-27 Thread Eric Cook
Hey, When doing an assignment with an uneven number of elements bash currently silently treat the last element as a key and assigns it an empty string. $ typeset -A ary=(this feature came from zsh); typeset -p ary declare -A ary=([came]="from" [this]="feature" [zsh]="" ) In zsh this is an erro

Re: zsh style associative array assignment bug

2021-03-27 Thread Eric Cook
On 3/28/21 12:25 AM, Oğuz wrote: Why? I think it's better this way. -- Oğuz 1) For consistency sake with the shell the idea was borrowed from mostly. 2) Prior to this extension bash required specifying the key and value for AA assignments, so it seems weird to silently ignore that a value w

Re: zsh style associative array assignment bug

2021-03-28 Thread Eric Cook
On 3/28/21 7:02 AM, Oğuz wrote: As it should be. `[bar]' doesn't qualify as an assignment without an equals sign, the shell thinks you're mixing two forms of associative array assignment there. In the new form, that a key is listed inside a compound assignment alone implies that it was meant

Re: zsh style associative array assignment bug

2021-03-29 Thread Eric Cook
On 3/29/21 5:18 PM, Chet Ramey wrote: If you look at a=( k1 v1 k2 v2 k3 v3) as more or less syntactic sugar for a=( [k1]=v1 [k2]=v2 [k3]=v3 ) it's reasonable that a=( k1 v1 k2 ) is equivalent to a=( [k1]=v1 [k2]= ). And that's what bash does. Its just when populating that array dynamic

Re: zsh style associative array assignment bug

2021-03-30 Thread Eric Cook
On 3/30/21 10:54 AM, Chet Ramey wrote: > On 3/29/21 6:40 PM, Eric Cook wrote: >> Its just when populating that array dynamically with another array >> if that second array didn't contain `v1' hypothetically, the array gets >> shifted to > > OK, how would you

Re: zsh style associative array assignment bug

2021-03-31 Thread Eric Cook
On 3/30/21 3:44 PM, Chet Ramey wrote: Is this a serious piece of code, or just one to demonstrate a programming error? The latter There is only one field, terminated by `|', which becomes one array element. This is where you `lose' the null elements, not when you attempt to copy. Nothing you d

Re: I've found a vulnerability in bash

2021-11-19 Thread Eric Blake
x55d3099d69d0 /* 72 vars */) = 0 /home/eblake [pid 1248831] +++ exited with 0 +++ --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=1248831, si_uid=14986, si_status=0, si_utime=0, si_stime=0} --- +++ exited with 0 +++ According to POSIX, perl should REALLY be passing a "--" argument between "-c" and the scalar string given by the user; see https://www.austingroupbugs.net/view.php?id=1440 -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org

Integer overflow of i in string_extract_verbatim

2023-04-28 Thread Eric Li
From: Eric Li To: bug-bash@gnu.org Subject: Integer overflow of i in string_extract_verbatim Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -g -Og uname output: Linux fedora 6.2.12-200.fc37.x86_64 #1 SMP

RFC: changing printf(1) behavior on %b

2023-08-31 Thread Eric Blake
ynonym for %b is probably going to be easier (less shell escaping needed). Is there any interest in a patch to coreutils or bash that would add such a synonym, to make it easier to leave that functionality in place for POSIX Issue 9 even when %b is repurposed to align with C2x? -- Eric Blake, Pr

Re: bug#65659: RFC: changing printf(1) behavior on %b

2023-08-31 Thread Eric Blake
On Thu, Aug 31, 2023 at 03:10:58PM -0400, Chet Ramey wrote: > On 8/31/23 11:35 AM, Eric Blake wrote: > > In today's Austin Group call, we discussed the fact that printf(1) has > > mandated behavior for %b (escape sequence processing similar to XSI > > echo) that will even

Re: [PATCH] printf: add %#s alias to %b

2023-08-31 Thread Eric Blake
On Thu, Aug 31, 2023 at 04:01:17PM -0500, Rob Landley wrote: > On 8/31/23 13:31, Eric Blake wrote: > > POSIX Issue 8 will be obsoleting %b (escape sequence interpolation) so > > that future Issue 9 can change to having %b (binary literal output) > > that aligns with C2x. >

Re: bug#65659: RFC: changing printf(1) behavior on %b

2023-09-01 Thread Eric Blake
On Fri, Sep 01, 2023 at 08:59:19AM +0100, Stephane Chazelas wrote: > 2023-08-31 15:02:22 -0500, Eric Blake via austin-group-l at The Open Group: > [...] > > The current POSIX says that %b was added so that on a non-XSI > > system, you could do: > > > >

Re: bug#65659: RFC: changing printf(1) behavior on %b

2023-09-01 Thread Eric Blake
g that if implementations are willing to implement it now, it will make Issue 9 easier to reason about. -- Eric Blake, Principal Software Engineer Red Hat, Inc. Virtualization: qemu.org | libguestfs.org

Re: [PATCH] printf: add %#s alias to %b

2023-09-06 Thread Eric Blake
to mean "interpret my format string according to C23 semantics" is also a viable idea, but one not mentioned in the current incantation of the Austin Group bug. But that's why the bug has a 30-day review period, to collect feedback comments on how it can be better worded before Issue 8 is finalized. -- Eric Blake, Principal Software Engineer Red Hat, Inc. Virtualization: qemu.org | libguestfs.org

Re: [PATCH] printf: add %#s alias to %b

2023-09-06 Thread Eric Blake
r than what existing practice has. Coreutils is willing to do it, but I have not actually committed that patch yet, waiting to see how this thread pans out. -- Eric Blake, Principal Software Engineer Red Hat, Inc. Virtualization: qemu.org | libguestfs.org

Re: [PATCH] printf: add %#s alias to %b

2023-09-07 Thread Eric Blake
er (useful) conversion specifier in C. And given that, I prefer naming such an extension option -C or -c (implying C-like), rather than your suggestion of -b (implying binary, but where the implication only benefits %b) as a better option name for such a printf extension option. -- Eric Blake, Principal Software Engineer Red Hat, Inc. Virtualization: qemu.org | libguestfs.org

Re: [PATCH] printf: add %#s alias to %b

2023-09-07 Thread Eric Blake
On Thu, Sep 07, 2023 at 02:42:16PM +0700, Robert Elz wrote: > Date:Wed, 6 Sep 2023 11:32:32 -0500 > From: Eric Blake > Message-ID: > > > | You (anyone reading this, not just kre) are welcome to join tomorrow's > | Austin Group meetin

Re: Idea: jobs(1) -i to print only :%ID:s

2023-11-10 Thread Eric Pruitt
On Fri, Nov 10, 2023 at 01:22:54PM -0500, Greg Wooledge wrote: > It most definitely is *not* everywhere. It's part of GNU coreutils, > and is generally not present on any system that does't use those (BSDs > and commercial Unixes for example). >From _seq(1)_ on FreeBSD: > The seq command first a

Re: Bash Bug - Incorrect Printing of Escaped Characters

2023-12-25 Thread Eric Pruitt
65 MiB/s, done. Resolving deltas: 100% (36225/36225), done. $ cd bash/doc/ doc$ fgrep -r pretty texinfo.tex:% above. But it's pretty close. texinfo.tex: % and a tt hyphen is pretty tiny. @code also disables ?` !`. doc$ Eric

completion very slow with gigantic list

2024-01-10 Thread Eric Wong
Hi, I noticed bash struggles with gigantic completion lists (100k items of ~70 chars each) It's reproducible with both LANG+LC_ALL set to en_US.UTF-8 and C, so it's not just locales slowing things down. This happens on the up-to-date `devel' branch (commit 584a2b4c9e11bd713030916d9d832602891733d7

Re: completion very slow with gigantic list

2024-01-10 Thread Eric Wong
"Dale R. Worley" wrote: > A priori, it isn't surprising. But the question becomes "What > algorithmic improvement to bash would make this work faster?" and then > "Who will write this code?" I'll try to take a look at it in a few months if I run out of things to do and nobody beats me to it. I'

static vs. dynamic scoping

2010-11-09 Thread Eric Blake
es not shadow a declaration of a, so references to $a within f2 refer to the global variable. The local variable a of f1 can only be accessed within f1; the behavior of f2 is the same no matter how it was reached. In dynamic scoping, function f2 looks up its call stack for the closest enclosing sc

Re: bash: Correct usage of F_SETFD

2010-11-22 Thread Eric Blake
current flags and set/clear just >> the FD_CLOEXEC bit ? > > I suppose it would matter if there are systems that have more than one > flag value. In practice, there aren't any such systems; but POSIX warns that current practice is no indicator of future systems, and that read

Re: bash: Correct usage of F_SETFD

2010-11-23 Thread Eric Blake
ly know what the implementation's default bit state is, and blindly setting all other bits to zero is very possibly a bug, and easy enough to avoid by using the full R/M/W. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature

Re: Why `echo -n hello | while read v; do echo $v; done' prints nothing?

2010-12-02 Thread Eric Blake
On 12/02/2010 04:04 AM, Clark J. Wang wrote: > Following command also prints nothing, confused :( > > for ((i = 0; i < 10; ++i)); do echo -n " $i"; done | while read v; do echo > $v; done http://www.faqs.org/faqs/unix-faq/shell/bash/ FAQ E4. -- Eric Blake ebl...@redh

Re: Why `echo -n hello | while read v; do echo $v; done' prints nothing?

2010-12-02 Thread Eric Blake
be a standard-compliant script that relied on such an extension. You're better off supplying the trailing newline, and guaranteeing a compliant usage. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature

Re: argument precedence, output redirection

2010-12-03 Thread Eric Blake
mportant? If yes, what is the idea/concept behind > this behavior? Yes the order is important, and the idea behind the behavior is that left-to-right evaluation order can be easily documented and relied on. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization libr

Re: Consume only up to 8 bit octal input for backslash-escaped chars (echo, printf)

2010-12-07 Thread Eric Blake
report means that we need to tweak the wording of bug 249 (adding $'') to deal with the case of an octal escape where three octal digits do not fit in 8 bits (either by explicitly declaring it unspecified, as is the case with \x escapes; or by requiring implementation-defined behavior, as in C99; or by requiring explicit end-of-escape after two digits, as in Java). -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature

Re: cd with multiple arguments?

2010-12-09 Thread Eric Blake
the extra arguments are silently ignored. I would really love it if bash copied the zsh behavior here: cd a b tries to find a directory matching the extglob a+([$' \t'])b and fails if there are multiple matches or no matches. Certainly less typing than remembering to quote

Re: bash 'let' can give error

2010-12-10 Thread Eric Blake
e as for 'expr' which is standardized by POSIX to have the same behavior. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature

Re: bash 'let' can give error

2010-12-10 Thread Eric Blake
ember, non-zero status is NOT always 'failure'; it is the documentation of each command that will tell you which status values imply failure. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature

Re: Precedence of "C operators" and "bash operators"

2010-12-18 Thread Eric Blake
of ! and ~. > > But in the book "C a reference manual" (Harbison & Steele), the four > operators + - ! ~ have the same precedence. The unary operators + and - have the same precedence as the unary ! and ~; and that level of precedence is higher than that of the binary + and -

Re: exit status question

2010-12-20 Thread Eric Blake
h value 0, and status 2 and above are reserved for errors. This was just brought up on the list earlier this month: http://lists.gnu.org/archive/html/bug-bash/2010-12/msg00087.html and seems to be a recurring question: http://lists.gnu.org/archive/html/bug-bash/2010-07/msg00121.html -- Eric Blak

Re: read builtin does not return success code (0) in spite of it successfully read line

2010-12-27 Thread Eric Blake
ire bash to return failure in this case, but neither does it require bash to return success. You should not rely on the behavior of read when the input does not end in a newline. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org si

Re: read builtin does not return success code (0) in spite of it successfully read line

2010-12-27 Thread Eric Blake
On 12/27/2010 10:59 AM, Stephane CHAZELAS wrote: > 2010-12-27, 09:43(-07), Eric Blake: > [...] >> On 12/26/2010 01:29 PM, Stephane CHAZELAS wrote: >>> Bash behavior is the same as every other shell, is as documented >>> and as specified by POSIX. >> >>

Re: Command substitution (backtick) and tab completion

2010-12-31 Thread Eric Blake
ook in because the left-hand side of a path name is hidden by a command substitution, but I'd rather live with that safety than have arbitrary commands running during completion. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature

Re: read builtin and readonly variables

2011-01-04 Thread Eric Blake
hell exits, the extent of the reaction for getopts and read will probably have to allow both behaviors). -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature

Re: read builtin and readonly variables

2011-01-04 Thread Eric Blake
a non-interactive shell on an assignment error (POSIX XBD 2.8.1 Consequences of Shell Errors). Even worse, neither ksh nor bash exit the shell on 'readonly foo; unset foo; echo $?', so ksh's behavior on 'getopts' seems like a ksh bug. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature

Re: Command substitution (backtick) and tab completion

2011-01-05 Thread Eric Blake
writes a command line with the expansion of $var rather than keeping literal $var in place, then you cannot alter $var in between repetitions of a command - even if completion had to temporarily expand $var in order to form better context about what I was completing after the point that $var appeared in m

Re: read builtin and readonly variables

2011-01-06 Thread Eric Blake
On 01/04/2011 08:05 AM, Eric Blake wrote: > I couldn't find anything either - the POSIX wording for readonly only > mentions assignment and unset as requiring errors. I think that's an > unintentional hole in POSIX, though, so I'm going ahead and submitting a > bug r

Re: for; do; done regression ?

2011-01-07 Thread Eric Blake
esn't help the fact that we have to still use fork() for subshells, but as the bash binary grows larger, posix_spawn() becomes more of a win over fork() by reducing kernel overhead spent in marking a larger memory footprint as copy-on-write, when that work is later discarded by an exec(). -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature

miscompilation at gcc -O2

2011-02-09 Thread Eric Blake
, *error_trap, *return_trap; #if defined (ARRAY_VARS) SHELL_VAR *funcname_v, *nfv, *bash_source_v, *bash_lineno_v; - ARRAY *funcname_a, *bash_source_a, *bash_lineno_a; + ARRAY *funcname_a, *volatile bash_source_a, *volatile bash_lineno_a; #endif FUNCTION_DEF *shell_fn; char *sfile, *t; --

Re: bash 4.2, parameter expansion problem

2011-02-14 Thread Eric Blake
like the / character in > single-quoted strings. Looks like a bug in how bash was modified for trying to obey this new POSIX rule: http://austingroupbugs.net/view.php?id=221 -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature

Re: Do more testing before a release?

2011-02-17 Thread Eric Blake
before the official release. However, I do agree with your sentiment that if the daily repository were more open to the public, that it would allow for a wider set of contributions from other developers. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://l

Re: typeset -r prevents local variable of same name.

2011-02-17 Thread Eric Blake
ations. The Austin Group would favor the ability to create a local read-write variable that shadows a global read-only variable, which would entail a change to this bash behavior. [Which reminds me - I still have the action item to propose wording for getting typeset into the next revision of POSIX] -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature

Re: typeset -r prevents local variable of same name.

2011-02-17 Thread Eric Blake
not a security risk, but overriding dynamically scoped variables is asking for problems. I agree with bash's current implementation restrictions, given its current scoping rules. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature

Re: typeset -r prevents local variable of same name.

2011-02-17 Thread Eric Blake
On 02/17/2011 08:18 PM, Chet Ramey wrote: > On 2/17/11 10:12 PM, Eric Blake wrote: >> On 02/17/2011 07:48 PM, Chet Ramey wrote: >>> Consider a quick, contrived example: an administrator writes a shell >>> package (library, set of functions, whatever) that includes, amon

Re: Strange bug in arithmetic function

2011-02-22 Thread Eric Blake
09, all others are Ok... 08 is an invalid octal number. Try forcing decimal instead: $[$(date --date='this week' +'10#%V')%2] -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature

Re: How to match pattern in bash?

2011-02-22 Thread Eric Blake
-in feature in bash? Or I have to rely on some > external program such as perl to test the pattern matching? case $x in abc*) ... ;; esac -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature

Re: bash tab variable expansion question?

2011-02-24 Thread Eric Blake
ck me in to a single expansion during tab completion.) -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature

Re: [bash-bug] no local bash_history created or written to if existing (~/.bash_history

2011-03-08 Thread Eric Blake
s like SIGHUP cleanup is to have the signal handler record that an exception occurred, then have the main processing loop checking that variable frequently enough to do cleanup in a reasonable time-frame (possibly by using a pipe-to-self if the main loop is waiting on select()), where the main loop t

Re: variable name and its' value are the same characters causes recursion error

2011-03-09 Thread Eric Blake
ts an invalid expression, and should not be confused with $?==1 meaning a valid but false expression. Similarly to expr(1) returning 0 and 1 depending on value for success, and > 1 on failure. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature

Re: Problem with open and rm

2011-03-16 Thread Eric Blake
rm -f /tmp/$$.html Instead of passing Safari the name of a temporary file, why not pass it the name of a temporary pipe? Does this work any better: [ "$DISPLAY" ] && open <(cat /tmp/x.html) at which point there's no temporary file to remove. -- Eric Blake e

Re: Using alias to commands disables its completion

2011-03-24 Thread Eric Blake
as part of starting up bash-completion. The answer you sort of wanted: Yes, it would be nice to patch to bash's completion routines to add an opt-in ability to check for programmed completion associated with whatever the alias expanded to, and use that when there is no completion already asso

Re: eval

2011-05-05 Thread Eric Blake
tml#tag_18_06_02 "The parameter name or symbol can be enclosed in braces, which are optional except for positional parameters with more than one digit or when parameter is followed by a character that could be interpreted as part of the name." And worth documenting as a portability pit

Re: eval

2011-05-05 Thread Eric Blake
he empty string, and in place of a name, we use the single-character symbol 1 instead, such that this MUST be parsed as ${1}0, not as ${10}. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature

Re: Case insensitivity seems to ignore lower bound of interval

2011-05-05 Thread Eric Blake
what behavior. Yes, it would really be nice if all four of bash, gawk, sed, and grep could agree on the same interpretation of non-C range semantics, and implement that regardless of the underlying libc behavior. But what semantics should we settle on? It's an age-old problem, with no nice so

Re: Yet another quoting question

2011-05-06 Thread Eric Blake
%q ' "${a[@]}" aaa '' bbb\ \ ccc > I'd love to see an elegant solution. :-) OK, so printf %q prefers '' and \ over "", but the end result is an unambiguous array listing that can be fed back into shell code. -- Eric Blake ebl...@redhat.com

Re: Bash-4.2 patches 9 and 10

2011-05-13 Thread Eric Blake
.html Along with an accidental announcement for a missing patch 11: http://lists.gnu.org/archive/html/bug-bash/2011-05/msg00028.html -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature

Re: Shell case statements

2011-05-19 Thread Eric Blake
nly 1.1 which means that both the case statement was aborted, and $? was impacted. dash printed: dash: arithmetic expression: expecting primary: "x++" 1.2 so it was like ksh other than choice of error status. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization li

Re: Shell case statements

2011-05-20 Thread Eric Blake
the even simpler: $ bash -c 'readonly x=5; echo $((x=5))'; echo $? bash: x: readonly variable 5 0 $ Other shells abort rather than running echo: $ ksh -c 'readonly x=5; echo $((x=5))'; echo $? ksh: line 1: x: is read only 1 $ zsh -c 'readonly x=5; echo $((x=5))'; echo $

Re: BUG? RFE? printf lacking unicode support in multiple areas

2011-05-20 Thread Eric Blake
t shouldn't really be a problem in practice in converting from one encoding type to another. > That said, it was my impression that a wchar was 16-bits (at least it > is on MS. Is it different under POSIX? POSIX allows 16-bit wchar_t, but if you have a 16-bit wchar_t, you cannot

Re: documentation bug re character range expressions

2011-06-03 Thread Eric Blake
of [[:upper:]], the _only_ portable ways to guarantee that you are getting just that subset are to use the C locale or to spell out the range yourself. In short, ranges are non-portable in all other locales. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library

bug in 'set -n' processing

2011-06-03 Thread Eric Blake
warn about suspicious but usable constructs, at least when --posix is not in effect. $ bash -c 'echo $+' $+ $ bash -cn '$+'; echo $? 0 $ ksh -cn '$+'; echo $? ksh: warning: line 1: $ not preceded by \ 0 -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature

Re: documentation bug re character range expressions

2011-06-03 Thread Eric Blake
ot; > in bracket expressions entirely. Which is effectively what POSIX did by stating that range expressions outside of the C locale have unspecified effects. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature

Re: exit-on-error (set -e) option and command after "if" not found

2011-06-22 Thread Eric Blake
SIX folks can't even seem to get it right; the definition of 'set -e' had to be amended even after POSIX 2008 to match historical practice, which in turn disagreed with bash practice at the time. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature

Re: weird behavior of set -e

2011-06-24 Thread Eric Blake
ould be highly appreciated. set -e seldom does exactly what you want - even the writers of POSIX 2008 got it wrong, and here's how they corrected it: http://austingroupbugs.net/view.php?id=52 and that's what bash 4.1 implemented. -- Eric Blake ebl...@redhat.com+1-801-349-2682

Re: Yet Another test option

2011-07-06 Thread Eric Blake
ings then VER1 < VER2 implies filevercmp (PREFIX VER1 SUFFIX, PREFIX VER2 SUFFIX) < 0. This function is intended to be a replacement for strverscmp. */ However, I don't see any reason to add extensions to coreutils' test unless we have some agreement that we plan to add the sam

Re: Problem with line buffered IO when no tty

2011-07-07 Thread Eric Blake
n relying on the decision of libc on whether stdin defaults to fully-buffered or line-buffered. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature

Re: Built-in printf Sits Awkwardly with UDP.

2011-07-20 Thread Eric Blake
o foo. $ Coreutils' printf shares this misfortune. Sadly, it might even be a bug in the underlying glibc printf(), although I haven't tried to write a test program to check that, yet. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org

Re: How to do? Possible?

2011-07-25 Thread Eric Blake
e semantics. Here, the assignment to foo is a different statement than the expansion of of ${!foo}. And while ${!foo} is a bash extension, it still proves that this is a case where foo was assigned prior to its use. Weird... Not if you think about it properly. -- Eric Blake ebl...@r

Re: Fallback language for internationalized string

2011-07-27 Thread Eric Blake
separated list of locale names. The attentive reader will realize that this is the way we manage to implement one of our additional demands above: we want to be able to specify an ordered list of language. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org

Re: Fallback language for internationalized string

2011-07-27 Thread Eric Blake
fix a simple spelling error for en, then all translation files have to be modified. Yes, but gettext provides tools to make that modification easy. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org

Re: The mailing list software interfered with my content

2011-08-03 Thread Eric Blake
8/msg00012.html has your unfortunate "address@hidden", the same message is easier to understand here: http://thread.gmane.org/gmane.comp.shells.bash.bugs/16780/focus=16890 -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org

Re: bug: return doesn't accept negative numbers

2011-08-05 Thread Eric Blake
return: 1: Illegal number: -- $ dash -c 'f() { return -1; }; f; echo $?' return: 1: Illegal number: -1 $ ksh -c 'f() { return -- -1; }; f; echo $?' 255 $ ksh -c 'f() { return -1; }; f; echo $?' 255 $ -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org

Re: bug: return doesn't accept negative numbers

2011-08-08 Thread Eric Blake
On 08/07/2011 02:35 PM, Linda Walsh wrote: Eric Blake wrote: On 08/05/2011 05:41 PM, Linda Walsh wrote: Seem to fail on any negative number, but 'exit status' is defined as a short int -- not an unsigned value (i.e. -1 would return 255). In bash, 'return -- -1' sets

Re: bug: return doesn't accept negative numbers

2011-08-09 Thread Eric Blake
On 08/08/2011 08:14 PM, Chet Ramey wrote: On 8/8/11 9:42 PM, Mike Frysinger wrote: On Monday, August 08, 2011 21:20:29 Chet Ramey wrote: On 8/8/11 8:53 AM, Eric Blake wrote: However, you are on to something - since bash allows 'exit -1' as an extension, it should similarly allow

Re: Is bash dying or dead (was Re: 4.1 is "$((( ))) an 'official operator, if $(( )) isn't?

2011-08-10 Thread Eric Blake
ripts in an enironment of constant change? By sticking to the common denominator that is known to work. Please people, am I being 'over-reactive'? Or are these valid concerns? At least in my view, you are coming across as over-reactive and ranting, even if that was not your intent. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org

Re: saving bash.....

2011-08-11 Thread Eric Blake
crosoft or any other vendor. If you want to use 'set -e', then you have to deal with arithmetic results of 0 setting $? to 1, whether the arithmetic results come from traditional 'expr' or extension '(())'. That's life with 'set -e'; my advice has al

Re: set -e yet again (Re: saving bash....)

2011-08-12 Thread Eric Blake
f arithmetic expansion. Also POSIX, and slightly shorter than : $((a=0)) -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org

Re: conditional aliases are broken

2011-08-15 Thread Eric Blake
parsed with the pre-command expansion (ie. no alias). Yet another reasons why aliases are mostly replaced by functions. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org

Re: conditional aliases are broken

2011-08-15 Thread Eric Blake
ember that arguments may contain spaces&c) a() { b "$@"; } -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org

Re: conditional aliases are broken

2011-08-18 Thread Eric Blake
, remember the difference between $* and $@ inside "" - the former creates only one word, and only the latter splits the result into the same number of words as were originally arguments to the function. You meant: f(){ for a; do echo "$a"; done; } or f(){ for a in "

Re: conditional aliases are broken

2011-08-18 Thread Eric Blake
On 08/18/2011 08:44 AM, Eric Blake wrote: how do I write a function that would print the same as $ \ls | cat Useless use of cat. This can be done with \ls -1. f(){ for a in "$@"; do echo "$a"; done; } Or skip the loop altogether: f(){ printf %s\\n "%@

Re: Is this a bug in [[ -f ]]?

2011-08-18 Thread Eric Blake
s this a bug? Is there a workaround? Am I doing something wrong? Merely that you were expecting -f to mean 'file and not symlink' rather than what was documented of 'file or symlink to file'. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org

Re: conditional aliases are broken

2011-08-18 Thread Eric Blake
On 08/18/2011 11:38 AM, Stefano Lattarini wrote: Hi Eric. On Thursday 18 August 2011, Eric Blake wrote: On 08/18/2011 08:44 AM, Eric Blake wrote: how do I write a function that would print the same as $ \ls | cat Useless use of cat. This can be done with \ls -1. f(){ for a in "$@

Re: conditional aliases are broken

2011-08-18 Thread Eric Blake
s not treat the \ as an escape but as a literal character, stylistically, I prefer writing "\\n" or '\n' to make it clear that I intended a literal backslash. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org

Re: Is this a bug in [[ -f ]]?

2011-08-19 Thread Eric Blake
. [[ is a bash (and ksh) extension that is part of the shell syntax (similar to how () for subshells is part of the syntax), thus it knows how many words, _pre-expansion_, were present, and the fact that $bla was unquoted is not a problem, [[ -f $bla ]] is a safe way to check if $bla is a file e

Re: variables set on command line

2011-08-24 Thread Eric Blake
rule is counterintuitive, which is why the default bash behavior is opposite the posix behavior). Your question is not cygwin-specific. is this the expected behavior? Yes. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org

Re: variables set on command line

2011-08-24 Thread Eric Blake
On 08/24/2011 10:07 AM, Sam Steingold wrote: * Eric Blake [2011-08-24 09:31:45 -0600]: f(){ echo a=$a b=$b c=$c ; } f a= b= c= a=a b=b f a=a b=b c= f a=a b=b c= Which is indeed correct under the rules for POSIX This sucks big time. Such is life when dealing with shell portability. So

Re: Why bash command "cd //" set path "//" ?

2011-08-26 Thread Eric Blake
sh globally respects // on all platforms even where it is not special. I found this in all version of the bash. Excuse me , if it is not a bug. Not a bug. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org

Re: Bash does not like DOS file format

2011-10-10 Thread Eric Blake
uest that it ignore CR (your explicit request is what allows bash to ignore POSIX). Read the cygwin bash release notes for more details on the measures you can take: http://sourceware.org/ml/cygwin-announce/2011-02/msg00027.html -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org

Re: Error in manual for >&word redirection

2011-10-12 Thread Eric Blake
filename. It's still possible to write to a file named '1': foo >&./1 -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org

Re: New flag option request

2011-10-20 Thread Eric Blake
. "bash -x -W noprofile -W norc" should also work. Bash currently doesn't use getopt_long for option parsing, but rolls its own parser. A patch to make the bash parser support mixed long and short options would also be welcome in my mind. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org

Re: What is the correct way to set up login environment in crontab?

2011-11-09 Thread Eric Blake
is not seen in env in /path/programtorun.sh (called from cron). Right - bash maintains two sets of variables, and only the exported ones are visible to children. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org

Re: Customize the command resolution in bash?

2011-11-11 Thread Eric Blake
is provides a measurable speedup, I don't know. Benchmark it yourself if you are interested in trying it. Meanwhile, per POSIX, bash DOES provide hashing once it learns where an executable lives, so that future invocations can rely on the hash (the hash is invalidated when you assign to $PATH).

Re: invoke tilde expansion on quoted string

2011-11-12 Thread Eric Blake
> replace the ~ with $HOME using parameter expansion. > > cd "${var/#~\//$HOME/}" Except that your proposed parameter expansion only works for plain ~. It doesn't cover more useful tilde expansions, such as ~user/, which does NOT expand to $HOME, but to "user"&

Re: set -e works incorrectly in subshells

2011-11-23 Thread Eric Blake
7;set -e' is almost always the wrong thing in a complex script. -- Eric Blake ebl...@redhat.com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature

  1   2   3   4   5   6   7   >