[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: SEGFAULT if bash script make "source" for itself
From: |
bogun.dmitriy |
Subject: |
Re: SEGFAULT if bash script make "source" for itself |
Date: |
Thu, 28 Aug 2014 15:11:23 -0700 |
2014-08-28 14:57 GMT-07:00 Eric Blake <address@hidden>:
> On 08/28/2014 03:50 PM, address@hidden wrote:
> > Any action in my script should lead to SIGSEGV in interpreter! If I write
> > program on some compilable language, for example C, compile it and got
> > SIGSEGV - this is my problem. But in this case, my program executed by
> > interpreter, and if interpreter fail, despite reasons, this is problem of
> > interpreter.
>
> No, it is a problem of your buggy program.
>
I got your point. There is no way I can agree with it.
>
> >
> > What you will say if gcc(cc) will down with SIGSEGV while compiling your
> > code? Is it problem of gcc or your code?
>
> If gcc segfaults because it implements #include via recursion, and I
> wrote a recursion loop of #includes into my source, then I'd say the bug
> was mine, not gcc's. Just the same as if you write a recursion loop
> into your bash program.
>
> It's not the compiler's fault that input that requests recursion can
> abuse the stack. Rather, it is the fault of the input.
>
Unhanded program termination - is not input problem, it is program problem.
Looks like gcc programmers not so dumb.
$ gcc a.c
In file included from a.h:1:0,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.h:1,
from a.c:1:
a.h:1:15: error: #include nested too deeply
>
> > To be short - you(community) don't want to add limit, because its default
> > value shoul be infinite!
>
> I'm not saying that a limit is a bad idea, just that a limit on by
> default is a bad idea (it goes against the GNU Coding Standards of no
> arbitrary limits). The moment YOU change from the default of unlimited
> to your chosen limit, it is no longer an arbitrary limitation of bash,
> but a conscious choice on your part. But as long as the limit defaults
> to being off, it brings us back to the question of whether bash should
> dump core when the stack overflows due to a buggy user input. It's not
> a bug in bash, but in the user program; and that's WHY libsigsegv exists
> (to convert what would have been a core dump into a nice error message,
> making it obvious that the bug was in the user input).
>
I should make patch and add libsigsegv?
--
> Eric Blake eblake redhat com +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
> As I understand, most people here don't want to have a limit or any other
solution for this recursion issue. One make a proposal to make an patch,
which will not be committed upstream.
...
Give me the way to set limit - the rest is my problem.
PS Your development/test environment is same with your production
environment? You never use extended logging? Some limits?
- Re: SEGFAULT if bash script make "source" for itself, (continued)
- Re: SEGFAULT if bash script make "source" for itself, bogun.dmitriy, 2014/08/28
- Re: SEGFAULT if bash script make "source" for itself, Eric Blake, 2014/08/28
- Re: SEGFAULT if bash script make "source" for itself, bogun.dmitriy, 2014/08/28
- Re: SEGFAULT if bash script make "source" for itself, Eric Blake, 2014/08/28
- Re: SEGFAULT if bash script make "source" for itself, bogun.dmitriy, 2014/08/28
- Re: SEGFAULT if bash script make "source" for itself, Chris Down, 2014/08/28
- Re: SEGFAULT if bash script make "source" for itself, bogun.dmitriy, 2014/08/28
- Re: SEGFAULT if bash script make "source" for itself, Bob Proulx, 2014/08/28
- Re: SEGFAULT if bash script make "source" for itself, bogun.dmitriy, 2014/08/28
- Re: SEGFAULT if bash script make "source" for itself, Eric Blake, 2014/08/28
- Re: SEGFAULT if bash script make "source" for itself,
bogun.dmitriy <=
- Re: SEGFAULT if bash script make "source" for itself, Eric Blake, 2014/08/28
- Re: SEGFAULT if bash script make "source" for itself, bogun.dmitriy, 2014/08/28
- Re: SEGFAULT if bash script make "source" for itself, Chris Down, 2014/08/28
- Re: SEGFAULT if bash script make "source" for itself, bogun.dmitriy, 2014/08/28
- Re: SEGFAULT if bash script make "source" for itself, Chris Down, 2014/08/28