* [Cocci] Fatal error: exception Failure("not supported")
@ 2015-05-17 6:18 Nicholas Mc Guire
2015-05-17 12:08 ` Sébastien Hinderer
0 siblings, 1 reply; 6+ messages in thread
From: Nicholas Mc Guire @ 2015-05-17 6:18 UTC (permalink / raw)
To: cocci
Hi !
Writing some simple checks for user-space sample code to check that a
read loop has some error checking in it - the read loop should look
something like this:
do {
len = read(fd, buff + off, BUFFSIZE);
if (len < 0 && len != -EAGAIN) {
perror("read failed");
exit(-1);
}
off += len;
} while (len > 0);
to check this the following cocci spatch was intended
<snip>
virtual report
virtual org
@check_open@
identifier f,retval;
idexpression int fd;
idexpression int l;
idexpression int o;
idexpression char * b;
position p;
@@
f(...) {
<+...
do {
...
l = read@p(fd,b+o,...);
if (l < 0 && l != -EAGAIN) {
? perror(...);
(
exit(...);
|
return ...;
)
}
l = l + o;
} while ( l > 0);
return retval;
...+>
}
@script: python@
p<<check_open.p;
fn<<check_open.f;
@@
print "OK: read loop in %s:%s line %s checking errors" % (p[0].file,fn, p[0].line)
<snip>
spatch --parse-cocci gives no errors and the output looks fine (just the iso
expansions basically) - but when run with:
spatch --sp-file check_read_loop.cocci open_read_ok.c
its giving me:
init_defs_builtins: /usr/local/share/coccinelle/standard.h
Fatal error: exception Failure("not supported")
how can I figure out what is "not supported" here ?
thx!
hofrat
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Cocci] Fatal error: exception Failure("not supported")
2015-05-17 6:18 [Cocci] Fatal error: exception Failure("not supported") Nicholas Mc Guire
@ 2015-05-17 12:08 ` Sébastien Hinderer
2015-05-17 13:11 ` Julia Lawall
0 siblings, 1 reply; 6+ messages in thread
From: Sébastien Hinderer @ 2015-05-17 12:08 UTC (permalink / raw)
To: cocci
Hi Nicholas,
Nicholas Mc Guire (2015/05/17 08:18 +0200):
>
> Hi !
>
> Writing some simple checks for user-space sample code to check that a
> read loop has some error checking in it - the read loop should look
> something like this:
>
> do {
> len = read(fd, buff + off, BUFFSIZE);
> if (len < 0 && len != -EAGAIN) {
> perror("read failed");
> exit(-1);
> }
> off += len;
> } while (len > 0);
I know it is not relevant for your problem, but the last argumentof the
read system call looks suspiscious to me. I'd rather write BUFFSIZE-of
but perhaps you wrote it that way just to simplify.
> to check this the following cocci spatch was intended
>
> <snip>
> virtual report
> virtual org
>
> @check_open@
> identifier f,retval;
> idexpression int fd;
> idexpression int l;
> idexpression int o;
> idexpression char * b;
> position p;
> @@
>
> f(...) {
> <+...
> do {
> ...
> l = read at p(fd,b+o,...);
> if (l < 0 && l != -EAGAIN) {
> ? perror(...);
> (
> exit(...);
> |
> return ...;
> )
> }
> l = l + o;
> } while ( l > 0);
> return retval;
> ...+>
> }
>
>
> @script: python@
> p<<check_open.p;
> fn<<check_open.f;
> @@
> print "OK: read loop in %s:%s line %s checking errors" % (p[0].file,fn, p[0].line)
> <snip>
>
> spatch --parse-cocci gives no errors and the output looks fine (just the iso
> expansions basically) - but when run with:
> spatch --sp-file check_read_loop.cocci open_read_ok.c
> its giving me:
> init_defs_builtins: /usr/local/share/coccinelle/standard.h
> Fatal error: exception Failure("not supported")
>
> how can I figure out what is "not supported" here ?
just try this:
export OCAMLRUNPARAM=b
And then re-run the spatch that caused the exception. You should get a
backtrace that you can post here.
In case you do not get it, it will probably mean that you have compiled
a native-code version of coccinelle. We will have to get a byte-code one
to be able to have a backtrace.
And by the way, do you really need <+... and ...+> ? Wouldn't two mere
... be enough?
hth,
S?bastien.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Cocci] Fatal error: exception Failure("not supported")
2015-05-17 12:08 ` Sébastien Hinderer
@ 2015-05-17 13:11 ` Julia Lawall
2015-05-17 13:28 ` Nicholas Mc Guire
2015-05-17 15:05 ` [Cocci] Support for "do { … } while"? SF Markus Elfring
0 siblings, 2 replies; 6+ messages in thread
From: Julia Lawall @ 2015-05-17 13:11 UTC (permalink / raw)
To: cocci
do while is not supported. Sorry.
julia
On Sun, 17 May 2015, S?bastien Hinderer wrote:
> Hi Nicholas,
>
> Nicholas Mc Guire (2015/05/17 08:18 +0200):
> >
> > Hi !
> >
> > Writing some simple checks for user-space sample code to check that a
> > read loop has some error checking in it - the read loop should look
> > something like this:
> >
> > do {
> > len = read(fd, buff + off, BUFFSIZE);
> > if (len < 0 && len != -EAGAIN) {
> > perror("read failed");
> > exit(-1);
> > }
> > off += len;
> > } while (len > 0);
>
> I know it is not relevant for your problem, but the last argumentof the
> read system call looks suspiscious to me. I'd rather write BUFFSIZE-of
> but perhaps you wrote it that way just to simplify.
>
> > to check this the following cocci spatch was intended
> >
> > <snip>
> > virtual report
> > virtual org
> >
> > @check_open@
> > identifier f,retval;
> > idexpression int fd;
> > idexpression int l;
> > idexpression int o;
> > idexpression char * b;
> > position p;
> > @@
> >
> > f(...) {
> > <+...
> > do {
> > ...
> > l = read at p(fd,b+o,...);
> > if (l < 0 && l != -EAGAIN) {
> > ? perror(...);
> > (
> > exit(...);
> > |
> > return ...;
> > )
> > }
> > l = l + o;
> > } while ( l > 0);
> > return retval;
> > ...+>
> > }
> >
> >
> > @script: python@
> > p<<check_open.p;
> > fn<<check_open.f;
> > @@
> > print "OK: read loop in %s:%s line %s checking errors" % (p[0].file,fn, p[0].line)
> > <snip>
> >
> > spatch --parse-cocci gives no errors and the output looks fine (just the iso
> > expansions basically) - but when run with:
> > spatch --sp-file check_read_loop.cocci open_read_ok.c
> > its giving me:
> > init_defs_builtins: /usr/local/share/coccinelle/standard.h
> > Fatal error: exception Failure("not supported")
> >
> > how can I figure out what is "not supported" here ?
>
> just try this:
>
> export OCAMLRUNPARAM=b
> And then re-run the spatch that caused the exception. You should get a
> backtrace that you can post here.
>
> In case you do not get it, it will probably mean that you have compiled
> a native-code version of coccinelle. We will have to get a byte-code one
> to be able to have a backtrace.
>
> And by the way, do you really need <+... and ...+> ? Wouldn't two mere
> ... be enough?
>
> hth,
> S?bastien.
> _______________________________________________
> Cocci mailing list
> Cocci at systeme.lip6.fr
> https://systeme.lip6.fr/mailman/listinfo/cocci
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Cocci] Fatal error: exception Failure("not supported")
2015-05-17 13:11 ` Julia Lawall
@ 2015-05-17 13:28 ` Nicholas Mc Guire
2015-05-17 13:52 ` Julia Lawall
2015-05-17 15:05 ` [Cocci] Support for "do { … } while"? SF Markus Elfring
1 sibling, 1 reply; 6+ messages in thread
From: Nicholas Mc Guire @ 2015-05-17 13:28 UTC (permalink / raw)
To: cocci
On Sun, 17 May 2015, Julia Lawall wrote:
> do while is not supported. Sorry.
>
interesting - did this just not get done or
is there a theoretical issue with do while constructs ?
thx!
hofrat
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Cocci] Fatal error: exception Failure("not supported")
2015-05-17 13:28 ` Nicholas Mc Guire
@ 2015-05-17 13:52 ` Julia Lawall
0 siblings, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2015-05-17 13:52 UTC (permalink / raw)
To: cocci
On Sun, 17 May 2015, Nicholas Mc Guire wrote:
> On Sun, 17 May 2015, Julia Lawall wrote:
>
> > do while is not supported. Sorry.
> >
>
> interesting - did this just not get done or
> is there a theoretical issue with do while constructs ?
It just never got done...
How about
* x = read at p(...)
... when != x < 0
when != x > 0
when != x == -C
* x = read at p(...)
julia
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Cocci] Support for "do { … } while"?
2015-05-17 13:11 ` Julia Lawall
2015-05-17 13:28 ` Nicholas Mc Guire
@ 2015-05-17 15:05 ` SF Markus Elfring
1 sibling, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2015-05-17 15:05 UTC (permalink / raw)
To: cocci
> do while is not supported.
How will the support for this programming language construct evolve?
Regards,
Markus
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-05-17 15:05 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-17 6:18 [Cocci] Fatal error: exception Failure("not supported") Nicholas Mc Guire
2015-05-17 12:08 ` Sébastien Hinderer
2015-05-17 13:11 ` Julia Lawall
2015-05-17 13:28 ` Nicholas Mc Guire
2015-05-17 13:52 ` Julia Lawall
2015-05-17 15:05 ` [Cocci] Support for "do { … } while"? SF Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).