[Closed] mintUpdate - why urlopen() before ping is needed

Questions about applications and software
Forum rules
Before you post please read how to get help

[Closed] mintUpdate - why urlopen() before ping is needed

Postby karlchen on Sun Nov 10, 2013 7:11 pm

Hello, Clem.

Foreword:
This is not an attempt to continue discussing whether it is evil to contact Google.com in order to make sure an internet connection is available.
This post is intended to explain why the command urlopen("<name of website>") must not be removed from mintupdate.py.

References:

In your reply you wrote that you could not remember why the initial command
Code: Select all
url=urlopen("http://google.com")
had been kept.
Well, I can tell you why. :wink: And I can tell why the address may be changed using the address got from the mintupdate dialog box (prefs["ping_domain"]), but why the whole code block is needed :idea: :
Code: Select all
try:
            from urllib import urlopen
            url=urlopen("prefs["ping_domain"]") <== what ever the right python code will be to get it there, prefixed with http://
            url.read()
            url.close()
            log.writelines("++ Connection to the Internet successful (tried to read http://www.google.com)\n")


Why it is there and why it needs to stay:
  • urlopen("<name of website>") can be used no matter whether the user is connected through a DSL router or through a proxy.
  • if os.system("ping " + prefs["ping_domain"] + " -c1 -q"): can be used from my home machine connected through a DSL router.
    But our company proxy server e.g. will discard ping commands to the internet making the command always fail.
  • Consequence:
    Currently mintupdate succeeds on my office machine, because urlopen("<name of webpage>") will pass the proxy.
    With the suggested fix mintupdate will always fail on any machine behind a proxy that drops ping commands.
  • Conclusion:
    The proper fix will be to keep the code block, but to make sure it uses "http://" + prefs["ping_domain"]" instead of "http://google.com".
Sorry to open a new thread for this. But the old one has been locked. And I did not feel like registering with Github just to make this post, in particular as my nickname is already in use and my alternative nickname as well. Never mind. If I wish to register there will be another nickname.

Kind regards,
Karl
Last edited by karlchen on Mon Jan 20, 2014 5:50 am, edited 1 time in total.
User avatar
karlchen
Level 12
Level 12
 
Posts: 4159
Joined: Sat Dec 31, 2011 7:21 am

Linux Mint is funded by ads and donations.
 

Re: mintUpdate - why urlopen() before ping is needed

Postby Mohr on Mon Nov 18, 2013 8:44 am

Too bad this is seemingly not relevant for clem. :|
Mohr
Level 2
Level 2
 
Posts: 56
Joined: Thu Nov 08, 2012 4:49 am

Re: mintUpdate - why urlopen() before ping is needed

Postby Mohr on Sun Jan 19, 2014 4:30 pm

As time passes by and there are - as far as I can see - no people with problems, what's your conclusion?
Mohr
Level 2
Level 2
 
Posts: 56
Joined: Thu Nov 08, 2012 4:49 am

[Closed] mintUpdate - why urlopen() before ping is needed

Postby karlchen on Mon Jan 20, 2014 5:29 am

Hello, Mohr.

Currently my office machine runs on Mint 13. Yet, it quite seems as if the changed script /usr/lib/linuxmint/mintUpdate/mintUpdate.py (30-Nov-2013) has made its way onto this machine as well.
Checking the daily logfile /tmp/mintUpdate/jzrs2J (the filename is random and will change on each Mint reboot) reveals this:
++ Launching mintUpdate in user mode
++ Testing initial connection
-- No connection found (tried to ping google.com) - sleeping for 30 seconds
OK, this confirms that our proxy will not pass through ping packets.
Yet then the logfile goes on
++ Starting refresh
++ Auto-refresh timer is going to sleep for 15 minutes, 0 hours and 0 days
++ System is up to date
++ Refresh finished
++ MintUpdate is in tray mode, performing auto-refresh
++ Starting refresh
++ Auto-refresh timer is going to sleep for 15 minutes, 0 hours and 0 days
++ System is up to date
++ Refresh finished
This suggests that although the initial test whether the internet were available failed, mintUpdate does not really care about the failed try and later on regularly checks for updated software lists nonetheless.
OK, this suggests, too, that I will have to check more carefully, why mintUpdate correctly decides to carry on instead of giving up because pinging google.com failed.

Summary:
Hm, if the modified verification procedure does not make mintUpdate fail behind company proxies, there is no need to complain. And we may consider this case closed.


Kind regards,
Karl
User avatar
karlchen
Level 12
Level 12
 
Posts: 4159
Joined: Sat Dec 31, 2011 7:21 am

Re: [Closed] mintUpdate - why urlopen() before ping is neede

Postby Mohr on Thu Jan 23, 2014 12:21 pm

Thank you!
I would have been happy if your idea would have been correct. :(

But ... now all what remains as an explanation again is Clems "I don't know / I forgot" about why to insert "Google.com" hardcoded in the script and add another strange feature like the "15 min" - default request, which is a wonderful tracking feature for a datacraken.
Mohr
Level 2
Level 2
 
Posts: 56
Joined: Thu Nov 08, 2012 4:49 am


Return to Software & Applications

Who is online

Users browsing this forum: cyb3rc0de, Google [Bot] and 18 guests