The openvt command, when using option -w needs to close the file descriptor attached to the allocated vt or it will always return an error because the vt is "still in use" by openvt. Reproducible: Always Steps to Reproduce: 1. go to a text console (e.g. ctrl-alt-f1) 2. log in 3. run command "openvt -s -w -- cat /proc/mounts" (any command will do) Actual Results: Could not deallocate console (some number). Return code from process is always 8. Expected Results: deallocation should have been successful. Return code should have been zero (or actual return code from invoked child program). This is an upstream error. The program also has an unhappy and undocumented behavior that it makes it suck for scripting, in that open vt doesn't return the return-code of the invoked program when -w is used. I have a very simple patch that fixes the unconditional error. It also makes openvt wait for its forked child explicitly instead of the exit of any child. It also returns the return status of the child when it doesn't have an overriding error condition. All three are trivial fixes and make it "better" without changing any explicit or documented behaviors. Patch to be attached presently (shame you cannot do it while filing the initial bug).
Created attachment 262169 [details] Fixes various issues with option -w Makes VT deallocation work without errors. Returns exit code of invoked process. Explicitly waits for invoked process by pid instead of the exit of "any child".
Applied, thanks! http://git.altlinux.org/people/legion/packages/kbd.git?p=kbd.git;a=commitdiff;h=e37c78afc7fcee6d8edaa506b99d9081249adb7d