Bug 37725 - /etc/lsb-release: Double quotes making python report '"Univention"' as distname
/etc/lsb-release: Double quotes making python report '"Univention"' as distname
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: General
UCS 4.0
Other All
: P5 normal (vote)
: UCS 4.0-3-errata
Assigned To: Daniel Tröder
Philipp Hahn
:
: 39023 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2015-02-07 21:57 CET by Alvaro Aleman
Modified: 2015-08-20 13:16 CEST (History)
4 users (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments
Fix LSB configuration (1.95 KB, patch)
2015-02-13 17:40 CET, Philipp Hahn
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alvaro Aleman 2015-02-07 21:57:14 CET
Steps to reproduce:

python
>>>import platform
>>>print platform.dist()[0]

Expected result:
Univention

Actual result:
"Univention"

Suggested fix:

/etc/lsb-release:11
DISTRIB_ID="Univention" ==> DISTRIB_ID=Univention
Comment 1 Philipp Hahn univentionstaff 2015-02-13 17:40:08 CET
Created attachment 6674 [details]
Fix LSB configuration

This also broke during my CEPH testing.
Comment 2 Philipp Hahn univentionstaff 2015-08-11 15:58:14 CEST
*** Bug 39023 has been marked as a duplicate of this bug. ***
Comment 3 Daniel Tröder univentionstaff 2015-08-11 17:40:07 CEST
Fixed in 62938.
Comment 4 Daniel Tröder univentionstaff 2015-08-11 19:08:13 CEST
YAML is in r62940.
Comment 5 Philipp Hahn univentionstaff 2015-08-12 12:45:36 CEST
OK: r62938 r62940
OK: DEBIAN_FRONTEND=noninteractive aptitude install -y '?source-package(univention-base-files)~i'
OK: cat /etc/lsb-release
OK: lsb_release -s -i # Univention
OK: lsb_release -s -r # 4.0-3 errata285
OK: lsb_release -s -c # Walle
OK: lsb_release -s -d # Univention Corporate Server 4.0-3 errata285 (Walle)
OK: python -c 'import platform;print platform.dist()' # ('Univention', '4.0-3 errata285', 'Walle')

OK: 2015-08-11-univention-base-files.yaml
OK: errata-announce -V

FAIL: /usr/share/doc/lsb-release/README.Debian
> The file should be formatted as a series of shell variable
> assignments.  Multiword strings should be quoted in double quotes.

We don't know what else parses the file.

Quotes can be removed for
- DISTRIB_ID always, as "Univention" is a single word.
- DISTRIB_RELEASE if "X.Y-Z+E" would be used instead of "X.Y-Z errataE"
- DISTRIB_CODENAME if we never use a two-word codename like "{mountain/copper/golden} beach" again. (or change blanks to under-scores)
DISTRIB_DESCRIPTION should stay quoted.

Looks like /usr/lib/python2.7/platform.py needs to handle the un-quoting, but the format of "/etc/lsb-release" is not specified by LSB itself - only "lsb_release" is.

FYI: Please note that ID=Univention is hard-coded in /usr/bin/lsb_release!

FYI: /usr/share/pyshared/lsb_release.py:346 removes the quotes

FYI: platform.dist() is deprecated: <https://bugs.python.org/issue1322>
See <https://bugs.python.org/issue1322#msg73652> for a list of possibles values from other distributions.
Comment 6 Daniel Tröder univentionstaff 2015-08-12 19:35:06 CEST
Oh wow - platform.dist is a mess…

lsb_release isn't really portable across distros, works for UCS though.

BTW: I saw, that /etc/os-release contains original Debian information. If UCS were to switch to systemd (jessie?) it'd have to be adapted.

> FAIL: /usr/share/doc/lsb-release/README.Debian
> > The file should be formatted as a series of shell variable
> > assignments.  Multiword strings should be quoted in double quotes.
Fixed in 62968, YAML in 62969.
Comment 7 Philipp Hahn univentionstaff 2015-08-12 20:40:55 CEST
OK: r62968 r62969
OK: DEBIAN_FRONTEND=noninteractive aptitude install -y '?source-package(univention-base-files)~i'
OK: cat /etc/lsb-release
OK: lsb_release -a
OK: python -c 'import platform;print platform.dist()' # ('Univention', '"4.0-3 errata285"', 'Walle')
FYI: RELEASE is still quoted - lets wait who parses it and fails
OK: ucr set version/releasename='Walle Walle';lsb_release -s -c
OK: errata-announce -V
Comment 8 Janek Walkenhorst univentionstaff 2015-08-20 13:16:15 CEST
<http://errata.univention.de/ucs/4.0/286.html>