Bug 403742 - os-release incorrectly formatted
Summary: os-release incorrectly formatted
Status: RESOLVED FIXED
Alias: None
Product: flatpak-platform-plugin
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Flatpak Linux
: NOR normal
Target Milestone: ---
Assignee: Jan Grulich
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-29 19:34 UTC by poldoxx
Modified: 2019-01-31 21:25 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
minimal flatpak builder json (558 bytes, application/json)
2019-01-29 19:34 UTC, poldoxx
Details

Note You need to log in before you can comment on or make changes to this bug.
Description poldoxx 2019-01-29 19:34:16 UTC
Created attachment 117716 [details]
minimal flatpak builder json

SUMMARY
The os-release file "VERSION" field is incorrectly formatted and causes parsing errors in software that tries to source it.

STEPS TO REPRODUCE
1. Create a basic flatpak build json (as in http://docs.flatpak.org/en/latest/first-build.html) but specify the KDE runtime instead of the default freedesktop one.  
2. In the "commands" section of the flatpak json file, add ". /etc/os-release".
3. Run the build (flatpak-builder build org.flatpak.Hello.json)

OBSERVED RESULT
The flatpak build exits with an error parsing the os-release file due to missing quotes.

EXPECTED RESULT
The flatpak should build successfully.

SOFTWARE/OS VERSIONS
KDE Flatpak platform 5.12

ADDITIONAL INFORMATION
I've attached a json file demonstrating the problem.

See "https://www.freedesktop.org/software/systemd/man/os-release.html" for details on the correct way to specify the os-release file, in particular the part that says: {{{Variable assignment values must be enclosed in double or single quotes if they include spaces, semicolons or other special characters outside of A–Z, a–z, 0–9.}}}
Comment 1 Aleix Pol 2019-01-30 15:26:58 UTC
These are the contents I get:

$ cat /etc/os-release 
NAME=KDE
VERSION=master (Flatpak runtime)
VERSION_ID=master
ID=org.kde.Platform

Feels like an issue upstream.
Comment 2 poldoxx 2019-01-30 15:41:34 UTC
(In reply to Aleix Pol from comment #1)

Yes, those contents are incorrect as per the spec.  The VERSION string must be enclosed in quotes so build scripts that rely on them can source it.

I don't think it is related to upstream because the freedesktop runtime (org.freedesktop.Platform, v18.08) does it with quotes:

VERSION="18.08 (Flatpak runtime)"
Comment 3 Aleix Pol 2019-01-31 16:10:11 UTC
That it works on freedesktop it doesn't mean we're doing it wrong.
Bringing to upstream because I can't see what we're doing wrong.

https://github.com/flatpak/flatpak-builder/issues/267
Comment 4 poldoxx 2019-01-31 17:07:12 UTC
Please correct me if I am wrong but it looks to me that os-release is managed here, not generated by them.

https://cgit.kde.org/flatpak-kde-runtime.git/log/os-release
Comment 5 Aleix Pol 2019-01-31 17:25:00 UTC
You are super correct. Thanks for pointing it out.
Comment 6 Aleix Pol 2019-01-31 17:49:53 UTC
Git commit 9f8944f85638dcea8455d8a08ae9d929b1cde99b by Aleix Pol.
Committed on 31/01/2019 at 17:49.
Pushed by apol into branch 'qt5.12lts'.

Fix version id

M  +2    -2    os-release

https://commits.kde.org/flatpak-kde-runtime/9f8944f85638dcea8455d8a08ae9d929b1cde99b
Comment 7 poldoxx 2019-01-31 17:52:31 UTC
Hate to be a bother, but you didn't add quotes!
Comment 8 Aleix Pol 2019-01-31 17:55:34 UTC
Git commit 5abb6e1aa6c84fb5800fc550f96474597c6dd144 by Aleix Pol.
Committed on 31/01/2019 at 17:55.
Pushed by apol into branch 'qt5.12lts'.

Add missing quotes

M  +1    -1    os-release

https://commits.kde.org/flatpak-kde-runtime/5abb6e1aa6c84fb5800fc550f96474597c6dd144
Comment 9 poldoxx 2019-01-31 18:07:21 UTC
Thanks, we're almost there!  The quotes need to be around the contents of the VERSION variable.
Comment 10 Aleix Pol 2019-01-31 18:20:19 UTC
Git commit 5e216f64522ddbf93853cebd1ceff244f1a317f5 by Aleix Pol.
Committed on 31/01/2019 at 18:18.
Pushed by apol into branch 'qt5.12lts'.

Add missing quotes

M  +1    -1    os-release

https://commits.kde.org/flatpak-kde-runtime/5e216f64522ddbf93853cebd1ceff244f1a317f5
Comment 11 Christoph Feck 2019-01-31 21:25:03 UTC
And here ^ is the reason for review requests :)