terminalforlife/ShellProjects

lmc-darklight LMDE still giving an error

Closed this issue · 12 comments

As I promised I did another clean install. This time on another lmde pc, so it's really a clean install.
It installed ok just like last time and trying to run it gives a fast repeating loop with an error in it.
It cannot find the config causing a null value in the delay causing the fast loop.

vimes@weatherwax:~$ lmc-darklight -f
PID: 26934
Current values...
Borders='vimes-bar'
Icons='Mint-Y-Dark-Yellow'
Controls='Mint-Y-Dark-Blue'
Cursor='DMZ-White'
Desktop='vimes'
BG='/usr/share/backgrounds/All/kyoung_chicago.jpg'
Loop #1 ...
Err: File '/home/vimes/.config/lmc-darklight/config' not found.
Setting org.cinnamon.theme/name ... [OK]
Setting org.gnome.desktop.interface/gtk-theme ... [OK]
Setting org.cinnamon.desktop.interface/gtk-theme ... [OK]
Setting org.gnome.desktop.interface/icon-theme ... [OK]
Setting org.cinnamon.desktop.interface/icon-theme ... [OK]
Setting org.cinnamon.desktop.interface/cursor-theme ... [OK]
Setting org.gnome.desktop.interface/cursor-theme ... [OK]
Setting org.cinnamon.desktop.wm.preferences/theme ... [OK]
Setting org.gnome.desktop.wm.preferences/theme ... [OK]
Setting org.cinnamon.desktop.background/picture-uri ... [OK]
sleep: invalid time interval ‘s’
Try 'sleep --help' for more information.
Loop #2 ...
Err: File '/home/vimes/.config/lmc-darklight/config' not found.
Setting org.cinnamon.theme/name ... [OK]
Setting org.gnome.desktop.interface/gtk-theme ... [OK]

etcetera

Thank you. At least this I can fix with relative ease. Lol sleep(1) should probably have a default value, and while I'm checking for null keys, I'm not taking into account the quotes. I'm very grateful for this Issue. :)

As for your end, create the default config with: lmc-darklight --genconfig

I still need to handle the quotes, but at least now it won't continue if there's no configuration file. I reopened the Issue because that last commit automatically closed it, and I still need to address the quoting issue.

Scratch that, it does properly detect a null value — I do recall handling that, yeah. Weird how none of those errors came up when the configuration file was missing. Anyway, I guess it's indirectly fixed.

Now I can close this. If you still have problems, reopen.

I did not retest it yet but I can see there is still a fast-loop possibility. This statement:

		if [[ ! $Interval =~ ^[[:digit:]]+$ || $Interval == 0 ]]; then
			VErr "Value for 'Interval' invalid."
		fi

will give an error message via Verr() but the processing continues which is ok but if someone set an erroneous value for the interval in the config the sleep command will fail again and the loop takes off.
When you detect an erroneous interval you should substitute a valid (default) value instead and maybe mention it in the error message.

Even though sleep(1) now has a default value? sleep ${Interval:-3}s

Oh I missed that change. Isnt 3 seconds a bit fast?

It is admittedly pretty fast, but the reason I did that, is so the user doesn't have to wait forever for it to work once they've addressed the problem. Also, remember, in that 3 seconds, nothing will likely be happening other than some simple checks, so it should be fine.

The way I originally did all this was to have all the configuration file processing outside of the main loop, and for errors to exit, but I changed it because I didn't want the user to have to keep logging out and in when trying to address the problem(s).

Yes I understand. This evening I will try it again on again another lmde pc. Is the config now created in the install or do I still have to do that by hand?

The configuration file still has to be generated by the user, but the installer script now hints the user of that at the end. I was gonna make it automatic in that script, but the script has to be run as 'root', so it just leads to needless hassle.

I'm toying with the idea of just having LMC-DarkLight itself automatically generate a configuration file if one isn't found. The flag could stay though, just in-case it's needed.

Ok. If I get LMDE5 beta running tonight I will try it there as well.

Okidoke. Thanks again for all your help. :)

My lmde4 pc is unavailable tonight, but I managed to install lmde5 beta. The install of lmc-darklight went fine again and it also worked without issue afterward :) I started it from a terminal and started a second from another terminal and the latter nicely killed the former which said 'Hangup'.
Great :)
I did find a few bugs in lmde5 though while I was at it but that is not for you to worry.

That's awesome! So happy to hear. :D Thanks yet again. You're a star.