vn971 / rua

Build tool for Arch Linux providing control, review and jailed build options
GNU General Public License v3.0
425 stars 42 forks source link

Unclear error reporting when running rua inside rua #92

Closed vn971 closed 4 years ago

vn971 commented 4 years ago

Steps:

Expected at this point: RUA tells you that you're running it inside itself, or fail with some other easy to understand reason

Actual behavior:

thread 'main' panicked at 'Cannot work with PKGDEST environment being set. Please run RUA without it', src/rua_environment.rs:52:2
stack backtrace:
   0: <unknown>
   1: <unknown>

Possible solution: use the already existing mechanism to prevent running multiple instances of RUA simultaneously, before doing other filesystem/environment checks. This will make the error message be something like: Another RUA instance already running. which is arguably more understandable. It is one step from being trivial in that code grouping has to change a little, but that's the only thing that needs to be changed.

Also, it makes sense to remove panicking from the PKGDEST checking code regardless.

VukoDrakkeinen commented 4 years ago

I just tested this on v0.17.4 and rua does exit with Error: another RUA instance already running., so I guess this can be considered fixed already.

VukoDrakkeinen commented 4 years ago

Uh oh, this will also stop subcommands like info and search. Those should be allowed, arguably.

vn971 commented 4 years ago

Yeah... Quite unfortunately though.

vn971 commented 4 years ago

This got fixed as part of https://github.com/vn971/rua/commit/a56b8863a7ae8c48fd90d477a8c9bb209373ea7b

Because we now take the "uniqueness" lock as early as possible, we also do it before environment checks, which gives an error reason of:

Error: another RUA instance already running.

Hopefully understandable enough for situation of running rua inside rua.