Bug 372144 - GitHub is never authorized Kubuntu 16.10 no crash
Summary: GitHub is never authorized Kubuntu 16.10 no crash
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Project provider: Github (show other bugs)
Version: 5.0.2
Platform: Appimage Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords: junior-jobs
Depends on:
Blocks:
 
Reported: 2016-11-06 15:54 UTC by David Oldford
Modified: 2017-04-07 12:31 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 5.0.3


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Oldford 2016-11-06 15:54:03 UTC
I've actually tried this on multiple versions of kdevelop including a 5.0.2 ppa a 5.0.1 ppa the current kubuntu version (4.7 something) and the appimage and I get the same behaviour. 

Steps:

Open kdevelop and select Project -> Fetch Project
Select Github from the dropdown
either search for your account or go straight to pressing the menu button to authorize (both will trigger the behaviour including if you select a repo from your account)
Click the authorize button
Enter your username and password (I am 100% sure that I am entering it correctly I copy and paste the password from a password manager and this works in my vm running kubuntu 16.04)
Authorization will fail


When running kdevelop from a terminal nothing appears on the terminal when authorization fails.

I also used kdebugdialog to enable debug output for kdevelop and checked .xsession-errors in my home directory and nothing appears from kdevelop when running through these steps. Not sure where else to look fro debug output. When kdevelop starts up github is not listed as loaded under help but is enabled in settings and if I try to authorize and then check help github is listed. Since it seems to work fine in my 16.04 vm I expect it is some sort of package incompatibility between the releases. My git version is 2.9.3 on the os that doesn't work and 2.7.4 in the vm where everything works.

As an interesting note this issue was preceded by a number of configuration issues that ended up ruining my .kde folder in my home directory and prompted me to clean up my OS install so I backed up my home directory wiped my boot and / partitions and did a totally new clean install of the latest kubuntu with a new clean home folder and the issue still remained with the stock package and the ppas I tried and the Appimage.
Comment 1 David Oldford 2016-11-06 16:19:53 UTC
I can't believe it took me this long and this many combinations and permutations to figure this out... I looked in my github settings and found the personal access tokens. There was one for kdevelop. I deleted it and then was able to authorize successfully on my main machine and not in my vm... It would appear that kdevelop always tries to use the same name for an access token and github doesn't like regenerating the same thing over and over again. I would be a corner case user who uses (or wants to use at this point :) ) kdevelop on multiple machines. It should be pretty easy to fix by adding the hostname and a nonce to the end of the token name when it is generated with github (I assume...).
Comment 2 Kevin Funk 2016-11-07 09:42:36 UTC
Thanks for the analysis, David! Marking this as a junior job, sounds like something a newbie to KDevelop development could work on. Patches welcome!

https://www.kdevelop.org/contribute-kdevelop
Comment 3 David Oldford 2016-11-07 12:21:29 UTC
No problem. 

BTW in my research I did find this https://bugs.kde.org/show_bug.cgi?id=360589 which I didn't think was a duplicate because it was on windows and it involved a crash but now that I figured out what has been happening on linux I figure at least part of that bug is based on the same thing and related memory handling could be causing the crash potentially.


If it's still unresolved after I finish a few papers and labs I might try my hand at it (though I am unfamiliar with the code base and have allowed an irresponsible number of papers and labs to build up :) ). 

The only real difficulty (aside from familiarity with kde and qt,) is balancing creating way too many tokens with not failing when someone has multiple installations of kdevelop or if they authorize and uninstall then reinstall (assuming the config is deleted). I think I'd just append the hostname and username to the token and ask the user how to proceed if there is already a token with the same name allowing them to customize the name if they want (I'd actually be a bit of a corner case here too as I dual boot and use the same host and usernames in each OS on the same physical machine).
Comment 4 David Oldford 2016-11-17 05:51:48 UTC
I just submitted a proposed patch for this https://phabricator.kde.org/D3395
Comment 5 Kevin Funk 2016-11-17 23:49:23 UTC
Git commit cc395b8fb25d6b3b7a6e8a3afa05eac51e91ae05 by Kevin Funk.
Committed on 17/11/2016 at 23:48.
Pushed by kfunk into branch '5.0'.

GitHub: Improve authentication handling

Make sure we create a unique token name per KDevelop session.

Initial patch by David Oldford, thanks! Split up the patch; bug fix goes
to 5.0, changes to user-visible strings go to master.
Related: bug 360589
FIXED-IN: 5.0.3

M  +3    -1    providers/ghprovider/ghdialog.cpp
M  +1    -1    providers/ghprovider/ghdialog.h
M  +16   -4    providers/ghprovider/ghresource.cpp
M  +5    -2    providers/ghprovider/ghresource.h

http://commits.kde.org/kdevelop/cc395b8fb25d6b3b7a6e8a3afa05eac51e91ae05