Closed sanicSanic closed 3 years ago
void getcmd(const Block *block, char *output)
{
...
fgets(output+i, CMDLENGTH-(strlen(delim)+1), cmdf);
...
pclose(cmdf);
}
here at line 78 of dwmblocks.c , when inputting too quickly .( for example a quick scroll). there will be a flush of function getcmd executed at once.
and somehow this causes the
fgets(output+i, CMDLENGTH-(strlen(delim)+1), cmdf);
not printing anything to (output +i) ; so the block content got disappeared. I have verified to let buttonhandler to handle another script but same signal. and commented out the buttonhandler's signal or status updating functions, the problem remains.
Lets fix this problem , any ideas ?
I have similar issue. Is that what you are talking about? https://imgur.com/a/EKPOFug
When you send a signal to dwmblocks by clicking or scrolling on the status bar, it has to handle the interrupt before it can finish what it was doing. If you were updating one of your blocks when this happened, then the fgets function will exit with the EINTR error and return NULL as if it could not read anything, causing the block to disappear. Because of this, this issue is more likely to occur if your blocks take longer to update. There is a related issue where the sleep function is also broken out of during the interrupt. This causes the "time" variable to be incremented prematurely, updating the next block right away as well as updating blocks with larger longer update intervals much sooner in these scrolling scenarios. This also makes this bug more likely to happen. The first issue is solved by writing the output of fgets to a temp buffer and copying it over on success, and optionally trying to read again until the EINTR error goes away. The second issue is solved by using nanosleep and continuing the sleep with whatever was left when it exited before moving on to update. Both of these issues are solved (I cannot recreate this bug anymore) here https://github.com/dfuehrer/dwmblocks/tree/mychanges.
void getcmd(const Block *block, char *output)
{
...
fgets(output+i, CMDLENGTH-(strlen(delim)+1), cmdf);
...
pclose(cmdf);
}
here at line 78 of dwmblocks.c , when inputting too quickly .( for example a quick scroll). there will be a flush of function getcmd executed at once.
and somehow this causes the
fgets(output+i, CMDLENGTH-(strlen(delim)+1), cmdf);
not printing anything to (output +i) ; so the block content got disappeared. I have verified to let buttonhandler to handle another script but same signal. and commented out the buttonhandler's signal or status updating functions, the problem remains.
Lets fix this problem , any ideas ?