Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 354531

Summary: sys-apps/kbd - `openvt -w' always returns error
Product: Gentoo Linux Reporter: Robert White <rwhite>
Component: [OLD] Core systemAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED FIXED    
Severity: normal CC: gladkov.alexey
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Fixes various issues with option -w

Description Robert White 2011-02-11 21:06:46 UTC
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).
Comment 1 Robert White 2011-02-11 21:08:45 UTC
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".