On Thu, Dec 1, 2016 at 12:14 PM, Peter Juhasz <pjuh...@uhusystems.com> wrote:
> On Wed, 2016-11-30 at 21:56 +0300, Devrim Gündüz wrote:
>> On Tue, 2016-11-29 at 10:42 +0100, Peter Juhasz wrote:
>> >
>> > I've removed the previous pgadmin4-* packages then installed the
>> > new
>> > ones.
>>
>> That is not enough -- can you please also delete the directories that
>> I
>> mentioned here?
>>
>> https://www.postgresql.org/message-id/1479206529.4684.18.camel%40gund
>> uz.org
>>
>> That error comes when these dirs are not removed. The previous
>> packages were
>> broken, and we need to get rid of all old stuff prior to installing
>> new ones.
>>
>> Regards,
>
> I've removed the package, deleted those directories, then reinstalled
> the package.
>
> It didn't solve the problem - as I expected it wouldn't.
>
> As I've explained in my previous email, the problem is that the runtime
> application never learns the location of the python server
> (pgAdmin4.py) in the first place because it doesn't load the config
> file.
>
> On Linux, the QSettings class searches for the application's config
> file in the following locations:
>
> $HOME/.config/$ORGANIZATION_NAME/$APP_NAME.conf
> $HOME/.config/$ORGANIZATION_NAME.conf
> /etc/xdg/$ORGANIZATION_NAME/$APP_NAME.conf
> /etc/xdg/$ORGANIZATION_NAME.conf
>
> in this order. For pgAdmin4, on my system, these translate to
>
> /home/pjuhasz/.config/pgAdmin Development Team/pgAdmin 4.conf
> /home/pjuhasz/.config/pgAdmin Development Team.conf
> /etc/xdg/pgAdmin Development Team/pgAdmin 4.conf
> /etc/xdg/pgAdmin Development Team.conf

We've found these locations seem to vary somewhat when testing with
strace. FYI, I tested the new RPMs on CentOS 7 before they were
published, and they work fine there - but I agree they're not working
on Fedora having since tested them there too.

> None of these exist so the application displays the error popup and
> crashes. (More precisely, it displays the popup at pgAdmin4.cpp:87, so
> it doesn't even get the chance to display the other popup where the
> user could give the correct application/python path.)
>
> At this point I'll reiterate more bluntly that application/directory
> names with spaces in them are ugly, look out of place and potential
> sources of error.

Agreed - blame Qt for that one. It builds the paths from the the
company and product names. I'm going to change what they are.

> The rpm package installs two files that could be candidates for config
> files:
>
> /usr/pgadmin4-v1/runtime/pgadmin.ini

That shouldn't be there.

> /etc/pgAdmin\ Development\ Team/pgAdmin4.conf
>
> The first one is never accessed at all, its contents are misleading, so
> it's apparently there to confuse the user.
>
> The second one is almost good, except it should go in /etc/xdg, not in
> /etc.

Yeah.

> Apparently the ApplicationPath setting must be a relative path,
> absolute paths don't work (because of a bug at Server.cpp:221 where the
> code just blindly concatenates the config's Application path to the
> runtime's own directory - if Application path is an absolute path, it
> should be used as is).

You're suggesting a fix such as this?

snake:pgadmin4 dpage$ git diff
diff --git a/runtime/Server.cpp b/runtime/Server.cpp
index 3a4c660..e631872 100644
--- a/runtime/Server.cpp
+++ b/runtime/Server.cpp
@@ -218,7 +218,13 @@ bool Server::Init()

     for (int i = 0; i < paths.size(); ++i)
     {
-        QDir dir(QCoreApplication::applicationDirPath() + "/" + paths[i]);
+        QDir dir;
+
+        if (paths[i].startsWith('/'))
+            dir = paths[i];
+        else
+            dir = QCoreApplication::applicationDirPath() + "/" + paths[i];
+
         m_appfile = dir.canonicalPath() + "/pgAdmin4.py";

         if (QFile::exists(m_appfile))

> So after you copy the config file to its expected position under
> /etc/xdg, the contents must be modified as well:
>
> [General]
> ApplicationPath=../../../../../usr/lib/python3.5/site-packages/pgadmin4-web
> PythonPath="/usr/lib64/python3.5/site-packages;/usr/lib/python3.5/site-packages"
>
> Note the five ..'s.
>
> Having done this, the pgadmin4 command finally works!
>
> I hope this helps.
>
> Best regards,
> Peter Juhasz
>
>
>
> --
> Sent via pgadmin-support mailing list (pgadmin-support@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-support



-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgadmin-support mailing list (pgadmin-support@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-support

Reply via email to