LINBIT / drbd-utils

DRBD userspace utilities (for 9.x, 8.4, 8.3)
GNU General Public License v2.0
78 stars 46 forks source link

Update drbd: Script reports no such file, it shouldn't. Fixed. #36

Closed tux2bsd closed 8 months ago

tux2bsd commented 9 months ago

Fixes this error (when started via sysvinit):

Starting DRBD resources:/etc/init.d/drbd: line 148: /var/lib/linstor/loop_device_mapping: No such file or directory [

Related: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1030118

Though in my case I am using Devuan, which is downstream of Debian for most packages (e.g. drbd-utils)

Couple of commits, please squash. I did this quickly only using github's interface... (script tested though) .

tux2bsd commented 9 months ago

@rck fyi

rck commented 9 months ago

hm, you did not take the time to prepare a proper commit (including proper commit messages) but now you assume I should do the work for you? I'm actually not too fond of these "fixing whitspaces" kind of commits either.

back to something more productive: this is a patch I could imagine merging, would that be sufficient for you?

diff --git a/scripts/drbd b/scripts/drbd
index fbed28f2..69d94cb5 100755
--- a/scripts/drbd
+++ b/scripts/drbd
@@ -148,10 +148,14 @@ handle_linstor_loopback()
 {
        local line dev file loop_mapping

-       # new location
-       loop_mapping=/var/lib/linstor.d/loop_device_mapping
-       # fallback to old location
-       [ -f "$loop_mapping" ] || loop_mapping=/var/lib/linstor/loop_device_mapping
+       # new location then fallback to old location
+       if [ -f "/var/lib/linstor.d/loop_device_mapping" ]; then
+               loop_mapping="/var/lib/linstor.d/loop_device_mapping"
+       elif [ -f "/var/lib/linstor/loop_device_mapping" ]; then
+               loop_mapping="/var/lib/linstor/loop_device_mapping"
+       else
+               return 0
+       fi

In general I'm only willing to accept the absolute minimum to this shell nonsense, like it or not, we now have proper systemd unit files and I actually wanted to remove this file for a long time.

tux2bsd commented 8 months ago

@rck you should learn to read, and comprehend. It's not a white space fix, it fixes a bug.

Like I said "please squash" because I'd done my bit quickly via github's web interface which doesn't allow me to squash as the project settings need to allow that (apparently). This is a trivial change, I did the "work" in fixing the bug and testing it and finding out it affected others.

Your bellyaching that you have to do "work" is simply ridiculous. I only tagged you as you had somewhat recent interaction with the file. But it was my misfortune that you, Roland, are an arrogant and maladjusted individual.

rck commented 8 months ago

closing this nonsense now, will apply my proposed patch after the next release

tux2bsd commented 8 months ago

@rck you're more pathetic than I could imagine.

rck commented 8 months ago

happy holidays to you as well :partying_face: