USC fails to launch in non-admin user account if there's a private PPA

Bug #852003 reported by Matthew Paul Thomas
28
This bug affects 5 people
Affects Status Importance Assigned to Milestone
apt (Ubuntu)
Confirmed
Medium
Unassigned
python-apt (Ubuntu)
Confirmed
Medium
Unassigned
software-center (Ubuntu)
Triaged
High
Unassigned

Bug Description

Ubuntu Software Center 4.1.23.2, Ubuntu 11.10 beta 1
Ubuntu Software Center 5.0.1.4, Ubuntu 11.10

1. Subscribe to a private PPA. (For example, purchase some software.)
2. Close USC and relaunch it.
3. Switch to a guest account (or any non-admin account), and launch USC.

What happens:
2. USC opens.
3. USC fails to open, with this traceback:
------------
Traceback (most recent call last):
  File "/usr/bin/software-center", line 151, in <module>
    app = SoftwareCenterAppGtk3(datadir, xapian_base_path, options, args)
  File "/usr/share/software-center/softwarecenter/ui/gtk3/app.py", line 206, in __init__
    self.cache.open()
  File "/usr/share/software-center/softwarecenter/db/pkginfo_impl/aptcache.py", line 209, in open
    self._cache = apt.Cache(GtkMainIterationProgress())
  File "/usr/lib/python2.7/dist-packages/apt/cache.py", line 93, in __init__
    self.open(progress)
  File "/usr/lib/python2.7/dist-packages/apt/cache.py", line 140, in open
    self._list.read_main_list()
SystemError: E:Opening /etc/apt/sources.list.d/private-ppa.launchpad.net_whatever_ubuntu.list - ifstream::ifstream (13: Permission denied)
------------

What should happen:
3. USC should launch.

Bug 746625 (currently marked Invalid) is the equivalent bug in apt.

Changed in software-center (Ubuntu):
importance: Undecided → High
Michael Vogt (mvo)
Changed in software-center (Ubuntu):
status: New → Confirmed
Changed in python-apt (Ubuntu):
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Stefano Bagnatica (thepisu) wrote :

I also had this issue, inside the non-admin user. If can be useful, this is my trace:

ubuntuone-control-panel-gtk
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/ubuntuone-control-panel/ubuntuone/controlpanel/gui/gtk/gui.py", line 1573, in on_show_management_panel
    self.management.load()
  File "/usr/lib/python2.7/dist-packages/ubuntuone-control-panel/ubuntuone/controlpanel/gui/gtk/gui.py", line 1502, in load
    self.services.load()
  File "/usr/lib/python2.7/dist-packages/ubuntuone-control-panel/ubuntuone/controlpanel/logger.py", line 82, in inner
    res = f(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/ubuntuone-control-panel/ubuntuone/controlpanel/gui/gtk/gui.py", line 1173, in load
    logger.info('load: has_desktopcouch? %r', self.has_desktopcouch)
  File "/usr/lib/python2.7/dist-packages/ubuntuone-control-panel/ubuntuone/controlpanel/gui/gtk/gui.py", line 1145, in has_desktopcouch
    return self.package_manager.is_installed(DESKTOPCOUCH_PKG)
  File "/usr/lib/python2.7/dist-packages/ubuntuone-control-panel/ubuntuone/controlpanel/gui/gtk/package_manager.py", line 49, in is_installed
    cache = apt.Cache()
  File "/usr/lib/python2.7/dist-packages/apt/cache.py", line 93, in __init__
    self.open(progress)
  File "/usr/lib/python2.7/dist-packages/apt/cache.py", line 140, in open
    self._list.read_main_list()
SystemError: E:Apertura di /etc/apt/sources.list.d/private-ppa.launchpad.net_commercial-ppa-uploaders_fullcircle-issue-50_ubuntu.list - ifstream::ifstream (13: Permesso negato)

tags: added: client-server
description: updated
Changed in software-center (Ubuntu):
status: Confirmed → Triaged
Revision history for this message
Łukasz Czyżykowski (lukasz-czyzykowski) wrote :

<mvo> lukasz: right, well, libapt supports building its cache entirely in memory and that should work. I agree its not ideal that it would be inconsistent - a alternative is to use the /etc/apt/auth file to store the credentials but that would require some additional work and testing but its defeinitely a good idea
<lukasz> mvo, so what would be a proposed solution? update libapt so for in-memory cache it ignored unreadable files?
<mvo> lukasz: that will help, but it seems like the cleaner solution is to teach aptsources in python-apt to write passwords in a debline to /etc/apt/auth.conf - that file is in netrc style and can be mode 0600. it should be honored by all http/https/ftp methods of apt. but that needs testing and I'm not sure if the libapt support for this file is bugfree as this is not featured used much yet

tags: added: buying-software
Revision history for this message
David Pitkin (dpitkin) wrote :

Software Center not show any error when started it silently failed to launch, which is a second error, if it showed me the error I could have known to fix this.

2012-01-26 15:43:58,292 - softwarecenter.ui.gtk3.em - INFO - EM's: 16 13 18
Traceback (most recent call last):
  File "/usr/bin/software-center", line 151, in <module>
    app = SoftwareCenterAppGtk3(datadir, xapian_base_path, options, args)
  File "/usr/share/software-center/softwarecenter/ui/gtk3/app.py", line 213, in __init__
    self.cache.open()
  File "/usr/share/software-center/softwarecenter/db/pkginfo_impl/aptcache.py", line 209, in open
    self._cache = apt.Cache(GtkMainIterationProgress())
  File "/usr/lib/python2.7/dist-packages/apt/cache.py", line 93, in __init__
    self.open(progress)
  File "/usr/lib/python2.7/dist-packages/apt/cache.py", line 140, in open
    self._list.read_main_list()
SystemError: E:Opening /etc/apt/sources.list.d/private-ppa.launchpad.net_commercial-ppa-uploaders_ubuntu-font-beta-testing.list - ifstream::ifstream (13: Permission denied)

Revision history for this message
Matthew Paul Thomas (mpt) wrote :

That application crashes on launch happen silently is not specific to USC. It's a long-standing bug in Ubuntu that will be fixed by <https://wiki.ubuntu.com/ErrorTracker#app-crash>.

Michael Vogt (mvo)
Changed in apt (Ubuntu):
status: New → Confirmed
importance: Undecided → Medium
Dave Morley (davmor2)
tags: added: ca-escalated
Revision history for this message
Michael Vogt (mvo) wrote :

This is fixed in precise now, there is no 0640 mode for sources.list.d anymore but instead its using /etc/apt/auth.conf.

tags: removed: ca-escalated
Revision history for this message
David Ayers (ayers) wrote :

I believe the error still exists. I know next to nothing about C++ but I believe this is a symptom of a programming error in apt:

The code in
apt-pkg/sourcelist.cc

says:
   ifstream F(File.c_str(),ios::in /*| ios::nocreate*/);
   if (!F != 0)
      return _error->Errno("ifstream::ifstream",_("Opening %s"),File.c_str());

but the C++ documentation I found says:
If the constructor is not successful in opening the file, the object is still created although no file is associated to the stream buffer and the stream's failbit is set (which can be checked with inherited member fail).
http://www.cplusplus.com/reference/iostream/ifstream/ifstream/

So I believe that the the if case is arbitrarily failing due to type promotion rules dependent on the address that is stored in F.

That would make this a bug in the apt package which is repeated a few times in other places. (i.e. other places is apt where the result of the constructor is tested via if (!F != 0) rather than fail.

Revision history for this message
David Ayers (ayers) wrote :

... (i.e. other places _in_ the apt package ...

Revision history for this message
Daniel Hartwig (wigs) wrote : Re: [Bug 852003] Re: USC fails to launch in non-admin user account if there's a private PPA

On 11 July 2012 02:48, David Ayers <email address hidden> wrote:
> ifstream F(File.c_str(),ios::in /*| ios::nocreate*/);
> if (!F != 0)
> return _error->Errno("ifstream::ifstream",_("Opening %s"),File.c_str());
>
> but the C++ documentation I found says:
> If the constructor is not successful in opening the file, the
> object is still created although no file is associated to the
> stream buffer and the stream's failbit is set (which can be
> checked with inherited member fail).
> http://www.cplusplus.com/reference/iostream/ifstream/ifstream/

The test is ok. !F is equivalent to F.fail() [1], which effectively
makes the test:

 if (F.fail() != false)

[1] http://www.cplusplus.com/reference/iostream/ios/operatornot/

Revision history for this message
Daniel Hartwig (wigs) wrote :

On 11 July 2012 02:48, David Ayers <email address hidden> wrote:
> I believe the error still exists.

So you still receive this error and it is the same “permission denied”
error reported earlier, similar to

 SystemError: E:Opening /etc/apt/sources.list.d/private-
 ppa.launchpad.net_commercial-ppa-uploaders_ubuntu-font-beta-
 testing.list - ifstream::ifstream (13: Permission denied)

?

Revision history for this message
David Ayers (ayers) wrote :

Well if I call:
sudo -u landscape /usr/bin/landscape-package-reporter
I don't get the error, but every now and then when it is invoked automatically I do see the crash.
(the last crash report is from:
Date: Mon Jul 9 10:38:26 2012
but I've had it a few times before.)

I get:
PythonArgs: ['/usr/bin/landscape-package-reporter']
Traceback:
 Traceback (most recent call last):
   File "/usr/bin/landscape-package-reporter", line 10, in <module>
     main(sys.argv[1:])
   File "/usr/lib/python2.7/dist-packages/landscape/package/reporter.py", line 729, in main
     return run_task_handler(PackageReporter, args)
   File "/usr/lib/python2.7/dist-packages/landscape/package/taskhandler.py", line 267, in run_task_handler
     package_facade = AptFacade()
   File "/usr/lib/python2.7/dist-packages/landscape/package/facade.py", line 123, in __init__
     self._cache = apt.cache.Cache(rootdir=root)
   File "/usr/lib/python2.7/dist-packages/apt/cache.py", line 102, in __init__
     self.open(progress)
   File "/usr/lib/python2.7/dist-packages/apt/cache.py", line 149, in open
     self._list.read_main_list()
 SystemError: E:Opening /etc/apt/sources.list.d/private-ppa.launchpad.net_commercial-ppa-uploaders_fluendo-plugins_ubuntu.list - ifstream::ifstream (13: Permission denied)
UserGroups: admin libvirtd

yet:
-rw-r----- 1 root admin 161 Jun 13 12:18 /etc/apt/sources.list.d/private-ppa.launchpad.net_commercial-ppa-uploaders_fluendo-plugins_ubuntu.list

So it's not easily reproducible but it happens...
see: Bug #961611

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.