Wrong return code usage for shell.c.in

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Wrong return code usage for shell.c.in

Kai Howelmeyer
Hi,

I have a database with several selftests. One of those selftests fails. This is correctly reported in the textual output of the sqlite shell. Yet, the error code when running for example

```
sqlite3 -batch <<SQLDOC
.selftest -init
insert into selftest(op, cmd, ans) values
 ('run', 'select 1;', '2'),
 ('run', 'select 2;', '2');
.selftest
SQLDOC
```

is still 0. This only happens when after a failing selftest there is at least one test case which still succeeds. I believe https://github.com/sqlite/sqlite/blob/version-3.29.0/src/shell.c.in#L8751 is at fault, as it will forget previous values for `rc`. Furthermore, `nErr` does not have any bearing on the final return code.

I tried going through open bugs, yet I could not find a corresponding bug for this issue.


Best,

Kai.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Wrong return code usage for shell.c.in

Kai Howelmeyer
Hi everyone,

since my below issue looks like a bug, can we please file a ticket for it? I understand that I cannot file the ticket myself and this mailing list is the preferred way of asking to create a ticket on behalf of the reporter. I hope that this is still correct.


Thank you and all the best,

Kai.

> On Aug 4, 2019, at 10:37 AM, Kai Howelmeyer <[hidden email]> wrote:
>
> Hi,
>
> I have a database with several selftests. One of those selftests fails. This is correctly reported in the textual output of the sqlite shell. Yet, the error code when running for example
>
> ```
> sqlite3 -batch <<SQLDOC
> .selftest -init
> insert into selftest(op, cmd, ans) values
> ('run', 'select 1;', '2'),
> ('run', 'select 2;', '2');
> .selftest
> SQLDOC
> ```
>
> is still 0. This only happens when after a failing selftest there is at least one test case which still succeeds. I believe https://github.com/sqlite/sqlite/blob/version-3.29.0/src/shell.c.in#L8751 is at fault, as it will forget previous values for `rc`. Furthermore, `nErr` does not have any bearing on the final return code.
>
> I tried going through open bugs, yet I could not find a corresponding bug for this issue.
>
>
> Best,
>
> Kai.

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users