mintUpdate does not show ChangeLog of package when behind a proxy

Bug #1335116 reported by Erik Devriendt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linux Mint
Fix Released
Undecided
Unassigned

Bug Description

A http proxy server is configures in synaptic/Network as well as in the Network Proxy in Control Center of Mint 17.
mintUpdate can update the package list and download the packages, but cannot show the ChangeLog of the packages.

Revision history for this message
Vlad Orlov (monsta) wrote :

Can you check whether your system has the environment variables named *_proxy (e.g. http_proxy) set?

Changed in linuxmint:
status: New → Confirmed
Revision history for this message
Vlad Orlov (monsta) wrote :

Erik, Mint developers might start working on this soon, and if there's no answer, we can't test this...

Revision history for this message
Clement Lefebvre (clementlefebvre) wrote :

Proxy support was added to changelog retrieval in the following commit:

https://github.com/linuxmint/mintupdate/commit/230ba7fb53ac1826da1f5e979a9de5a9beb30780

Please test mintupdate from git master and let us know if you still encounter issues.

Changed in linuxmint:
status: Confirmed → Fix Released
Revision history for this message
Erik Devriendt (erik-devriendt) wrote :

> Can you check whether your system has the environment variables named *_proxy (e.g. http_proxy) set?

These environment variables are not set, i.e. 'env | grep _proxy' executed in a terminal retuns the empty string.

Revision history for this message
Erik Devriendt (erik-devriendt) wrote :

> Please test mintupdate from git master and let us know if you still encounter issues.

Is there a deb-package to download somewhere, or is using git the only way to get a runnable copy of mintUpdate?

Revision history for this message
Clement Lefebvre (clementlefebvre) wrote :

Erik: You need to use git.

apt install git
mkdir Sandbox
cd Sandbox
git clone https://github.com/linuxmint/mintupdate.git
cd mintupdate
./test

or to make a package and install it.. add the Source repositories using mintsources and run:

apt update
apt build-dep mintupdate
apt install git dpkg-dev debhelper
mkdir Sandbox
cd Sandbox
git clone https://github.com/linuxmint/mintupdate.git
cd mintupdate
dpkg-buildpackage
sudo dpkg -i ../*.deb

Revision history for this message
Erik Devriendt (erik-devriendt) wrote :

It appears that my answer in Comment #4 was not correct. I do have http_proxy and no_proxy variables set in the shell.
These are probably caused by setting these Network Proxy in Control Center, al least, that would be logical.

I tested the new mintupdate by following the recipe in comment #6 for creating a package and installing it (appears to be version 4.6.8).

My results:

a. when starting mintupdate from the command line, I obtain the right information in the ChangeLog tab.

b. However, when I start mintupdate from the Control Center, or by logging out and then back in and then clicking the icon in the task bar, the ChangeLog tab only shows "No changelog available".

Could it be that when starting from the command line, mintupdate takes the *_proxy variables into account, but when it is started from login or control center, these environment variables are not yet set?

Anyhow, I would expect that mintupdate takes the values configured in Network Proxy into account since it is a program specific for Linux Mint, as is the Control Center.

Changed in linuxmint:
status: Fix Released → Confirmed
Revision history for this message
Erik Devriendt (erik-devriendt) wrote :

I am not a python specialist, but on reading the source code of mintUpdate.py I noticed that the proxy methods of python module urllib2 are used.
The source code of urllib2.py shows that it uses the environment variables '*_proxy' to initialize its proxies.

This explains why mintUpdate works when started in a terminal when the *_proxy environment variables are set.
I use MATE desktop and mate-terminal sets the *_proxy environment variables finding them in the GSettings org.gnome.system.proxy.* .

However, mintUpdate (as well as mintMenu) are started by mate-session which does NOT take the GSettings org.gnome.system.proxy.* into account (why would it, it is an X session manager, not some kind of network manager).

This explains why mintUpdate started by mate-session (or cinnamon-session) or by mintMenu cannot download the ChangeLog: they don't take the proxy settings into account.

From my naive point of view, I see at least two possible solutions in mintUpdate:
1. duplicate the logic in mate-terminal or gnome-terminal by reading the GSettings org.gnome.system.proxy.* and setting the evnironment variables accordingly before calling methods of urllib2
2. switch to libproxy (for which there is a python wrapper in package python-libproxy.

Revision history for this message
Vlad Orlov (monsta) wrote :

I wonder why mate-terminal reads org.gnome.* and not org.mate.* O_o

Revision history for this message
Vlad Orlov (monsta) wrote :

Erik, using libproxy sounds like a simple plan, given the information in their wiki (http://code.google.com/p/libproxy/wiki/HowTo - section "Python"). That is, if it indeed works the way stated by its developers.

Can you write an example Python script like the one shown in that page, and test it both in terminal and without it?
It might even be a simple PyGTK app (see http://www.pygtk.org/pygtk2tutorial/ for a tutorial) to imitate mintUpdate better.

Revision history for this message
Erik Devriendt (erik-devriendt) wrote :

Another possible solution is copying the code from
/usr/lib/python2.7/dist-packages/ubuntu-sso-client/ubuntu_sso/utils/webclient/gsettings.py
The python code in that module uses the command 'gsettings' to read the 'org.gnome.system.proxy' settings and then extracts the proxy definitions from it.

Revision history for this message
Vlad Orlov (monsta) wrote :

Would that be better than using libproxy?

Revision history for this message
Erik Devriendt (erik-devriendt) wrote :

I tried to extend mintupdate with libproxy, but this library crashes when called from a separate Python thread on a 64-bit machine.

I created an issue for this crash : https://code.google.com/p/libproxy/issues/detail?id=212

I don't have the skills to solve that bug myself.

If libproxy doesn't work on 64-bit machines then it is of not much value for mintupdate. More and more machines are 64-bit.

Revision history for this message
Erik Devriendt (erik-devriendt) wrote :

All right. Since the libproxy project seems to be more or less dead for the moment, I tried the other option: use code from /usr/lib/python2.7/dist-packages/ubuntu-sso-client/ubuntu_sso/utils/webclient/gsettings.py as mentioned in comment #11.

You can find the result of my tinkering in attached patch file.

Please note that I am not a python developer. I am totally ignorant of any python naming conventions, so you might need to make some adjustments.

This patch seems to work in my situation.
It can handle manually specified proxies. It cannot, however, handle automatically defined proxies, e.g. those based on PAC scripts.

Revision history for this message
Vlad Orlov (monsta) wrote :

Hi Erik,

Sorry, been busy with some other bugs and haven't got time to test that (and I don't have any proxies around).
I think you need to talk to Clem about it. If you're familiar with IRC, join #linuxmint-dev at irc.spotchat.org - this is the Mint dev channel.

Revision history for this message
Vlad Orlov (monsta) wrote :

Ok, I've filed a pull request with your changes, Clem will test it when he'll have the time.

Revision history for this message
Clement Lefebvre (clementlefebvre) wrote :

Merged.

Revision history for this message
Clement Lefebvre (clementlefebvre) wrote :

Successfully tested.

Changed in linuxmint:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.