[packagekit] [PATCH] Fix aptcc backend behaviour on Ubuntu Natty

Colin Watson cjwatson at ubuntu.com
Mon Jan 24 09:43:07 PST 2011


PackageKit's aptcc backend is quite broken on current Ubuntu Natty, and
is resulting in lots of mysterious bug reports showing that some
package's postinst exited non-zero, with an empty apt terminal log.

  https://bugs.launchpad.net/bugs/680328

I investigated this with strace, and it turns out that the aptcc backend
is running apt code with no stdout - not merely duped to /dev/null, but
closed.  This is of course bound to go wrong somewhere.  If it worked
before, it was probably merely by chance (e.g. apt opened something
else, which happened to land on fd 1, and didn't care what was written
to it).  The first attached patch corrects this, and generally sanitises
file descriptor handling.

There was also a problem with locale handling, which broke certain
postinst scripts (the one that broke for me was python-gmenu) in any
environment where the various locale categories are not all set to the
same value.  There might be a few different ways to solve this (e.g.
marshalling lots of different locale categories across to the backend);
in the second attached patch, I opted for just using LC_MESSAGES, which
seems to match up reasonably well with how PK is actually using the
client locale, and is nice and simple.

Finally, the apt backend creates a pseudo-terminal so that apt can
produce a useful /var/log/apt/term.log, but the aptcc backend doesn't.
The third attached patch converts the input pipe to a pty.  I've
confirmed that conffile prompt handling works to the same extent it did
before (i.e. no useful prompt via PackageKit, but it notices the prompt
and successfully writes "N\n" to apt).

Thanks,

-- 
Colin Watson                                       [cjwatson at ubuntu.com]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-aptcc-sanitize-file-descriptor-handling.patch
Type: text/x-diff
Size: 1449 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/packagekit/attachments/20110124/1d07c21d/attachment-0009.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Set-client-locale-to-LC_MESSAGES-rather-than-LC_ALL.patch
Type: text/x-diff
Size: 1867 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/packagekit/attachments/20110124/1d07c21d/attachment-0010.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-aptcc-Use-a-pty-rather-than-a-pipe-for-writing-to-ap.patch
Type: text/x-diff
Size: 2367 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/packagekit/attachments/20110124/1d07c21d/attachment-0011.patch>


More information about the PackageKit mailing list