bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

error parsing file glob when importing function from environment


From: adyer
Subject: error parsing file glob when importing function from environment
Date: Thu, 26 Feb 2015 12:37:16 -0700

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-redhat-linux-gnu' 
-DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib  -D_GNU_SOURCE -DRECYCLES_PIDS 
-DDEFAULT_PATH_VALUE='/usr/local/bin:/usr/bin'  -O2 -g -pipe -Wall 
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong 
--param=ssp-buffer-size=4 -grecord-gcc-switches  -m64 -mtune=generic
uname output: Linux grendel.tu.aonix.com 3.14.17-200.rt9.1.fc20.ccrma.x86_64+rt 
#1 SMP PREEMPT RT Sat Aug 23 13:07:55 PDT 2014 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-redhat-linux-gnu

Bash Version: 4.2
Patch Level: 47
Release Status: release

Description:
        A bash function containing the syntax "files=( !(PAT) )" fails to parse
  in a sub-shell when imported from the environment (to which it was exported
  by the parent shell).

Repeat-By:
  The bash completions for cvs (/usr/share/bash-completions/cvs in my 
environment)
  contain similar syntax ( "files=( !(CVS) )" ), and the error will occur if you
  set the -a option, then attempt file completion for a cvs command, and later 
start
  an inferior shell.

  But a simpler reproducer is:

    > listAllButX() { f=( !(X) ); ls -d ${f[@]}; }
    > export -f listAllButX
    > bash
    bash: listAllButX: line 0: syntax error near unexpected token `('
    bash: listAllButX: line 0: `listAllButX () {  f=(!(X));'
    .
    bash: listAllButX: line 2: syntax error near unexpected token `}'
    bash: listAllButX: line 2: `}'
    bash: error importing function definition for `listAllButX'

  Experiment indicates that the '(' it complains about is the one immediately 
after
  the '!'; the error goes away if the '!' is removed (though of course, that 
changes
  the behavior of the function as well).




reply via email to

[Prev in Thread] Current Thread [Next in Thread]