Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Replace uninterruptible 'sleep ...' by interruptible 'read -t ...' #1425

Closed
jsmeix opened this issue Jul 19, 2017 · 3 comments
Closed
Assignees
Labels
Milestone

Comments

@jsmeix
Copy link
Member

jsmeix commented Jul 19, 2017

In current ReaR code there are several 'sleep' calls
with various sleep delay times
(first column shows how often each is used):

11  sleep 1
 5  sleep 2
 4  sleep 3
 1  sleep 5
 6  sleep 10
 2  sleep 30
 1  sleep 60

I think it could be better when instead of an uninterruptible 'sleep'
an interruptible 'read' call is used so that the user could in particular
interrupt longer sleep delays.

E.g. for longer sleep delays something like this:

delay=10
Print "sleeping $delay seconds, hit any key to interrupt"
read -t $delay -n 1 -s 0<&6 && Print "sleep interrupted"

That code sleeps silenty unless ReaR runs in verbose mode.

A possible drawback is that "rear recover" always runs verbose
so that during "rear recover" the user gets unexpected messages
about those sleep delays but on the other hand it is the intent
that the user can interrupt those sleeps.

This issue is somewhat related to the basic ideas behind
#1366
and
#1399
that both intend to give more power to the user.
This issue here intends to empower the user to
interrupt longer sleep delays.

@jsmeix jsmeix added discuss / RFC enhancement Adaptions and new features labels Jul 19, 2017
@jsmeix jsmeix added this to the ReaR future milestone Jul 19, 2017
@jsmeix jsmeix self-assigned this Jul 19, 2017
@gdha
Copy link
Member

gdha commented Jul 19, 2017

@jsmeix if the sleep time is less then 5 I would not bother changing the code. OTOH I have objection against the proposal.

@schlomo
Copy link
Member

schlomo commented Jul 19, 2017

@jsmeix which problem do you want to solve?

What should happen if a user interrupts the sleep? Should ReaR continue like nothing happened or should ReaR abort?

If to change something then I would only improve the exit behavior of ReaR, meaning that ReaR would faster or cleaner abort when the user presses Ctrl-C. Otherwise I assume that all the sleeps in ReaR are there for a very good reason.

If you think that a sleep is not needed then please simply remove it instead of creating a workaround.

@jsmeix
Copy link
Member Author

jsmeix commented Jul 19, 2017

A plain 'sleep' is basically never there for a good reason.
A plain 'sleep' basically always tells that
the one who made the code had no idea
what the actual thing is that should be waited for
so that he used 'sleep $blind_guess_delay_time'
as some kind of workaround.

I will just leave all as is.

@jsmeix jsmeix closed this as completed Jul 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants