flatpak-builder
flatpak-builder copied to clipboard
Flatpak-builder silently ignores improper only-arch value
Checklist
- [X] I agree to follow the Code of Conduct that this project adheres to.
- [X] I have searched the issue tracker for a bug that matches the one I want to file, without success.
flatpak-builder version
1.4.3
Flatpak version
1.15.6
How to reproduce
Given a manifest
app-id: com.lablicate.OpenChrom
runtime: org.freedesktop.Platform
runtime-version: 23.08
sdk: org.freedesktop.Sdk
command: openchrom
finish-args:
- --socket=x11
- --share=ipc
- --device=dri
- --share=network
- --socket=pulseaudio
- --persist=.openchrom
- --persist=.eclipseswtchartsettings
- --filesystem=/tmp:rw
modules:
- name: openchrom
buildsystem: simple
build-options:
strip: false
no-debuginfo: true
build-commands:
- mv openchrom ${FLATPAK_DEST}/openchrom/
- mkdir -p ${FLATPAK_DEST}/bin
- ln -sf ${FLATPAK_DEST}/openchrom/openchrom ${FLATPAK_DEST}/bin/
- install -Dm644 ${FLATPAK_ID}.desktop ${FLATPAK_DEST}/share/applications/${FLATPAK_ID}.desktop
- install -Dm644 ${FLATPAK_ID}.png ${FLATPAK_DEST}/share/icons/hicolor/256x256/apps/${FLATPAK_ID}.png
- install -Dm644 ${FLATPAK_ID}.metainfo.xml ${FLATPAK_DEST}/share/metainfo/${FLATPAK_ID}.metainfo.xml
sources:
- type: archive
only-arches:
x86_64 #<--- Missing dash
url: https://products.lablicate.com/openchrom/1.5.0/openchrom-lablicate_linux.x86_64_1.5.0.tar.gz
sha256: 64a8528d889f6a05dffc499206af04e93ee170814700c416183fdf42f4d000eb
strip-components: 0
dest: openchrom
- type: archive
only-arches:
aarch64 #<--- Missing dash
url: https://products.lablicate.com/openchrom/1.5.0/openchrom-lablicate_linux.aarch64_1.5.0.tar.gz
sha256: d3f6ca097398891aca88760aae510ae9ba07c3a33de038021523f1c4a482195b
strip-components: 0
dest: openchrom
- type: file
path: com.lablicate.OpenChrom.desktop
- type: file
path: com.lablicate.OpenChrom.png
- type: file
path: com.lablicate.OpenChrom.metainfo.xml
building and show-manifest ignores that the only-arches key is improper, so it is converted to
{
"id" : "com.lablicate.OpenChrom",
"runtime" : "org.freedesktop.Platform",
"runtime-version" : "23.08",
"sdk" : "org.freedesktop.Sdk",
"command" : "openchrom",
"modules" : [
{
"name" : "openchrom",
"buildsystem" : "simple",
"sources" : [
{
"dest" : "openchrom",
"url" : "https://products.lablicate.com/openchrom/1.5.0/openchrom-lablicate_linux.x86_64_1.5.0.tar.gz",
"sha256" : "64a8528d889f6a05dffc499206af04e93ee170814700c416183fdf42f4d000eb",
"strip-components" : 0,
"type" : "archive"
},
{
"dest" : "openchrom",
"url" : "https://products.lablicate.com/openchrom/1.5.0/openchrom-lablicate_linux.aarch64_1.5.0.tar.gz",
"sha256" : "d3f6ca097398891aca88760aae510ae9ba07c3a33de038021523f1c4a482195b",
"strip-components" : 0,
"type" : "archive"
},
{
"path" : "com.lablicate.OpenChrom.desktop",
"type" : "file"
},
{
"path" : "com.lablicate.OpenChrom.png",
"type" : "file"
},
{
"path" : "com.lablicate.OpenChrom.metainfo.xml",
"type" : "file"
}
],
"build-options" : {
"no-debuginfo" : true
},
"build-commands" : [
"mv openchrom ${FLATPAK_DEST}/openchrom/",
"mkdir -p ${FLATPAK_DEST}/bin",
"ln -sf ${FLATPAK_DEST}/openchrom/openchrom ${FLATPAK_DEST}/bin/",
"install -Dm644 ${FLATPAK_ID}.desktop ${FLATPAK_DEST}/share/applications/${FLATPAK_ID}.desktop",
"install -Dm644 ${FLATPAK_ID}.png ${FLATPAK_DEST}/share/icons/hicolor/256x256/apps/${FLATPAK_ID}.png",
"install -Dm644 ${FLATPAK_ID}.metainfo.xml ${FLATPAK_DEST}/share/metainfo/${FLATPAK_ID}.metainfo.xml"
]
}
],
"finish-args" : [
"--socket=x11",
"--share=ipc",
"--device=dri",
"--share=network",
"--socket=pulseaudio",
"--persist=.openchrom",
"--persist=.eclipseswtchartsettings",
"--filesystem=/tmp:rw"
]
}
which causes, the x86_64 build and aarch64 build files to get overwritten by one another.
Expected Behavior
It should error and fail.
Actual Behavior
Doesn't error
Additional Information
#0 _g_log_abort (breakpoint=<optimized out>) at ../glib/gmessages.c:556
#1 g_log_writer_default (log_level=18, fields=<optimized out>, n_fields=6, user_data=0x0) at ../glib/gmessages.c:2812
#2 0x00007f1ba6c07b54 in g_log_structured_array (n_fields=6, fields=0x7ffcba1908b0, log_level=G_LOG_LEVEL_WARNING) at ../glib/gmessages.c:1984
#3 g_log_structured_array (log_level=log_level@entry=G_LOG_LEVEL_WARNING, fields=fields@entry=0x7ffcba1908b0, n_fields=n_fields@entry=6) at ../glib/gmessages.c:1957
#4 0x00007f1ba6c07db8 in g_log_structured_standard
(log_domain=log_domain@entry=0x7f1ba696601e "Json", log_level=log_level@entry=G_LOG_LEVEL_WARNING, file=file@entry=0x7f1ba69665aa "../json-glib/json-gobject.c", line=line@entry=0x7f1ba69665c6 "321", func=func@entry=0x7f1ba69681e0 <__func__.7.lto_priv.3> "json_gobject_new", message_format=message_format@entry=0x7f1ba6967028 "Failed to deserialize \"%s\" property of type \"%s\" for an object of type \"%s\"")
at ../glib/gmessages.c:2041
#5 0x00007f1ba695bd11 in json_gobject_new (gtype=Python Exception <class 'gdb.error'>: value has been optimized out
, object=0x55e6727ba710) at ../json-glib/json-gobject.c:321
#6 0x00007f1ba695be08 in json_gobject_deserialize (gtype=<optimized out>, node=<optimized out>) at ../json-glib/json-gobject.c:805
#7 0x000055e6720331e8 in builder_source_from_json (node=0x55e6727d53b0) at ../src/builder-source.c:301
#8 0x000055e672023590 in builder_module_deserialize_property (serializable=<optimized out>, property_name=<optimized out>, value=0x7ffcba191050, pspec=<optimized out>, property_node=<optimized out>)
at ../src/builder-module.c:945
#9 0x00007f1ba695bc46 in json_gobject_new (gtype=Python Exception <class 'gdb.error'>: value has been optimized out
, object=0x55e6727bbd80) at ../json-glib/json-gobject.c:296
#10 0x00007f1ba695be08 in json_gobject_deserialize (gtype=<optimized out>, node=<optimized out>) at ../json-glib/json-gobject.c:805
#11 0x000055e672018b10 in builder_manifest_deserialize_property (serializable=<optimized out>, property_name=<optimized out>, value=0x7ffcba1911b0, pspec=<optimized out>, property_node=<optimized out>)
at ../src/builder-manifest.c:1301
#12 0x00007f1ba695bc46 in json_gobject_new (gtype=Python Exception <class 'gdb.error'>: value has been optimized out
, object=0x7f1b90000c40) at ../json-glib/json-gobject.c:296
#13 0x00007f1ba695be08 in json_gobject_deserialize (gtype=<optimized out>, node=<optimized out>) at ../json-glib/json-gobject.c:805
#14 0x000055e672037564 in builder_gobject_from_data (gtype=Python Exception <class 'gdb.error'>: value has been optimized out
, relpath=<optimized out>, contents=<optimized out>, error=0x7ffcba191390) at ../src/builder-utils.c:544
#15 0x000055e672005342 in main (argc=<optimized out>, argv=<optimized out>) at ../src/builder-manifest.c:124
The solution I thought of is that it can check that if skip-arches, only-arches hold an array, if not then it is an error. Something like this json_object_get_member(obj, "only-arches") -> if (!JSON_NODE_HOLDS_ARRAY (node)) -> error but it involves manually checking each such property.
Not sure about this entirely.