Bug 265248 - bectl warns twice when the user tries once to create an existing environment (boot environment name already taken)
Summary: bectl warns twice when the user tries once to create an existing environment ...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: Warner Losh
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-16 07:09 UTC by Graham Perrin
Modified: 2024-02-19 03:42 UTC (History)
2 users (show)

See Also:
imp: mfc-stable13-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Graham Perrin freebsd_committer freebsd_triage 2022-07-16 07:09:41 UTC
Nit: 

root@mowa219-gjp4-8570p-freebsd:~ # bectl list -c creation
BE                        Active Mountpoint Space Created
n250511-5f73b3338ee-d     -      -          64.6G 2021-11-13 15:43
n253776-d5ad1713cc3-b     -      -          9.43G 2022-03-18 09:31
n254693-d7696096209-f     -      -          4.60G 2022-04-27 17:41
n255078-e140d551b78-h     -      -          88.4G 2022-05-11 21:18
n255588-01235012e5b-d     -      -          2.61G 2022-05-15 00:29
n255588-01235012e5b-b-c1d -      -          14.0G 2022-05-23 18:11
n255769-f16e38162c7-k     -      -          6.48G 2022-06-14 20:36
n256147-1c665e95d44-d     -      -          6.35G 2022-06-25 08:08
n256363-9c42645a1e4-d     -      -          1.55G 2022-07-05 19:40
n256570-5c19fabbe34-a     -      -          215M  2022-07-06 05:24
n256570-5c19fabbe34-b     -      -          277M  2022-07-11 17:18
n256570-5c19fabbe34-c     NR     /          61.3G 2022-07-13 10:53
root@mowa219-gjp4-8570p-freebsd:~ # bectl destroy n256570-5c19fabbe34-a
root@mowa219-gjp4-8570p-freebsd:~ # bectl create n256570-5c19fabbe34-c
boot environment name already taken
boot environment name already taken
Failed to create bootenv n256570-5c19fabbe34-c
root@mowa219-gjp4-8570p-freebsd:~ # bectl create n256570-5c19fabbe34-d
root@mowa219-gjp4-8570p-freebsd:~ # bectl mount n256570-5c19fabbe34-d /tmp/up
Successfully mounted n256570-5c19fabbe34-d at /tmp/up
root@mowa219-gjp4-8570p-freebsd:~ # pkg -r /tmp/up upgrade --quiet --yes
…
root@mowa219-gjp4-8570p-freebsd:~ # bectl umount n256570-5c19fabbe34-d 
root@mowa219-gjp4-8570p-freebsd:~ # bectl activate n256570-5c19fabbe34-d
Successfully activated boot environment n256570-5c19fabbe34-d
root@mowa219-gjp4-8570p-freebsd:~ # exit
logout
% date ; uname -a
Sat 16 Jul 2022 08:04:39 BST
FreeBSD mowa219-gjp4-8570p-freebsd 14.0-CURRENT FreeBSD 14.0-CURRENT #15 main-n256570-5c19fabbe34-dirty: Wed Jul  6 04:50:03 BST 2022     root@mowa219-gjp4-8570p-freebsd:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG amd64
% exit
Comment 1 John Grafton 2023-03-06 18:51:38 UTC
Bug is in libbe.  Seems two functions are printing the error in their return path.

Pull request:  https://github.com/freebsd/freebsd-src/pull/685
Comment 2 commit-hook freebsd_committer freebsd_triage 2023-03-15 03:20:32 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=8e933d9c598ec847081c322e7ae9a46bf7897886

commit 8e933d9c598ec847081c322e7ae9a46bf7897886
Author:     John Grafton <john.grafton@gmail.com>
AuthorDate: 2023-03-15 03:14:14 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-03-15 03:15:17 +0000

    libbe: Avoid double printing cloning errors.

    be_clone calls be_clone_cb and both call set_error on the return
    error path.  set_error prints the error resulting in a double print.
    be_clone_cb should just return the error code and allow be_clone
    to print it.

    PR: 265248
    Reported by: Graham Perrin
    Reviewed by: imp, kevans
    Pull Request: https://github.com/freebsd/freebsd-src/pull/685

 lib/libbe/be.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
Comment 3 Mark Linimon freebsd_committer freebsd_triage 2024-01-10 04:48:06 UTC
^Triage: assign to committer that resolved.
Comment 4 commit-hook freebsd_committer freebsd_triage 2024-02-19 03:42:11 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=ddf5bf4319f61ccbb7f9e843965df86ac60253df

commit ddf5bf4319f61ccbb7f9e843965df86ac60253df
Author:     John Grafton <john.grafton@gmail.com>
AuthorDate: 2023-03-15 03:14:14 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-02-19 03:02:58 +0000

    libbe: Avoid double printing cloning errors.

    be_clone calls be_clone_cb and both call set_error on the return
    error path.  set_error prints the error resulting in a double print.
    be_clone_cb should just return the error code and allow be_clone
    to print it.

    PR: 265248
    Reported by: Graham Perrin
    Reviewed by: imp, kevans
    Pull Request: https://github.com/freebsd/freebsd-src/pull/685

    (cherry picked from commit 8e933d9c598ec847081c322e7ae9a46bf7897886)

 lib/libbe/be.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)