Installation Error

The place to discuss linux version of MakeMKV
Post Reply
Sunrider
Posts: 1
Joined: Mon Jul 03, 2023 11:36 pm

Installation Error

Post by Sunrider »

Well, not sure where I messed up, or how to fix it, but here I am.
Authentication failed to initialize
CAN'T_LOCATE_MAKEMKVCON

Any ideas?

BTW, I'm a long-time Leawo user just come to Linux. All roads and many recommendations have brought me here.
Bob
SquarePeg
Posts: 2
Joined: Wed Jan 04, 2023 4:50 pm

Re: Installation Error

Post by SquarePeg »

What distro are you using? I've been using OpenSUSE Tumbleweed for a long time and just had to do a fresh install, after trying to install the previous way I've found the only way I can install it now is using the Flatpak.
jvian1
Posts: 16
Joined: Thu May 19, 2016 1:09 am

Re: Installation Error

Post by jvian1 »

Was your error similar to mine above?
viewtopic.php?f=3&t=31488
NullNix
Posts: 25
Joined: Sat Jan 31, 2015 12:57 pm

Re: Installation Error

Post by NullNix »

I see this too. It happens on distros like Nix (no relation to me :) ) where the makemkvcon and makemkv binaries are in different directories (usually with contents symlinked to /usr/bin). makemkv by default looks for the makemkvcon binary purely in the same directory as the makemkv binary, but can be coerced with a one-byte code change to do a crude but (barely) adequate path search for the binary in /bin, /usr/bin and /usr/local/bin: but even then it requires that the binary not be a symlink, which *again* breaks Nix and similar distros (like Guix).

I don't know why people persist in doing things like this rather than just using execvp(): it's not even reliable, as there are many reasons execve() or posix_spawn() can fail other than merely the file type being wrong (wrong architecture, ACLs, SELinux rules, etc), and you can perfectly well execute things that aren't regular files (such as symlinks, as here).

Best fixed by just using path searches for attempts to execute binaries with no path (like "makemkvcon"), which is literally a matter of calling posix_spawnp() in the appropriate place: to minimize risk we do it only if the binary name doesn't contain a slash, so execution using absolute paths and even relative paths don't do a path search (as now). The existing handrolled hardwired path search can be torn out later on: this is enough to make it work again.

Trivial patch against makemkv-oss 1.17.4:

Code: Select all

Index: 1.17.4/makemkvgui/src/api_posix.cpp
===================================================================
--- 1.17.4.orig/makemkvgui/src/api_posix.cpp	2023-05-29 22:06:31.000000000 +0100
+++ 1.17.4/makemkvgui/src/api_posix.cpp	2023-07-28 15:02:00.713239038 +0100
@@ -82,28 +82,8 @@
         {
             return -4;
         }
-    } else {
-        char*   p;
-        int     app_len;
-
-        app_len = SYS_posix_getmyname(app_path,(int)(sizeof(app_path)-1));
-        if (app_len<=0)
-        {
-            return -2;
-        }
-        app_path[app_len]=0;
-        p=app_path+app_len;
-        while(p!=app_path)
-        {
-            if(*p=='/')
-            {
-                p++;
-                break;
-            }
-            p--;
-        }
-        strcpy(p,AppName);
-    }
+    } else 
+        strcpy(app_path, AppName);
 
     strcpy(str_guiserver,"guiserver");
 
Index: 1.17.4/makemkvgui/src/spawn_posix.cpp
===================================================================
--- 1.17.4.orig/makemkvgui/src/spawn_posix.cpp	2023-05-29 22:06:31.000000000 +0100
+++ 1.17.4/makemkvgui/src/spawn_posix.cpp	2023-07-28 15:05:02.313416368 +0100
@@ -21,6 +21,7 @@
 #include <sys/mman.h>
 #include <fcntl.h>
 #include <sys/time.h>
+#include <cstring>
 #include <stdio.h>
 #include <spawn.h>
 #include <lgpl/sysabi.h>
@@ -100,7 +101,10 @@
         }
     }
 
-    err = posix_spawn(&pid,argv[0],&spawn_actions,&spawn_attr,argv,envp);
+    if (strchr(argv[0], '/') != NULL)
+        err = posix_spawn(&pid,argv[0],&spawn_actions,&spawn_attr,argv,envp);
+    else
+        err = posix_spawnp(&pid,argv[0],&spawn_actions,&spawn_attr,argv,envp);
 
     if (ppid)
     {
     
Post Reply