loose check for backend detection

Bug #1719338 reported by Ritesh Raj Sarraf
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Apport
New
Undecided
Unassigned
apport (Debian)
Fix Released
Unknown

Bug Description

Please see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=876683 for details.

Currently, setup.py relies on '/etc/apt/sources.list' to detect if it is an apt based system.
In my opinion, this is fragile, especially given that /etc/apt/sources.list.d/ sub config dir model is also supported.

I propose that a check on /usr/bin/apt or /usr/bin/apt-get be made instead. Both binaries are provided by the 'apt' pacakge.

Ritesh Raj Sarraf (rrs)
summary: - loose check for backed detection
+ loose check for backend detection
Changed in apport (Debian):
status: Unknown → New
Changed in apport (Debian):
status: New → Confirmed
Revision history for this message
Ritesh Raj Sarraf (rrs) wrote : Re: [Bug 1719338] [NEW] loose check for backend detection

On Mon, 2017-09-25 at 15:04 +0000, Ritesh Raj Sarraf wrote:
> Currently, setup.py relies on '/etc/apt/sources.list' to detect if it
> is an apt based system.
> In my opinion, this is fragile, especially given that
> /etc/apt/sources.list.d/ sub config dir model is also supported.
>
> I propose that a check on /usr/bin/apt or /usr/bin/apt-get be made
> instead. Both binaries are provided by the 'apt' pacakge.

The other bigger problem is that this code check happens outside of any
target. Which results in even the clean target failing. And I cannot
counter the failure with a debian patch I carry in my packaging.

Hence, can you please fix the setup.py script to not be so fragile and
cut out a new release ?

My current patch to setup.py is below. It still is very fragile given
that both distribution types have the possibility of having the
secondary package manager.

LP: 1719338
DBUG: 876683
--- a/setup.py
+++ b/setup.py
@@ -85,7 +85,7 @@

 # try to auto-setup packaging_impl
 if len(sys.argv) >= 2 and sys.argv[1] != 'sdist' and not
os.path.exists('apport/packaging_impl.py'):
- if os.path.exists('/etc/apt/sources.list'):
+ if os.path.exists('/usr/bin/apt-get'):
         print('Installing apt/dpkg packaging backend.')
         shutil.copy('backends/packaging-apt-dpkg.py',
'apport/packaging_impl.py')
     elif os.path.exists('/usr/bin/rpm'):

--
Ritesh Raj Sarraf
RESEARCHUT - http://www.researchut.com
"Necessity is the mother of invention."

Changed in apport (Debian):
status: Confirmed → Fix Released
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.