You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[bug] (( )) arithmetic error diagnostic ignores the command's own 2>&1 redirection #1127
[bug] (( )) arithmetic error diagnostic ignores the command's own 2>&1 redirection
a=1x;((a+=1))2>&1;echo"a=$a rc=$?"# GNU bash 5.3.20: stdout contains the diagnostic '((: 1x: value too great for base ...' followed by 'a=1x rc=1'; stderr is empty# rubash / niu: stdout is only 'a=1x rc=1'; the diagnostic leaks to the shell's stderr instead
Expected (GNU bash 5.3.20): the diagnostic honours the 2>&1 attached to the (( )) command and lands on stdout.
Actual (rubash): the diagnostic is written to the shell's outer stderr, ignoring the redirection.
Wrappers that capture a command's combined output (out=$(cmd 2>&1), log redirection) lose arithmetic diagnostics entirely.
Env: rubash master 493ebb2 / niubash 1.4.4 (niu, master 953f513, embeds rubash 493ebb2), Linux x86_64, GNU bash 5.3.20 x86_64-pc-linux-gnu as oracle. Also reproduces in niu (same engine).
Activity
caomengxuan666 commentedon Oct 23, 2026
FIXED-BY-#1181 — verified on master (263ce53f). Commit c2d1784.
a=1x; ((a+=1)) 2>&1; echo "a=$a rc=$?"→ diagnostic lands on stdout followed bya=1x rc=1, identical to GNU 5.3.20.fix(executor): consume the arithmetic fatal flag at the triggering co…