Quote:
Originally Posted by Didier Spaier
Or, if that's a matter you want to discuss about first, maybe you could post your thoughts here?
|
My suggestion was to add a configuration option to slackpkg.conf to control purging of the stdin input buffer before prompting the user for input. The option should be disabled by default in order to maintain current behavior. If the option is enabled, slackpkg should discard any type-ahead input before issuing a prompt.
Discarding type-ahead input would be useful to prevent unintended processing and/or the "OK! Your choice is nothing!" message in response to the K/O/R/P prompt in the looknew routine in post-functions.sh. What happens to me is that the screen will blank during installation of a lengthy set of upgrades. I hit a key on the keyboard to turn the display back on. I try to remember to hit a key that doesn't put anything in the input buffer, like the alt key or the scroll lock key, but sometimes I forget or I just hit the wrong key. When I subsequently type an answer to the K/O/R/P prompt after all the packages have been installed, the following read command gets whatever is already in the input buffer ahead of my response, my intended response is not recognized, and I get the "OK! Your choice is nothing!" message.
I have not implemented my suggestion. I just inserted a read command immediately before the echo for the K/O/R/P prompt to discard any type-ahead input. That addressed my immediate need.
This is in the looknew() routine in /usr/libexec/slackpkg/functions.d/post-functions.sh, with the added command below in
red.
Code:
if [ "$FILES" != "" ]; then
read -t 1 -n 1000 discard
echo -e "\n\
Some packages had new configuration files installed.
You have four choices:
(K)eep the old files and consider .new files later
(O)verwrite all old files with the new ones. The
old files will be stored with the suffix .orig
(R)emove all .new files
(P)rompt K, O, R selection for every single file
What do you want (K/O/R/P)?"
answer
case $ANSWER in
K|k)
break
;;
...
I haven't checked, but assuming that the answer function in core-functions.sh is always used to read the response to a prompt, then the more general enhancement I suggested would be implemented there.