Fix for depth limit detection
EasyOS keeps a history of past versions, so that the user can
rollback to earlier versions, if perhaps they don't like the latest. The
depth has a limit, default of 5, that can be changed in the Easy
Version Control GUI.
There have been reports that this is not working. Which has puzzled
me, as it works for me. TerryH and Caramel have been discussing this
problem:
https://forum.puppylinux.com/viewtopic.php?t=9903
Yes, the code starting about line 1490 is where the problem is. I
have identified what could be the cause of trouble. Here is the code,
extracted to a test script:
...see that highlighted grep -vF '*', I added that later.
At depth-5 I created /mnt/sdb3/easyos-kirkstone/releases/easy-5.5.2 folder, with nothing in it. That means the line with the highlighted text, realpath will not find any .sfs files. What happens then, is it doesn't return nothing as you would expect, it returns the literal text string /mnt/sdb3/easyos-kirkstone/releases/easy-5.5.2/*.sfs and assigns it to variable aSL.
Whether that is bad or not depends on the code in the do-loop.
Anyway, that highlighted text I have inserted will filter out that
situation, so for easy-5.5.2 folder no .sfs files are found. The result,
for me, where easy-5.5.3 does have .sfs files:
# ./test2
Warning, deleting old version: easy-5.5.2
EXEC: rm -rf /mnt/sdb3/easyos-kirkstone/releases/easy-5.5.2
Warning, deleting old version: easy-5.5.3
EXEC: rm -f /mnt/sdb3/easyos-kirkstone/sfs/easyos/oe/kirkstone/devx_5.5.3_amd64.sfs
EXEC: rm -f /mnt/sdb3/easyos-kirkstone/sfs/easyos/oe/kirkstone/easy_5.5.3_amd64.sfs
EXEC: rm -f /mnt/sdb3/easyos-kirkstone/releases/easy-5.5.3/rw-5.5.3.sfs
EXEC: rm -rf /mnt/sdb3/easyos-kirkstone/releases/easy-5.5.3
#
What will happen if the user has manually deleted a .sfs file,
resulting in folder easy-5.5.2 having a broken symlink, say
easy-5.5.2/easy.sfs? The code works, it just tries to delete a
non-existent .sfs:
# ./test2
Warning, deleting old version: easy-5.5.2
EXEC: rm -f /mnt/sdb3/easyos-kirkstone/releases/easy-5.5.2/easy_5.5.2_amd64.sfs
EXEC: rm -rf /mnt/sdb3/easyos-kirkstone/releases/easy-5.5.2
I have inserted that highlighted code in the 'init' script; however,
the code should still work without it. Leaving me still puzzled why some
users are reporting deleting of old versions is
failing.
Tags: easy