| Summary: | FreeBSD 12.0-BETA - bectl create NEWBE - multiple error messages instead of one | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | Slawomir Wojciech Wojtczak <vermaden> | ||||
| Component: | bin | Assignee: | Kyle Evans <kevans> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Only Me | CC: | dch, kevans, rew | ||||
| Priority: | --- | Keywords: | patch | ||||
| Version: | 12.0-STABLE | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
|
Description
Slawomir Wojciech Wojtczak
2018-11-12 19:29:39 UTC
Created attachment 199243 [details]
only call set_error() when an error is first encountered.
set_error() was previously being called multiple times for the same error.
This patch calls set_error() only when the type of error is known first-hand. Once the error number is set, the error number is returned up the chain.
While this patch is by no means a robust fix, it does start to address the core issue this bug originates from - which is inconsistent error handling within libbe. What I mean by inconsistency is that, some routines within libbe return an error number (without using set_error()) while other functions use set_error() and then return an error number.
Hopefully this patch will be considered as a first-step to bringing consistent error handling within libbe. An error should be set once, as soon as its known, and the associated error number should be returned up the chain - eventually making it's way to an application program, presumably.
The diff was taken from r340424 (HEAD), should it be against stable/12 branch? This is my first patch submission, so bear with me.
Take. Same on 11.3-RELEASE ... # doas bectl create safe boot environment name already taken boot environment name already taken boot environment name already taken boot environment name already taken failed to create bootenv safe # uname -v FreeBSD 11.3-RELEASE #0 r349754: Fri Jul 5 04:45:24 UTC 2019 root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC |