Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

non-existent mail arguments are silently discarded #264

Open
nmeum opened this issue Oct 8, 2024 · 0 comments · May be fixed by #265
Open

non-existent mail arguments are silently discarded #264

nmeum opened this issue Oct 8, 2024 · 0 comments · May be fixed by #265

Comments

@nmeum
Copy link
Contributor

nmeum commented Oct 8, 2024

As per mmsg(7) file names can also be passed as arguments. However, it is presently not checked explicitly whether the specified files actually exist. As such, mblaze utilities exit with a zero exit status even if the specified mail doesn't exist. For example:

$ mblaze -s /does/not/exist
$ echo $?
0

In such cases, an error should be printed and the utility should exit with a non-zero exit status. As briefly discussed on IRC, there is not technical reason why it's presently implemented like that it's just that noone has implemented the proper error handling so far.

nmeum added a commit to nmeum/mblaze that referenced this issue Oct 8, 2024
Sadly, the diff is quite large as we will have to change the API
of `blaze822_loop` to differentiate the number of processed messages
and a status code indicating a missing mail. Note that currently
execution is not aborted upon encountering the first non-existent
mail; hence, we can't do both via the return value.

Surprisingly, very few utilities actually use the number of processed
messages as return by `blaze822_loop`. Therefore, we could reduce the
diff quite a bit by differentiating the two use cases through separate
function (e.g. `blaze822_loop` and `blaze822_loop_num`), which would
allow the API of blaze822_loop to remain largely unchanged.

The new `blaze822_loop` API would also allow us to improve error
handling for blaze822_seq_next but I haven't done this so far.

There are also some tests, but these should be expanded.

Fixes leahneukirchen#264
nmeum added a commit to nmeum/mblaze-ui that referenced this issue Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant