Sysupgrade bug in r4188-r4212, fixed by r4213 (NAND devices, LuCI)

Looks like the commit r4188-e96a9a9af8 "sysupgrade: run only one instance at a time." has introduced a bug to the sysupgrade process that prevents the actual sysupgrade. It may not affect all target platforms, but at least ipq806x / R7800, a NAND device, seems to suffer from the bug.

I have written my findings directly to the commit:
https://github.com/lede-project/source/commit/e96a9a9af82c00dcce606a84a7bb87a00411385d
And have filed a bug:
https://bugs.lede-project.org/index.php?do=details&task_id=810

So far I have only managed to make sysupgrade to work only if I revert the changes done by that commit (manually edit /sbin/sysupgrade file in live router).

Offending code has been removed by r4213-361c8b4ee4

https://git.lede-project.org/?p=source.git;a=commitdiff;h=361c8b4ee4a20035d4c967d9d67db90d53e924a2

But if you have already flashed r4188-r4212, you may need to remove the changes done by r4188 before doing sysupgrade. Editing /sbin/sysupgrade manually is the easiest choice, as the changes are just one code block.