Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 354531 - sys-apps/kbd - `openvt -w' always returns error
Summary: sys-apps/kbd - `openvt -w' always returns error
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-11 21:06 UTC by Robert White
Modified: 2015-07-14 03:25 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Fixes various issues with option -w (kbd_openvt_wait_fix.patch,1.10 KB, text/plain)
2011-02-11 21:08 UTC, Robert White
Details

Note You need to log in before you can comment on or make changes to this bug.
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".