bash 4.0p17 problem with CTRL+C

2009-05-15 Thread Alan Hourihane
Hi all,

I've just compiled bash 4.0 p17 and noticed that CTRL+C isn't having any
effect until I hit .

bash 3.2 worked perfectly, so I'm a little unsure what's caused this.

Can anyone point me at the code which handles this and I can take a
closer look ?

Thanks,

Alan.





Re: bash 4.0p17 problem with CTRL+C

2009-05-15 Thread Roman Rakus

On 05/15/2009 12:02 PM, Alan Hourihane wrote:

Hi all,

I've just compiled bash 4.0 p17 and noticed that CTRL+C isn't having any
effect until I hit.

bash 3.2 worked perfectly, so I'm a little unsure what's caused this.

Can anyone point me at the code which handles this and I can take a
closer look ?

Thanks,

Alan.



   
Probably in readline. If it occurs on command prompt. If in running 
script it's in bash.

RR




Re: bash 4.0p17 problem with CTRL+C

2009-05-15 Thread Alan Hourihane
On Fri, 2009-05-15 at 13:19 +0200, Roman Rakus wrote:
> On 05/15/2009 12:02 PM, Alan Hourihane wrote:
> > Hi all,
> >
> > I've just compiled bash 4.0 p17 and noticed that CTRL+C isn't having any
> > effect until I hit.
> >
> > bash 3.2 worked perfectly, so I'm a little unsure what's caused this.
> >
> > Can anyone point me at the code which handles this and I can take a
> > closer look ?
> >
> > Thanks,
> >
> > Alan.
> >
> >
> >
> >
> Probably in readline. If it occurs on command prompt. If in running 
> script it's in bash.

It's on the command line. Which function handles that in bash ?

Alan.





Re: --rcfile still opening the SYS_BASHRC

2009-05-15 Thread Chet Ramey
Lluís Batlle wrote:
> Hello,
> 
> I have a problem in bash (3.2 and 4). I have it compiled with
> "-DSYS_BASHRC=/etc/bashrc", and since some time ago I could use "bash
> --rcfile ~/.myrc" to skip the parsing of /etc/bashrc.
> 
> I can't recall what was the compile configuration of that bash where
> this worked. But in the latest bash 3.2 and 4 I've tried (for 4, I
> have all patches published), using "--rcfile" *parses* /etc/bashrc

This is how bash is supposed to behave.  Defining SYS_BASHRC makes bash
source that file just before it sources the bashrc file.

> According to the manual, "--rcfile" should make bash avoid the system bashrc.

I'm not sure which manual you mean.  The bash manual doesn't say anything
about SYS_BASHRC, since it's a feature that's not compiled in by default.

> Moreover, about parameter parsing, in bash versions 3.2 and 4, trying
> to run "bash -i --rcfile xxx" results in bad parameter parsing,
> getting a complain about parameter "--".

The manual does have something to say about that:

Bash  also  interprets  a  number  of  multi-character
options.  These options must appear on the command line
before the single-character options to be recognized.

Chet


-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/




Re: bash 4.0p17 problem with CTRL+C

2009-05-15 Thread Chet Ramey
Alan Hourihane wrote:
> On Fri, 2009-05-15 at 13:19 +0200, Roman Rakus wrote:
>> On 05/15/2009 12:02 PM, Alan Hourihane wrote:
>>> Hi all,
>>>
>>> I've just compiled bash 4.0 p17 and noticed that CTRL+C isn't having any
>>> effect until I hit.
>>>
>>> bash 3.2 worked perfectly, so I'm a little unsure what's caused this.
>>>
>>> Can anyone point me at the code which handles this and I can take a
>>> closer look ?
>>>
>>> Thanks,
>>>
>>> Alan.
>>>
>>>
>>>
>>>
>> Probably in readline. If it occurs on command prompt. If in running 
>> script it's in bash.
> 
> It's on the command line. Which function handles that in bash ?

You can debug an interactive bash and put a breakpoint in
rl_signal_handler.  This should give you information about whether
bash is receiving the SIGINT and what it's doing with it.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/




Re: --rcfile still opening the SYS_BASHRC

2009-05-15 Thread Lluís Batlle
2009/5/15 Chet Ramey :
> Lluís Batlle wrote:
>> Hello,
>>
>> I have a problem in bash (3.2 and 4). I have it compiled with
>> "-DSYS_BASHRC=/etc/bashrc", and since some time ago I could use "bash
>> --rcfile ~/.myrc" to skip the parsing of /etc/bashrc.
>>
>> I can't recall what was the compile configuration of that bash where
>> this worked. But in the latest bash 3.2 and 4 I've tried (for 4, I
>> have all patches published), using "--rcfile" *parses* /etc/bashrc
>
> This is how bash is supposed to behave.  Defining SYS_BASHRC makes bash
> source that file just before it sources the bashrc file.

I think I noticed SYS_BASHRC isn't sourced under "--rcfile" if bash
3.2 is not compiled with readline.
I had scripts using this feature, and suddenly they started to fail
when I used another bash (compiled with readline or ncurses).

>
>> According to the manual, "--rcfile" should make bash avoid the system bashrc.
>
> I'm not sure which manual you mean.  The bash manual doesn't say anything
> about SYS_BASHRC, since it's a feature that's not compiled in by default.

I agree. How do you suggest I can load an initialization file
automatically (as with "--rcfile"), but without SYS_BASHRC being
loaded?

>> Moreover, about parameter parsing, in bash versions 3.2 and 4, trying
>> to run "bash -i --rcfile xxx" results in bad parameter parsing,
>> getting a complain about parameter "--".
>
> The manual does have something to say about that:
>
>        Bash  also  interprets  a  number  of  multi-character
>        options.  These options must appear on the command line
>        before the single-character options to be recognized.
Right. Thank you. I hadn't seen that before.




extglob

2009-05-15 Thread Chris F.A. Johnson

   Am I missing something, or are these extended globbing patterns
   equivalent to a plain asterisk?

?(pattern-list) Matches zero or one occurrence of the given patterns
*(pattern-list) Matches zero or more occurrences of the given patterns

-- 
   Chris F.A. Johnson, webmaster 
   ===
   Author:
   Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)




Re: extglob

2009-05-15 Thread Pierre Gaston
On Sat, May 16, 2009 at 2:44 AM, Chris F.A. Johnson  wrote:
>
>   Am I missing something, or are these extended globbing patterns
>   equivalent to a plain asterisk?
>
> ?(pattern-list) Matches zero or one occurrence of the given patterns
> *(pattern-list) Matches zero or more occurrences of the given patterns

a * will match too much:

[[ bor = b?(a)r ]] #  false
[[ bor = b*r ]] # true

[[ baar = b?(a)r ]] #false
[[ baar = b*r ]] #true


[[ bor = b*(a)r ]] #  false
[[ bor = b*r ]] # true