Dev Week -- How do I fix an Ubuntu bug? - Daniel Holbach -- Thu, Sep 4

(01:00:06 PM) dholbach: Hello everybody! Welcome to another "How to fix an Ubuntu bug" session!
(01:00:12 PM) dholbach: Who's here for the session?
(01:00:16 PM) techno_freak: \o
(01:00:18 PM) tacone: \o
(01:00:24 PM) pwnguin: o/
(01:00:24 PM) ara: \o
(01:00:31 PM) pmatulis: \o
(01:00:44 PM) Kurt: o/
(01:00:49 PM) fredre: \o
(01:00:55 PM) swingnjazz: \o
(01:00:59 PM) dholbach: Can you quickly state which version of Ubuntu you're on and just mention if you have a slow connection?
(01:01:22 PM) Kurt: hardy, fast
(01:01:29 PM) techno_freak: hardy - medium fast
(01:01:36 PM) swingnjazz: Hardy, medium
(01:01:38 PM) acemo: oh darn session starting already? hope i dont miss too much.. i have to go and get my linux comp here..
(01:01:39 PM) xander21c: Hardy, medium
(01:01:43 PM) fredre: hardy  medium
(01:01:54 PM) acemo: 8.04, fast
(01:02:06 PM) dholbach: Hang on... I recognise a few names, who was NOT in the last "How do I fix an Ubuntu bug" session?
(01:02:14 PM) dholbach: (on Tuesday)
(01:02:14 PM) huats: o/
(01:02:19 PM) acemo: \o
(01:02:20 PM) xander21c: o/
(01:02:22 PM) ara: intrepid, fast
(01:02:26 PM) fredre: o/
(01:02:29 PM) chombium: 0/ hardy, fast
(01:02:34 PM) pwnguin: o/ (but i think i can keep up ;)
(01:02:48 PM) dholbach: alright... let's get the preparations out of the way, because some of the commands might take a bit to finish
(01:02:56 PM) dholbach: Please run:
(01:02:57 PM) dholbach:   sudo apt-get install debhelper cdbs pbuilder build-essential
(01:03:13 PM) dholbach: this should install a few packages that we need during this session
(01:03:50 PM) dholbach: we're going to set up pbuilder, which is an awesome tool to test if a package builds in a clean, minimal environment (this will take a bit)
(01:04:13 PM) dholbach: please create a file called  ~/.pbuilderrc
(01:04:23 PM) dholbach: and add at least this to it:
(01:04:28 PM) dholbach: COMPONENTS="main restricted universe multiverse"
(01:04:36 PM) dholbach: then please run
(01:04:37 PM) dholbach:   sudo pbuilder create
(01:04:51 PM) dholbach: which will bootstrap a minimal environment for build purposes
(01:04:59 PM) dholbach: <techno_freak> QUESTION: Can we setup pbuilder for Intrepid being in Hardy? if yes, can we do it today as many are in hardy?
(01:05:40 PM) dholbach: techno_freak: yes, as you like it - it's explained on and there's a nice wrapper tool called pbuilder-dist in ubuntu-dev-tools to help with that too
(01:05:55 PM) dholbach: for our examples here it shouldn't matter, I tested both examples to work in both hardy and intrepid
(01:06:02 PM) techno_freak: ok :)
(01:06:22 PM) dholbach: Next I'd like you to add a few environment variables which will make our lives easier
(01:06:37 PM) dholbach: Please edit  ~/.bashrc  (or similar if you use a different shell)
(01:06:49 PM) dholbach: and add something along the lines of:
(01:06:51 PM) dholbach: export DEBFULLNAME='Daniel Holbach'
(01:06:51 PM) dholbach: export DEBEMAIL=''
(01:07:07 PM) dholbach: if you haven't set a sensible editor, you can do that by adding something like:
(01:07:08 PM) dholbach: export EDITOR=vim
(01:07:16 PM) dholbach: (your choice... whatever... :-))
(01:07:24 PM) dholbach: afterwards, please run
(01:07:29 PM) dholbach:   source ~/.bashrc
(01:07:46 PM) dholbach: OK, pbuilder should be setting itself up and we're ready to go.
(01:08:10 PM) dholbach: Some weeks ago I started hacking on a web service called Harvest.
(01:08:41 PM) dholbach: Harvest's only use is: get low-hanging fruit from various data sources and display it in your browser per source-package
(01:08:44 PM) dholbach: the URL is
(01:09:01 PM) dholbach: the HTML pages are very very long
(01:09:08 PM) dholbach: so let's fast-forward to
(01:09:24 PM) dholbach: this will just show the "opportunities" for gedit-plugins
(01:09:52 PM) dholbach: two are called "resolved-upstream" which means as much as "bugs that have been filed for Ubuntu, were forwarded to the Upstream developers, fixed there, but not yet in Ubuntu"
(01:10:20 PM) dholbach: the other opportunity is called "patches" which simply means: somebody attached a patch to one of the gedit-plugins' bug reports and the bug's not closed yet
(01:10:38 PM) dholbach: Let's take the 155327 opportunity
(01:10:41 PM) dholbach:
(01:10:43 PM) ubot5: Launchpad bug 155327 in gedit-plugins "Embedded Terminal: wrong gconf key" [Undecided,New]
(01:11:05 PM) dholbach: I hope you let me know if you run into problems or I don't make sense.... right?
(01:11:34 PM) dholbach: Ok... the bug report seems to make sense and the patch is relatively small.
(01:11:56 PM) dholbach: Please now run:
(01:12:00 PM) dholbach:   dget
(01:12:17 PM) dholbach: which will retrieve the source package
(01:12:54 PM) dholbach: You will notice that it has downloaded a .orig.tar.gz, a .diff.gz and a .dsc file
(01:13:22 PM) dholbach: I won't go into too much detail, just let you know that .orig.tar.gz is the unmodified tarball that was released by the software authors on their homepage
(01:13:41 PM) dholbach: the .diff.gz the compressed patch we need to apply to make gedit-plugins build our way
(01:13:48 PM) dholbach: and the .dsc file contains some meta-data
(01:14:07 PM) dholbach: please run
(01:14:16 PM) dholbach:   dpkg-source -x gedit-plugins_2.22.2-1.dsc
(01:14:20 PM) dholbach: which will extract the source package
(01:14:32 PM) dholbach: (dget -x .... would have given us the short cut)
(01:14:43 PM) dholbach: <mnemo> QUESTION: is this "dget" command the same as doing apt-get source blah but getting some other version?? And also, what command should we use for real bug fixing? we should point to some intrepid .dsc file right??
(01:15:24 PM) dholbach: mnemo: yes, "dget -x URL" would be essentially the same as "apt-get source ..." - I just wanted to make sure we all work on the same source package and nobody has to set up their   deb-src line   in /etc/apt/sources.list
(01:15:33 PM) dholbach: <riot_le1> QUESTION: is the -x Flag only the Command for Extract?
(01:15:44 PM) riot_le1 is now known as riot_le
(01:15:44 PM) fredre: ls
(01:15:59 PM) dholbach: riot_le1: exactly, it was my intent to talk a bit about the individual parts of the source package before dive into it :)
(01:16:36 PM) dholbach: Ok, now please download the patch from the bug report and save it to some place you're going to remember
(01:16:58 PM) dholbach: the patch author was nice enough to mention "debian/patches" in the bug report
(01:18:03 PM) dholbach: I won't go into too much detail about patch system (there was an excellent session about that last night), but it essentially means that patches are not directly applied to the source package itself, but stored in the debian/patches directory and applied during the build
(01:18:35 PM) dholbach: this has the advantage that if you can put separate patches into separate files and just "add the debian/ directory to the source package"
(01:18:50 PM) dholbach: it has disadvantages, but this should not be part of this session :-)
(01:19:06 PM) dholbach: anyway... let's first try to see if the patch still applies - the bug was filed in 2007-10-21
(01:19:30 PM) dholbach:   cd gedit-plugins-2.22.2
(01:19:50 PM) dholbach:   patch -p1 < /wherever/you/saved/the/patch/01_terminal_correct_gconf_key
(01:19:59 PM) dholbach: if that works fine, let's unapply it again
(01:20:03 PM) dholbach:   patch -p1 -R < /wherever/you/saved/the/patch/01_terminal_correct_gconf_key
(01:20:23 PM) dholbach: I just got a small warning
(01:20:29 PM) dholbach: <mnemo> QUESTION: Why is this "patch system" used? Why queue the patches un-applied instead of merging them into the code once the patch arrived to debian?
(01:20:45 PM) metrofox: salve
(01:21:15 PM) dholbach: mnemo: the main reason for this is separating patches into separate files, that you can easily drop if the upstream developers decide to accept one of your patches in a new upstream version, but not the others
(01:21:16 PM) dholbach: etc
(01:21:44 PM) dholbach: alright, now that we know the patch applies, let's put it into debian/patches
(01:21:54 PM) dholbach: debian/patches does not exist yet, so let's create it
(01:21:58 PM) dholbach:   mkdir debian/pathces
(01:22:06 PM) dholbach:   cp /wherever/you/saved/the/patch/01_terminal_correct_gconf_key debian/patches
(01:22:13 PM) metrofox: are there any italians here?
(01:22:26 PM) dholbach: metrofox: please ask questions in #ubuntu-classroom-chat - thanks
(01:22:50 PM) dholbach: ok, now that we have the patch in place, let's document what we did
(01:22:51 PM) dholbach: please run
(01:22:53 PM) dholbach:   dch -i
(01:23:09 PM) dholbach: this should now use your name, your email address and your favourite editor
(01:23:24 PM) Wiebren: Hi
(01:23:47 PM) dholbach: the changelog has a very strict format, but luckily  dch  did quite some work for us already
(01:24:05 PM) dholbach: we'll just add a small note saying what we did and why
(01:24:10 PM) dholbach: I'll add something like
(01:25:20 PM) dholbach:   * debian/patches/01_terminal_correct_gconf_key: add patch by Sevenissimo <email address here> to let the terminal plugin use the right gconf key. (LP: #155327)
(01:25:52 PM) dholbach: It's very important you document each and every change you make in a source package properly
(01:26:09 PM) dholbach: We maintain all packages as one big team and you wouldn't want to have to guess why a certain change was made either :)
(01:26:21 PM) dholbach: I specifically pointed out the following:
(01:26:26 PM) dholbach:  - files I changed
(01:26:37 PM) dholbach:  - credited the patch author (as good as I could)
(01:26:43 PM) dholbach:  - explained the use of the patch
(01:26:53 PM) dholbach:  - mentioned the bug report with the full discussion for reference
(01:27:10 PM) dholbach: The great thing about (LP: #155327) is, that it will close the bug automatically on upload. :-)
(01:27:38 PM) dholbach: OK
(01:27:49 PM) dholbach: now please save the file, then run:
(01:27:53 PM) dholbach:   debuild -S -uc -uc
(01:28:21 PM) dholbach: (-S will generate a new source package, -us -uc will avoid having to sign it)
(01:28:54 PM) dholbach: Now run:
(01:28:56 PM) dholbach:   cd ..; ls
(01:29:09 PM) dholbach: and you will notice that you now have two .diff.gz files and two .dsc files
(01:29:23 PM) dholbach: which means that we updated the .diff.gz for the new revision we just created
(01:29:52 PM) dholbach: <techno_freak> QUESTION: Error= make: *** No rule to make target `/usr/share/gnome-pkg-tools/1/rules/'.  Stop. dpkg-buildpackage: failure: fakeroot debian/rules clean gave error exit status 2
(01:30:10 PM) dholbach: techno_freak: ooops... please install gnome-pkg-tools too
(01:30:16 PM) dholbach: this specific package requires it - sorry
(01:30:19 PM) techno_freak: ok
(01:30:41 PM) dholbach: Once that's done, please run:
(01:31:10 PM) dholbach:   debdiff gedit-plugins_2.22.2-{1,2}.dsc  > gedit-plugins.debdiff
(01:31:40 PM) dholbach: Now if you could paste the contents of your gedit-plugins.debdiff file into and paste the link here, I'll review it :-)
(01:32:46 PM) dholbach: in the meantime, I'll answer this question:
(01:32:56 PM) dholbach: <mnemo> QUESTION: there is so many strange commands and scripts needed for packaging/development... have you considered making a usability analysis of this dev process and then trying to simple it??
(01:33:43 PM) takdir:
(01:34:46 PM) dholbach: mnemo: there are several thousands packages with different maintainers who choose different toolsets for different reasons. What you need to bear in mind: the Debian/Ubuntu build process is already a huge simplification of the build scenarios: we apply ONE build process to all kinds of software (being it PHP, Perl, Python, C++, etc.)
(01:35:53 PM) dholbach: takdir: it seems you didn't unapply the patch afterwards
(01:36:08 PM) dholbach:   patch -p1 -R < /wherever/you/saved/the/patch/01_terminal_correct_gconf_key
(01:36:24 PM) techno_freak:
(01:37:42 PM) Kurt:
(01:37:53 PM) dholbach: sorry, I made a mistake before, it's:
(01:38:03 PM) dholbach:   debdiff gedit-plugins_2.22.2-1{,ubuntu1}.dsc  > gedit-plugins.debdiff
(01:38:06 PM) dholbach: sorry for that
(01:38:10 PM) tacone:
(01:38:27 PM) riot_le:
(01:39:12 PM) dholbach: they all look quite good, I just wonder why I too get the plugins/terminal/ change inline
(01:39:17 PM) riot_le: i take this one: debdiff gedit-plugins_2.22.2-{1,1ubuntu1}.dsc > gedit-plugins.debdiff
(01:39:22 PM) dholbach: and where the debian/control changes come from
(01:39:41 PM) takdir:
(01:40:09 PM) dholbach: ah ok... I found out about debian/control change - the description gets automatically created from the .desktop files in the package
(01:40:42 PM) dholbach: takdir, riot_le, Kurt, tacone, techno_freak: all looking good, thanks :-)
(01:40:48 PM) dholbach: now let's try to build it
(01:41:05 PM) dholbach: Please run
(01:41:14 PM) dholbach:   sudo pbuilder build gedit-plugins_2.22.2-1ubuntu1.dsc
(01:41:38 PM) dholbach: This will also take a while, so what would happen next?
(01:41:56 PM) dholbach:  - we'd thoroughly test the resulting packages that pop up in /var/cache/pbuilder/result
(01:42:06 PM) geser: dholbach: is there a reason why you didn't update the Maintainer field?
(01:42:24 PM) dholbach: geser: forgot about it
(01:42:29 PM) dholbach: geser is raising a very good point
(01:42:55 PM) dholbach: if you all install ubuntu-dev-tools you will get a nice script called update-maintainer (among other useful tools)
(01:43:21 PM) dholbach: this script will change the Maintainer field in debian/control from the Debian maintainer to an Ubuntu team (still preserving the Original maintainer)
(01:43:33 PM) dholbach: this was decided by our Friends at Debian to avoid confusion for our users
(01:43:42 PM) dholbach: you just need to run it, it will do all the work for you
(01:43:44 PM) dholbach: thanks geser
(01:44:01 PM) dholbach: still... what happens after the successful build and successful testing?
(01:44:23 PM) dholbach: If you're confident in the changes, you will attach the bug to the bug report
(01:44:41 PM) dholbach: and get the patch through the Sponsorship Process
(01:44:41 PM) riot_le: it takes a long time to build?
(01:44:44 PM) dholbach:
(01:45:00 PM) dholbach: riot_le: it might take a bit to get all the build-dependencies of the package and install them in the chroot
(01:45:24 PM) dholbach: sponsoring means: somebody who has upload privileges already will sign the source package with their GPG key and upload it to the build machines for you
(01:45:39 PM) dholbach: of course it will be properly reviewed before the upload :-)
(01:45:48 PM) dholbach: Any other questions up until now?
(01:46:18 PM) dholbach: Alright... shall we try to do a quick other one?
(01:46:21 PM) dholbach: :-)
(01:46:21 PM) takdir: my connection is too slow. Need to get 56.9MB of archives :(
(01:46:29 PM) dholbach: Let's head to:
(01:46:37 PM) dholbach: takdir: no worries, let it finish the build in the background
(01:46:51 PM) dholbach: grandr has just one opportunity open, a small patch
(01:46:57 PM) dholbach:
(01:46:58 PM) ubot5: Launchpad bug 203026 in grandr "grandr does not exit, if "x" is clicked" [Undecided,New]
(01:47:13 PM) dholbach:   dget -x
(01:47:29 PM) dholbach: and download the patch to a place you'll remember
(01:47:42 PM) dholbach: the patch is relatively small and should be pretty easy to test
(01:48:23 PM) dholbach:   cd grandr-0.1+git20080326
(01:48:44 PM) dholbach: a quick examination of the package will tell us that it does not use any patch system
(01:48:54 PM) dholbach: a quick
(01:49:04 PM) dholbach:   grep ^Build-Depends debian/control
(01:49:16 PM) dholbach: should give us that information usually
(01:49:22 PM) dholbach: (no dpatch, no cdbs, no quilt, etc)
(01:49:30 PM) dholbach: so let's try to apply the patch directly to the source
(01:50:16 PM) dholbach:   patch -p1 < /some/place/you/saved/the/patch/to/grandr_exit_on_close.patch
(01:50:26 PM) dholbach: in my case it applied successfully
(01:50:33 PM) dholbach: now we'll run
(01:50:37 PM) dholbach:   update-maintainer
(01:50:38 PM) dholbach: again
(01:50:52 PM) dholbach: sorry
(01:50:56 PM) dholbach: edit the changelog entry first
(01:50:57 PM) dholbach: so
(01:50:59 PM) dholbach:  dch -i
(01:51:34 PM) dholbach: any suggestions for the changelog entry? just the line we're about to add?
(01:52:50 PM) dholbach: ok... if not, that's fine, I used something like this:
(01:53:21 PM) dholbach:   * src/interface.c: applied patch by Stefan Ott to make the program exit after clicking on the "close" button (LP: #203026)
(01:53:34 PM) dholbach: <Kurt> QUESTION: Should we also put in the changelog that we are updating the maintainer?
(01:54:14 PM) dholbach: Kurt: good you're asking - a lot of people did until recently where we decided "hang on, we have to do this EVERY TIME we change a package from Debian, let's stop doing that...."
(01:54:17 PM) dholbach: we felt it's obvious
(01:54:27 PM) dholbach: so just add that comment to the changelog, save it and run
(01:54:31 PM) dholbach:   update-maintainer
(01:54:38 PM) dholbach: then run
(01:54:41 PM) dholbach:   debuild -S -uc -uc
(01:55:13 PM) dholbach:   debdiff grandr_0.1+git20080326-1{,ubuntu1} > grandr.debdiff
(01:55:29 PM) dholbach: if you want me to review it, give me the link to your pastebin entry :)
(01:55:57 PM) dholbach:   sudo pbuilder build grandr_0.1+git20080326-1ubuntu1.dsc
(01:56:02 PM) dholbach: will test-build the resulting package for you
(01:56:26 PM) dholbach: any questions?
(01:56:39 PM) dholbach: one thing the reviewers might ask you to do is: forward the fix upstream
(01:56:59 PM) dholbach: this means either Debian or the software authors, so we can drop the diff eventually again
(01:57:09 PM) riot_le: yes, whats with more complex bugs? this seems so easy
(01:57:33 PM) dholbach: riot_le: you live you learn :-)
(01:57:44 PM) dholbach: #ubuntu-motu is a place where friendly people will always try to help you
(01:57:54 PM) dholbach: also there's
(01:58:04 PM) dholbach: and
(01:58:09 PM) dholbach: that references a lot of other helpful documents
(01:58:23 PM) dholbach: you don't need to be a hardcore assembler hacker to start helping out with Ubuntu
(01:58:45 PM) dholbach: making Ubuntu better is easy and you can slowly improve your skills and learn something new every day :)
(01:58:53 PM) dholbach: <jrib> QUESTION: "debuild -S -uc -uc"       that's not really supposed to be "-uc" twice correct?
(01:59:01 PM) dholbach: jrib: yes, once should be good enough :)
(01:59:50 PM) dholbach: thanks a lot everybody, you've been fantastic
(02:00:06 PM) dholbach: I'd love to see all your names connected to Ubuntu Development soon and hear from you again
(02:00:12 PM) dholbach: hope you enjoy the ride!
(02:00:13 PM) dholbach: Thanks

MeetingLogs/devweek0809/FixingBugs2 (last edited 2008-09-05 04:19:26 by pool-68-238-87-204)