From unknown Fri Mar 29 07:28:54 2024 Received: (at submit) by bugs.devuan.org; 21 May 2020 15:40:03 +0000 Return-Path: Delivered-To: devuanbugs@dyne.org Received: from tupac3.dyne.org [195.169.149.119] by doc.devuan.org with IMAP (fetchmail-6.4.0.beta4) for (single-drop); Thu, 21 May 2020 15:40:03 +0000 (UTC) Received: from omega.myqiq.info (omega.myqiq.info [72.52.170.129]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by vm6.ganeti.dyne.org (Postfix) with ESMTPS id 5A205F60CBE for ; Thu, 21 May 2020 17:33:39 +0200 (CEST) Authentication-Results: vm6.ganeti.dyne.org; dkim=pass (2048-bit key; unprotected) header.d=pwduffy.org.uk header.i=@pwduffy.org.uk header.b="NJRbiZ3l"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=pwduffy.org.uk; s=default; h=Content-Transfer-Encoding:Mime-Version: Message-ID:Date:Content-Type:To:Reply-To:From:Subject:Sender:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=E4N8Ir03HzmIbDIXVOGvyRmziSQ+8mVaWBLV3bPI77Q=; b=NJRbiZ3lxCdcnpr+0dyCkzMvQT gJW9KCSoInGPd6WNbLj0AewbjH54NThQMw9ZYBYF99rApGkYt13iAjed1y2hYwx30HS4sAV0AnfR3 4cOQNdnCyFrm0UZKxSAJZYvVzmqjz5+v15qXj/bMKSQl5+2Fl9cHkEarVnBftHC1+4E9yD2Lofpq2 FuuxDBUnvyp5Q2uSt3oSiqd423kkMXlDUr1TuGd4vDQDWkpfXjKBq9rd1EH4ReLiQRutU6KORwepW SuT3vrPk/gF7XrCnND2L0gUQ7/wVFMDDOBzJV4knZRJlpzy2i/225Qy9TS3C1FwAerPBBZfCvULaK SvKC4FpQ==; Received: from cpc118362-brad23-2-0-cust385.17-1.cable.virginm.net ([86.14.225.130]:58938 helo=[192.168.1.86]) by omega.myqiq.info with esmtpa (Exim 4.93) (envelope-from ) id 1jbnCS-00BIUU-LZ for submit@bugs.devuan.org; Thu, 21 May 2020 15:33:36 +0000 Subject: python platform.linux_distribution() returns debian From: Peter Duffy Reply-To: peter@pwduffy.org.uk To: submit@bugs.devuan.org Content-Type: text/plain; charset="UTF-8" Date: Thu, 21 May 2020 16:33:35 +0100 Message-ID: <1590075215.2942.97.camel@baldur.shiftshaper.org.uk> Mime-Version: 1.0 X-Mailer: Evolution 2.32.3 (2.32.3-34.el6) Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - omega.myqiq.info X-AntiAbuse: Original Domain - bugs.devuan.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - pwduffy.org.uk X-Get-Message-Sender-Via: omega.myqiq.info: authenticated_id: smtp@pwduffy.org.uk X-Authenticated-Sender: omega.myqiq.info: smtp@pwduffy.org.uk X-Source: X-Source-Args: X-Source-Dir: X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_PASS autolearn=disabled version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tupac3.dyne.org Package: libpython2.7-minimal Version: 2.7.13 Environment in which bug seen: Devuan 2.1 (ascii) Problem behaviour: python function platform.linux_distribution() returns "debian" instead of "devuan" To reproduce: (from command-line): python (from python prompt): import platform platform.linux_distribution() (should return: "('debian','9','')" quit() Test fix: platform.linux_distribution() tries to use the file /etc/lsb-release. This doesn't appear to exist either in Debian stretch or Devuan ascii - unless it's present in a package which isn't included in the default install. Creating it with appropriate values fixes the problem: Check whether /etc/lsb-release exists: it shouldn't, - but if so, rename it (and rename it back after the test). lsb_release -a > /etc/lsb-release Edit /etc/lsb-release and change as follows: "Distributor ID: " => "DISTRIB_ID=" "Description: " => "DISTRIB_DESCRIPTION=" "Release: " => "DISTRIB_RELEASE=" "Codename: " => "DISTRIB_CODENAME=" Above test should now return: "('Devuan','2.1','ascii')" Additional information: The problem is apparently caused by the combination of the absence of /etc/lsb-release, and the presence of /etc/debian_release. The algorithm in platform.linux_distribution() is apparently to try reading /etc/lsb-release, and if it doesn't exist, look for any file matching /etc/*_(version|release) The bug also exists in python3 (package libpython3.5-minimal, version 3.5.3) - to reproduce, repeat the above test using "python3" instead of "python" The bug also exists in beowulf Not sure whether above "fix" is feasible in practice - maybe other python-based packages rely on getting back "debian" from platform.linux_distribution()? This problem came to light because it breaks the waagent package - because it believes that it's running on debian, waagent tries to use systemd-based commands and functions. I'm currently working this problem, but I'm approaching it by putting in place internal tests to ascertain whether debian or devuan, rather than relying on a system-level fix. platform.linux_distribution() is deprecated and slated for removal If it's decided that this can be safely fixed by creating /etc/lsb-release, one question needs answering: whether to lowercase the DISTRIB_ID field, or to leave it as returned by lsb_release From unknown Fri Mar 29 07:28:54 2024 Received: (at 468) by bugs.devuan.org; 22 May 2020 09:50:05 +0000 Return-Path: Delivered-To: devuanbugs@dyne.org Received: from tupac3.dyne.org [195.169.149.119] by doc.devuan.org with IMAP (fetchmail-6.4.0.beta4) for (single-drop); Fri, 22 May 2020 09:50:05 +0000 (UTC) Received: from mx.hindley.org.uk (mohindley.plus.com [81.174.245.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by vm6.ganeti.dyne.org (Postfix) with ESMTPS id 357A7F609D9 for <468@bugs.devuan.org>; Fri, 22 May 2020 11:45:07 +0200 (CEST) Received: from apollo.hindleynet ([192.168.1.3] helo=hindley.org.uk) by mx.hindley.org.uk with smtp (Exim 4.84_2) (envelope-from ) id 1jc4Ej-00070Z-O4; Fri, 22 May 2020 10:45:05 +0100 Received: (nullmailer pid 3138 invoked by uid 1000); Fri, 22 May 2020 09:45:05 -0000 Date: Fri, 22 May 2020 10:45:05 +0100 From: Mark Hindley To: peter@pwduffy.org.uk, 468@bugs.devuan.org Subject: Re: bug#468: python platform.linux_distribution() returns debian Message-ID: <20200522094505.GE32762@hindley.org.uk> References: <1590075215.2942.97.camel@baldur.shiftshaper.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1590075215.2942.97.camel@baldur.shiftshaper.org.uk> X-Debbugs-No-Ack: No Thanks User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-0.0 required=5.0 tests=SPF_PASS autolearn=disabled version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tupac3.dyne.org Peter, Thanks for this. It is somewhat problematic for a number of reasons: - python2 is EOL. - as you point out, platform.linux_distribution() is deprecated and slated for removal in python3 (presumably for the very reason you have discovered -- it isn't reliable). - In my opinion, applications and functions should use output of lsb_release -a directly (as many already do). - Devuan beowulf deliberately has ID=Debian in lsb_release -a (see the Release Notes[1] for an explanation why). This has been changed to ID=Devuan for ceres/chimaera. - neither python2 nor python3 are forked packages and Devuan uses Debian's packages directly. Considering all that, I find it difficult to see a feasible route to fixing this. Having /etc/lsb_release as another source of information only consulted by some applications seems a retrograde step. Best wishes, Mark [1] https://files.devuan.org/devuan_beowulf/Release_notes.txt From unknown Fri Mar 29 07:28:54 2024 Received: (at 468) by bugs.devuan.org; 22 May 2020 11:50:05 +0000 Return-Path: Delivered-To: devuanbugs@dyne.org Received: from tupac3.dyne.org [195.169.149.119] by doc.devuan.org with IMAP (fetchmail-6.4.0.beta4) for (single-drop); Fri, 22 May 2020 11:50:04 +0000 (UTC) Received: from mx.hindley.org.uk (mohindley.plus.com [81.174.245.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by vm6.ganeti.dyne.org (Postfix) with ESMTPS id 9B5F1F60CBD for <468@bugs.devuan.org>; Fri, 22 May 2020 13:49:20 +0200 (CEST) Received: from apollo.hindleynet ([192.168.1.3] helo=hindley.org.uk) by mx.hindley.org.uk with smtp (Exim 4.84_2) (envelope-from ) id 1jc6Aw-0007fU-HM; Fri, 22 May 2020 12:49:18 +0100 Received: (nullmailer pid 5439 invoked by uid 1000); Fri, 22 May 2020 11:49:17 -0000 Date: Fri, 22 May 2020 12:49:17 +0100 From: Mark Hindley To: Peter Duffy Cc: 468@bugs.devuan.org Subject: Re: bug#468: python platform.linux_distribution() returns debian Message-ID: <20200522114917.GG32762@hindley.org.uk> References: <1590075215.2942.97.camel@baldur.shiftshaper.org.uk> <20200522094505.GE32762@hindley.org.uk> <1590146461.2950.104.camel@baldur.shiftshaper.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1590146461.2950.104.camel@baldur.shiftshaper.org.uk> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-0.0 required=5.0 tests=SPF_PASS autolearn=disabled version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tupac3.dyne.org Peter, On Fri, May 22, 2020 at 12:21:01PM +0100, Peter Duffy wrote: > Hi Mark, > > Thanks for getting back to me. I agree that this is problematic, and I > concur with your points and decision not to fix. I will leave this open, in case any better suggestions come along. > As I mentioned, I came up against this whilst trying to fix waagent (aka > walinuxagent and azurelinuxagent) - the glue layer which the Microsoft > Azure front-end uses to communicate with linux running on VMs. I'm > trying to set up a virtualbox VM based on devuan ascii, for use as a > base OS image in Azure. At the moment, waagent detects the system as > debian instead of devuan, and so tries to use systemd-based utilities > and functions: of course, these aren't present, so waagent doesn't work > under devuan. (I'm not sure that it's worth flagging it up as a bug in > the waagent package? OK, the problem is specific to devuan, but it needs > to be fixed in waagent.) Yes, please do. Let me know if there is anything I can do to help. It is also worth noting that this approach will sometimes be broken in Debian too: non-systemd init is still possible in all Debian suites. I suggest it would be better if they detected init system and acted on that rather than inferred the init from the distribution. > BTW - one point of order. The utility is /usr/bin/lsb_release - the file > that platform.linux_distribution() tries to use is /etc/lsb-release. > Don't ask me why :( Absolutely -- thanks for correcting my lazy typing! Mark From unknown Fri Mar 29 07:28:54 2024 Received: (at 468-done) by bugs.devuan.org; 24 Jan 2023 17:18:02 +0000 Return-Path: Delivered-To: bugs@devuan.org Received: from email.devuan.org [2001:41d0:2:d06e::5c4:2612] by doc.devuan.org with IMAP (fetchmail-6.4.16) for (single-drop); Tue, 24 Jan 2023 17:18:02 +0000 (UTC) Received: from email.devuan.org by email.devuan.org with LMTP id NWhoOr8S0GPwKQAAmSBk0A (envelope-from ) for ; Tue, 24 Jan 2023 17:17:51 +0000 Received: by email.devuan.org (Postfix, from userid 109) id E4DB6416; Tue, 24 Jan 2023 17:17:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on email.devuan.org X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=RDNS_DYNAMIC,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=193.36.131.86; helo=mx.hindley.org.uk; envelope-from=mark@hindley.org.uk; receiver= Received: from mx.hindley.org.uk (193-36-131-86.cfwn.uk [193.36.131.86]) by email.devuan.org (Postfix) with ESMTPS id 91EEE84 for <468-done@bugs.devuan.org>; Tue, 24 Jan 2023 17:17:51 +0000 (UTC) Received: from apollo.hindleynet ([192.168.1.3] helo=hindley.org.uk) by mx.hindley.org.uk with smtp (Exim 4.84_2) (envelope-from ) id 1pKMvd-0004sU-VB; Tue, 24 Jan 2023 17:17:50 +0000 Received: (nullmailer pid 19430 invoked by uid 1000); Tue, 24 Jan 2023 17:17:49 -0000 Date: Tue, 24 Jan 2023 17:17:49 +0000 From: Mark Hindley To: peter@pwduffy.org.uk, 468-done@bugs.devuan.org Subject: Re: bug#468: python platform.linux_distribution() returns debian Message-ID: References: <1590075215.2942.97.camel@baldur.shiftshaper.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1590075215.2942.97.camel@baldur.shiftshaper.org.uk> X-Debbugs-No-Ack: No Thanks Peter, I am going to close this as libpython2.7-minimal was removed from Debian[1] and the python3 platform library doesn't have linux_distribution(). Mark [1] https://bugs.debian.org/1027108