diff --git a/generate_pipeline.py b/generate_pipeline.py
index 7a092d581f9be4bf6554fe8948338e278e04ddf0..b477bdcb6ac63a0409d673fb295d4a32773ff4b5 100755
--- a/generate_pipeline.py
+++ b/generate_pipeline.py
@@ -79,7 +79,12 @@ for ref in $refs; do
             message=$(ostree show "$prev" \\
                         | grep '^ ' \\
                         | sed 's/^ *//g')
-            metadata=$(ostree cat "$prev" metadata)
+
+            # Trick to preserve any trailing newlines:
+            # https://unix.stackexchange.com/a/383411/117660
+            # (The '|| :' at the end is because read always returns an exit code of 1 in
+            # this case: https://stackoverflow.com/a/67066283/2097780)
+            IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
             echo 'Applying new changes on top of remote...'
             ostree commit -b "$ref" -m "$message" \\
diff --git a/tests/approved_files/test_approval.test_apps.main.main_only.with_sign.with_tests.with_flatpakrepo.deps_sign_none.approved.yaml b/tests/approved_files/test_approval.test_apps.main.main_only.with_sign.with_tests.with_flatpakrepo.deps_sign_none.approved.yaml
index b1b05df97fb21a02dd6b92806646d6639d9fa27a..d4013860fe50b0bf4f314c39c73d3feb546c645e 100644
--- a/tests/approved_files/test_approval.test_apps.main.main_only.with_sign.with_tests.with_flatpakrepo.deps_sign_none.approved.yaml
+++ b/tests/approved_files/test_approval.test_apps.main.main_only.with_sign.with_tests.with_flatpakrepo.deps_sign_none.approved.yaml
@@ -325,7 +325,12 @@ publish app org.test.Test-1 (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -406,7 +411,12 @@ publish app org.test.Test-1 (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -487,7 +497,12 @@ publish app org.test.Test-1 (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -568,7 +583,12 @@ publish app org.test.Test-2 (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -649,7 +669,12 @@ publish app org.test.Test-2 (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -730,7 +755,12 @@ publish app org.test.Test-2 (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
diff --git a/tests/approved_files/test_approval.test_apps.main.main_only.without_sign.with_tests.with_flatpakrepo.deps_sign_ed25519.approved.yaml b/tests/approved_files/test_approval.test_apps.main.main_only.without_sign.with_tests.with_flatpakrepo.deps_sign_ed25519.approved.yaml
index a519b3390aa763c9df00f93e347abc0de1a55c19..0fb1793717bceafdbf8399e5021eecc5afdd3b23 100644
--- a/tests/approved_files/test_approval.test_apps.main.main_only.without_sign.with_tests.with_flatpakrepo.deps_sign_ed25519.approved.yaml
+++ b/tests/approved_files/test_approval.test_apps.main.main_only.without_sign.with_tests.with_flatpakrepo.deps_sign_ed25519.approved.yaml
@@ -325,7 +325,12 @@ publish app org.test.Test-1 (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -405,7 +410,12 @@ publish app org.test.Test-1 (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -485,7 +495,12 @@ publish app org.test.Test-1 (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -565,7 +580,12 @@ publish app org.test.Test-2 (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -645,7 +665,12 @@ publish app org.test.Test-2 (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -725,7 +750,12 @@ publish app org.test.Test-2 (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
diff --git a/tests/approved_files/test_approval.test_apps.main.main_only.without_sign.without_tests.without_flatpakrepo.deps_sign_gpg.approved.yaml b/tests/approved_files/test_approval.test_apps.main.main_only.without_sign.without_tests.without_flatpakrepo.deps_sign_gpg.approved.yaml
index ce01a9f1a233f47503dc32589dc56ef1167af021..e4423f6b166000340e5264a658f1c0ae2163d010 100644
--- a/tests/approved_files/test_approval.test_apps.main.main_only.without_sign.without_tests.without_flatpakrepo.deps_sign_gpg.approved.yaml
+++ b/tests/approved_files/test_approval.test_apps.main.main_only.without_sign.without_tests.without_flatpakrepo.deps_sign_gpg.approved.yaml
@@ -192,7 +192,12 @@ publish app org.test.Test-1 (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -272,7 +277,12 @@ publish app org.test.Test-1 (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -352,7 +362,12 @@ publish app org.test.Test-1 (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -432,7 +447,12 @@ publish app org.test.Test-2 (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -512,7 +532,12 @@ publish app org.test.Test-2 (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -592,7 +617,12 @@ publish app org.test.Test-2 (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
diff --git a/tests/approved_files/test_approval.test_apps.main.versioned.with_sign.with_tests.with_flatpakrepo.deps_sign_none.approved.yaml b/tests/approved_files/test_approval.test_apps.main.versioned.with_sign.with_tests.with_flatpakrepo.deps_sign_none.approved.yaml
index dfd22551ef901d7563684d9b4050d2858d9b600e..b5d34eb6766f16a9b29876b6954eab5eff18d89f 100644
--- a/tests/approved_files/test_approval.test_apps.main.versioned.with_sign.with_tests.with_flatpakrepo.deps_sign_none.approved.yaml
+++ b/tests/approved_files/test_approval.test_apps.main.versioned.with_sign.with_tests.with_flatpakrepo.deps_sign_none.approved.yaml
@@ -325,7 +325,12 @@ publish app org.test.Test-1 (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -406,7 +411,12 @@ publish app org.test.Test-1 (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -487,7 +497,12 @@ publish app org.test.Test-1 (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -568,7 +583,12 @@ publish app org.test.Test-2 (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -649,7 +669,12 @@ publish app org.test.Test-2 (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -730,7 +755,12 @@ publish app org.test.Test-2 (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
diff --git a/tests/approved_files/test_approval.test_apps.main.versioned.without_sign.with_tests.with_flatpakrepo.deps_sign_ed25519.approved.yaml b/tests/approved_files/test_approval.test_apps.main.versioned.without_sign.with_tests.with_flatpakrepo.deps_sign_ed25519.approved.yaml
index 34d70f3752470f927de8e9dee77b1812990e7da6..d22f4210e9a90f9ff551f9813304095ec739efc5 100644
--- a/tests/approved_files/test_approval.test_apps.main.versioned.without_sign.with_tests.with_flatpakrepo.deps_sign_ed25519.approved.yaml
+++ b/tests/approved_files/test_approval.test_apps.main.versioned.without_sign.with_tests.with_flatpakrepo.deps_sign_ed25519.approved.yaml
@@ -325,7 +325,12 @@ publish app org.test.Test-1 (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -405,7 +410,12 @@ publish app org.test.Test-1 (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -485,7 +495,12 @@ publish app org.test.Test-1 (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -565,7 +580,12 @@ publish app org.test.Test-2 (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -645,7 +665,12 @@ publish app org.test.Test-2 (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -725,7 +750,12 @@ publish app org.test.Test-2 (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
diff --git a/tests/approved_files/test_approval.test_apps.main.versioned.without_sign.without_tests.without_flatpakrepo.deps_sign_gpg.approved.yaml b/tests/approved_files/test_approval.test_apps.main.versioned.without_sign.without_tests.without_flatpakrepo.deps_sign_gpg.approved.yaml
index 933414e38d505582682fe95c27653d471992d4cc..4181f3e1744f4129265cb70f6b84954a78195a48 100644
--- a/tests/approved_files/test_approval.test_apps.main.versioned.without_sign.without_tests.without_flatpakrepo.deps_sign_gpg.approved.yaml
+++ b/tests/approved_files/test_approval.test_apps.main.versioned.without_sign.without_tests.without_flatpakrepo.deps_sign_gpg.approved.yaml
@@ -192,7 +192,12 @@ publish app org.test.Test-1 (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -272,7 +277,12 @@ publish app org.test.Test-1 (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -352,7 +362,12 @@ publish app org.test.Test-1 (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -432,7 +447,12 @@ publish app org.test.Test-2 (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -512,7 +532,12 @@ publish app org.test.Test-2 (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -592,7 +617,12 @@ publish app org.test.Test-2 (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
diff --git a/tests/approved_files/test_approval.test_apps.test.main_only.with_sign.with_tests.with_flatpakrepo.deps_sign_none.approved.yaml b/tests/approved_files/test_approval.test_apps.test.main_only.with_sign.with_tests.with_flatpakrepo.deps_sign_none.approved.yaml
index a1daab176109ec288bf087eca293c332583678d0..ca1f49a38b9c70e16b2905f9e0dc939b740a873b 100644
--- a/tests/approved_files/test_approval.test_apps.test.main_only.with_sign.with_tests.with_flatpakrepo.deps_sign_none.approved.yaml
+++ b/tests/approved_files/test_approval.test_apps.test.main_only.with_sign.with_tests.with_flatpakrepo.deps_sign_none.approved.yaml
@@ -325,7 +325,12 @@ publish app org.test.Test-1 (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -406,7 +411,12 @@ publish app org.test.Test-1 (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -487,7 +497,12 @@ publish app org.test.Test-1 (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -568,7 +583,12 @@ publish app org.test.Test-2 (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -649,7 +669,12 @@ publish app org.test.Test-2 (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -730,7 +755,12 @@ publish app org.test.Test-2 (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
diff --git a/tests/approved_files/test_approval.test_apps.test.main_only.without_sign.with_tests.with_flatpakrepo.deps_sign_ed25519.approved.yaml b/tests/approved_files/test_approval.test_apps.test.main_only.without_sign.with_tests.with_flatpakrepo.deps_sign_ed25519.approved.yaml
index 00ebfe1e1e9cbbcc4b0c89154fbadec03009a6f2..08c26db09ba0f76679b7c2bd31a6afd152e30690 100644
--- a/tests/approved_files/test_approval.test_apps.test.main_only.without_sign.with_tests.with_flatpakrepo.deps_sign_ed25519.approved.yaml
+++ b/tests/approved_files/test_approval.test_apps.test.main_only.without_sign.with_tests.with_flatpakrepo.deps_sign_ed25519.approved.yaml
@@ -325,7 +325,12 @@ publish app org.test.Test-1 (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -405,7 +410,12 @@ publish app org.test.Test-1 (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -485,7 +495,12 @@ publish app org.test.Test-1 (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -565,7 +580,12 @@ publish app org.test.Test-2 (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -645,7 +665,12 @@ publish app org.test.Test-2 (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -725,7 +750,12 @@ publish app org.test.Test-2 (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
diff --git a/tests/approved_files/test_approval.test_apps.test.main_only.without_sign.without_tests.without_flatpakrepo.deps_sign_gpg.approved.yaml b/tests/approved_files/test_approval.test_apps.test.main_only.without_sign.without_tests.without_flatpakrepo.deps_sign_gpg.approved.yaml
index 86e2c3f239b056c35c959ef86839bfad69d60383..2efb65eac695ae62a5f8aa4757591f4399dfcc5b 100644
--- a/tests/approved_files/test_approval.test_apps.test.main_only.without_sign.without_tests.without_flatpakrepo.deps_sign_gpg.approved.yaml
+++ b/tests/approved_files/test_approval.test_apps.test.main_only.without_sign.without_tests.without_flatpakrepo.deps_sign_gpg.approved.yaml
@@ -192,7 +192,12 @@ publish app org.test.Test-1 (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -272,7 +277,12 @@ publish app org.test.Test-1 (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -352,7 +362,12 @@ publish app org.test.Test-1 (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -432,7 +447,12 @@ publish app org.test.Test-2 (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -512,7 +532,12 @@ publish app org.test.Test-2 (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -592,7 +617,12 @@ publish app org.test.Test-2 (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
diff --git a/tests/approved_files/test_approval.test_apps.test.versioned.with_sign.with_tests.with_flatpakrepo.deps_sign_none.approved.yaml b/tests/approved_files/test_approval.test_apps.test.versioned.with_sign.with_tests.with_flatpakrepo.deps_sign_none.approved.yaml
index c928a444e4dd2a609eafa1a0c8b9ffbc1449bd9c..0f2a990933b06ba65890485be019b2ba6b9c77dd 100644
--- a/tests/approved_files/test_approval.test_apps.test.versioned.with_sign.with_tests.with_flatpakrepo.deps_sign_none.approved.yaml
+++ b/tests/approved_files/test_approval.test_apps.test.versioned.with_sign.with_tests.with_flatpakrepo.deps_sign_none.approved.yaml
@@ -325,7 +325,12 @@ publish app org.test.Test-1 (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -406,7 +411,12 @@ publish app org.test.Test-1 (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -487,7 +497,12 @@ publish app org.test.Test-1 (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -568,7 +583,12 @@ publish app org.test.Test-2 (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -649,7 +669,12 @@ publish app org.test.Test-2 (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -730,7 +755,12 @@ publish app org.test.Test-2 (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
diff --git a/tests/approved_files/test_approval.test_apps.test.versioned.without_sign.with_tests.with_flatpakrepo.deps_sign_ed25519.approved.yaml b/tests/approved_files/test_approval.test_apps.test.versioned.without_sign.with_tests.with_flatpakrepo.deps_sign_ed25519.approved.yaml
index 1c3e58bccfed9c2eeb494e41a9ed7c1e1f72c227..dd4456bbfda68a9531ad7687e84d13960d44da45 100644
--- a/tests/approved_files/test_approval.test_apps.test.versioned.without_sign.with_tests.with_flatpakrepo.deps_sign_ed25519.approved.yaml
+++ b/tests/approved_files/test_approval.test_apps.test.versioned.without_sign.with_tests.with_flatpakrepo.deps_sign_ed25519.approved.yaml
@@ -325,7 +325,12 @@ publish app org.test.Test-1 (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -405,7 +410,12 @@ publish app org.test.Test-1 (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -485,7 +495,12 @@ publish app org.test.Test-1 (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -565,7 +580,12 @@ publish app org.test.Test-2 (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -645,7 +665,12 @@ publish app org.test.Test-2 (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -725,7 +750,12 @@ publish app org.test.Test-2 (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
diff --git a/tests/approved_files/test_approval.test_apps.test.versioned.without_sign.without_tests.without_flatpakrepo.deps_sign_gpg.approved.yaml b/tests/approved_files/test_approval.test_apps.test.versioned.without_sign.without_tests.without_flatpakrepo.deps_sign_gpg.approved.yaml
index aa847563e82441419199d75f1dedb1df8da6fcd9..e23c9a8a66f9b88e3740087c4e306760e4a83916 100644
--- a/tests/approved_files/test_approval.test_apps.test.versioned.without_sign.without_tests.without_flatpakrepo.deps_sign_gpg.approved.yaml
+++ b/tests/approved_files/test_approval.test_apps.test.versioned.without_sign.without_tests.without_flatpakrepo.deps_sign_gpg.approved.yaml
@@ -192,7 +192,12 @@ publish app org.test.Test-1 (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -272,7 +277,12 @@ publish app org.test.Test-1 (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -352,7 +362,12 @@ publish app org.test.Test-1 (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -432,7 +447,12 @@ publish app org.test.Test-2 (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -512,7 +532,12 @@ publish app org.test.Test-2 (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -592,7 +617,12 @@ publish app org.test.Test-2 (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
diff --git a/tests/approved_files/test_approval.test_runtimes.main.main_only.with_sign.with_tests.with_flatpakrepo.deps_sign_none.approved.yaml b/tests/approved_files/test_approval.test_runtimes.main.main_only.with_sign.with_tests.with_flatpakrepo.deps_sign_none.approved.yaml
index a763b3bc1c40f6808da7f5e41eb33625d94baf81..5829223143ec83282c2bad35423cb7f667e52d06 100644
--- a/tests/approved_files/test_approval.test_runtimes.main.main_only.with_sign.with_tests.with_flatpakrepo.deps_sign_none.approved.yaml
+++ b/tests/approved_files/test_approval.test_runtimes.main.main_only.with_sign.with_tests.with_flatpakrepo.deps_sign_none.approved.yaml
@@ -570,7 +570,12 @@ publish runtime org.test.bar (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -651,7 +656,12 @@ publish runtime org.test.bar (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -732,7 +742,12 @@ publish runtime org.test.bar (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -813,7 +828,12 @@ publish runtime org.test.foo (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -897,7 +917,12 @@ publish runtime org.test.foo (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -981,7 +1006,12 @@ publish runtime org.test.foo (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1065,7 +1095,12 @@ publish app org.test.foo.Test (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1149,7 +1184,12 @@ publish app org.test.foo.Test (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1233,7 +1273,12 @@ publish app org.test.foo.Test (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1317,7 +1362,12 @@ publish app org.test.bar.Test (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1401,7 +1451,12 @@ publish app org.test.bar.Test (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1485,7 +1540,12 @@ publish app org.test.bar.Test (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
diff --git a/tests/approved_files/test_approval.test_runtimes.main.main_only.without_sign.with_tests.with_flatpakrepo.deps_sign_ed25519.approved.yaml b/tests/approved_files/test_approval.test_runtimes.main.main_only.without_sign.with_tests.with_flatpakrepo.deps_sign_ed25519.approved.yaml
index 03fa67bace1461b2ff25233b389560db18f3efb6..94f5545db1ef11c6f1a8bf041d0ac561cb66eae9 100644
--- a/tests/approved_files/test_approval.test_runtimes.main.main_only.without_sign.with_tests.with_flatpakrepo.deps_sign_ed25519.approved.yaml
+++ b/tests/approved_files/test_approval.test_runtimes.main.main_only.without_sign.with_tests.with_flatpakrepo.deps_sign_ed25519.approved.yaml
@@ -558,7 +558,12 @@ publish runtime org.test.bar (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -638,7 +643,12 @@ publish runtime org.test.bar (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -718,7 +728,12 @@ publish runtime org.test.bar (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -798,7 +813,12 @@ publish runtime org.test.foo (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -881,7 +901,12 @@ publish runtime org.test.foo (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -964,7 +989,12 @@ publish runtime org.test.foo (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1047,7 +1077,12 @@ publish app org.test.foo.Test (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1130,7 +1165,12 @@ publish app org.test.foo.Test (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1213,7 +1253,12 @@ publish app org.test.foo.Test (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1296,7 +1341,12 @@ publish app org.test.bar.Test (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1379,7 +1429,12 @@ publish app org.test.bar.Test (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1462,7 +1517,12 @@ publish app org.test.bar.Test (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
diff --git a/tests/approved_files/test_approval.test_runtimes.main.main_only.without_sign.without_tests.without_flatpakrepo.deps_sign_gpg.approved.yaml b/tests/approved_files/test_approval.test_runtimes.main.main_only.without_sign.without_tests.without_flatpakrepo.deps_sign_gpg.approved.yaml
index 8ad2488ae3b56e8d3343c1d0f03db9bd95d10719..51787e08c990e11f1fa965b5d0bbf7e463601d54 100644
--- a/tests/approved_files/test_approval.test_runtimes.main.main_only.without_sign.without_tests.without_flatpakrepo.deps_sign_gpg.approved.yaml
+++ b/tests/approved_files/test_approval.test_runtimes.main.main_only.without_sign.without_tests.without_flatpakrepo.deps_sign_gpg.approved.yaml
@@ -371,7 +371,12 @@ publish runtime org.test.bar (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -451,7 +456,12 @@ publish runtime org.test.bar (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -531,7 +541,12 @@ publish runtime org.test.bar (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -611,7 +626,12 @@ publish runtime org.test.foo (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -691,7 +711,12 @@ publish runtime org.test.foo (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -771,7 +796,12 @@ publish runtime org.test.foo (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -851,7 +881,12 @@ publish app org.test.foo.Test (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -931,7 +966,12 @@ publish app org.test.foo.Test (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1011,7 +1051,12 @@ publish app org.test.foo.Test (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1091,7 +1136,12 @@ publish app org.test.bar.Test (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1171,7 +1221,12 @@ publish app org.test.bar.Test (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1251,7 +1306,12 @@ publish app org.test.bar.Test (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
diff --git a/tests/approved_files/test_approval.test_runtimes.main.versioned.with_sign.with_tests.with_flatpakrepo.deps_sign_none.approved.yaml b/tests/approved_files/test_approval.test_runtimes.main.versioned.with_sign.with_tests.with_flatpakrepo.deps_sign_none.approved.yaml
index 4616a09f59da7893334f951c9bffae3418fe9a82..74d46f575954ae066153aca2697ec0e9d07a6965 100644
--- a/tests/approved_files/test_approval.test_runtimes.main.versioned.with_sign.with_tests.with_flatpakrepo.deps_sign_none.approved.yaml
+++ b/tests/approved_files/test_approval.test_runtimes.main.versioned.with_sign.with_tests.with_flatpakrepo.deps_sign_none.approved.yaml
@@ -570,7 +570,12 @@ publish runtime org.test.bar (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -651,7 +656,12 @@ publish runtime org.test.bar (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -732,7 +742,12 @@ publish runtime org.test.bar (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -813,7 +828,12 @@ publish runtime org.test.foo (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -897,7 +917,12 @@ publish runtime org.test.foo (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -981,7 +1006,12 @@ publish runtime org.test.foo (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1065,7 +1095,12 @@ publish app org.test.foo.Test (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1149,7 +1184,12 @@ publish app org.test.foo.Test (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1233,7 +1273,12 @@ publish app org.test.foo.Test (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1317,7 +1362,12 @@ publish app org.test.bar.Test (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1401,7 +1451,12 @@ publish app org.test.bar.Test (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1485,7 +1540,12 @@ publish app org.test.bar.Test (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
diff --git a/tests/approved_files/test_approval.test_runtimes.main.versioned.without_sign.with_tests.with_flatpakrepo.deps_sign_ed25519.approved.yaml b/tests/approved_files/test_approval.test_runtimes.main.versioned.without_sign.with_tests.with_flatpakrepo.deps_sign_ed25519.approved.yaml
index 27f9273c238c4d5e475fc17f8783f5fe69f01039..899c5c34f4635e7a879aa09704ce92fa78449d6e 100644
--- a/tests/approved_files/test_approval.test_runtimes.main.versioned.without_sign.with_tests.with_flatpakrepo.deps_sign_ed25519.approved.yaml
+++ b/tests/approved_files/test_approval.test_runtimes.main.versioned.without_sign.with_tests.with_flatpakrepo.deps_sign_ed25519.approved.yaml
@@ -558,7 +558,12 @@ publish runtime org.test.bar (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -638,7 +643,12 @@ publish runtime org.test.bar (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -718,7 +728,12 @@ publish runtime org.test.bar (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -798,7 +813,12 @@ publish runtime org.test.foo (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -881,7 +901,12 @@ publish runtime org.test.foo (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -964,7 +989,12 @@ publish runtime org.test.foo (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1047,7 +1077,12 @@ publish app org.test.foo.Test (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1130,7 +1165,12 @@ publish app org.test.foo.Test (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1213,7 +1253,12 @@ publish app org.test.foo.Test (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1296,7 +1341,12 @@ publish app org.test.bar.Test (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1379,7 +1429,12 @@ publish app org.test.bar.Test (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1462,7 +1517,12 @@ publish app org.test.bar.Test (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
diff --git a/tests/approved_files/test_approval.test_runtimes.main.versioned.without_sign.without_tests.without_flatpakrepo.deps_sign_gpg.approved.yaml b/tests/approved_files/test_approval.test_runtimes.main.versioned.without_sign.without_tests.without_flatpakrepo.deps_sign_gpg.approved.yaml
index 637db65de2778be7dce1ef87b29dc1a919b0a672..5284bf15048c37d7fdb315a91bbe042e289c68df 100644
--- a/tests/approved_files/test_approval.test_runtimes.main.versioned.without_sign.without_tests.without_flatpakrepo.deps_sign_gpg.approved.yaml
+++ b/tests/approved_files/test_approval.test_runtimes.main.versioned.without_sign.without_tests.without_flatpakrepo.deps_sign_gpg.approved.yaml
@@ -371,7 +371,12 @@ publish runtime org.test.bar (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -451,7 +456,12 @@ publish runtime org.test.bar (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -531,7 +541,12 @@ publish runtime org.test.bar (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -611,7 +626,12 @@ publish runtime org.test.foo (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -691,7 +711,12 @@ publish runtime org.test.foo (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -771,7 +796,12 @@ publish runtime org.test.foo (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -851,7 +881,12 @@ publish app org.test.foo.Test (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -931,7 +966,12 @@ publish app org.test.foo.Test (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1011,7 +1051,12 @@ publish app org.test.foo.Test (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1091,7 +1136,12 @@ publish app org.test.bar.Test (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1171,7 +1221,12 @@ publish app org.test.bar.Test (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1251,7 +1306,12 @@ publish app org.test.bar.Test (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
diff --git a/tests/approved_files/test_approval.test_runtimes.test.main_only.with_sign.with_tests.with_flatpakrepo.deps_sign_none.approved.yaml b/tests/approved_files/test_approval.test_runtimes.test.main_only.with_sign.with_tests.with_flatpakrepo.deps_sign_none.approved.yaml
index 5d9787cebf9fc6a12630d65acf231eb492eb675d..6ffbe69e2ba9fe2ca2f28213202566a372ff4691 100644
--- a/tests/approved_files/test_approval.test_runtimes.test.main_only.with_sign.with_tests.with_flatpakrepo.deps_sign_none.approved.yaml
+++ b/tests/approved_files/test_approval.test_runtimes.test.main_only.with_sign.with_tests.with_flatpakrepo.deps_sign_none.approved.yaml
@@ -564,7 +564,12 @@ publish runtime org.test.bar (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -645,7 +650,12 @@ publish runtime org.test.bar (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -726,7 +736,12 @@ publish runtime org.test.bar (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -807,7 +822,12 @@ publish runtime org.test.foo (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -891,7 +911,12 @@ publish runtime org.test.foo (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -975,7 +1000,12 @@ publish runtime org.test.foo (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1059,7 +1089,12 @@ publish app org.test.foo.Test (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1143,7 +1178,12 @@ publish app org.test.foo.Test (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1227,7 +1267,12 @@ publish app org.test.foo.Test (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1311,7 +1356,12 @@ publish app org.test.bar.Test (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1395,7 +1445,12 @@ publish app org.test.bar.Test (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1479,7 +1534,12 @@ publish app org.test.bar.Test (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
diff --git a/tests/approved_files/test_approval.test_runtimes.test.main_only.without_sign.with_tests.with_flatpakrepo.deps_sign_ed25519.approved.yaml b/tests/approved_files/test_approval.test_runtimes.test.main_only.without_sign.with_tests.with_flatpakrepo.deps_sign_ed25519.approved.yaml
index f99e49bae915cd20906e8038b5b25d234b671f37..35c649eb9b7e15724b919178c73d54f4551ccf11 100644
--- a/tests/approved_files/test_approval.test_runtimes.test.main_only.without_sign.with_tests.with_flatpakrepo.deps_sign_ed25519.approved.yaml
+++ b/tests/approved_files/test_approval.test_runtimes.test.main_only.without_sign.with_tests.with_flatpakrepo.deps_sign_ed25519.approved.yaml
@@ -552,7 +552,12 @@ publish runtime org.test.bar (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -632,7 +637,12 @@ publish runtime org.test.bar (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -712,7 +722,12 @@ publish runtime org.test.bar (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -792,7 +807,12 @@ publish runtime org.test.foo (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -875,7 +895,12 @@ publish runtime org.test.foo (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -958,7 +983,12 @@ publish runtime org.test.foo (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1041,7 +1071,12 @@ publish app org.test.foo.Test (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1124,7 +1159,12 @@ publish app org.test.foo.Test (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1207,7 +1247,12 @@ publish app org.test.foo.Test (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1290,7 +1335,12 @@ publish app org.test.bar.Test (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1373,7 +1423,12 @@ publish app org.test.bar.Test (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1456,7 +1511,12 @@ publish app org.test.bar.Test (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
diff --git a/tests/approved_files/test_approval.test_runtimes.test.main_only.without_sign.without_tests.without_flatpakrepo.deps_sign_gpg.approved.yaml b/tests/approved_files/test_approval.test_runtimes.test.main_only.without_sign.without_tests.without_flatpakrepo.deps_sign_gpg.approved.yaml
index b59a74b48db00acdbf145f0d84e3641e760f3c38..06cede67bc29ec3f6cc6c8679bc2242f24524a15 100644
--- a/tests/approved_files/test_approval.test_runtimes.test.main_only.without_sign.without_tests.without_flatpakrepo.deps_sign_gpg.approved.yaml
+++ b/tests/approved_files/test_approval.test_runtimes.test.main_only.without_sign.without_tests.without_flatpakrepo.deps_sign_gpg.approved.yaml
@@ -365,7 +365,12 @@ publish runtime org.test.bar (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -445,7 +450,12 @@ publish runtime org.test.bar (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -525,7 +535,12 @@ publish runtime org.test.bar (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -605,7 +620,12 @@ publish runtime org.test.foo (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -685,7 +705,12 @@ publish runtime org.test.foo (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -765,7 +790,12 @@ publish runtime org.test.foo (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -845,7 +875,12 @@ publish app org.test.foo.Test (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -925,7 +960,12 @@ publish app org.test.foo.Test (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1005,7 +1045,12 @@ publish app org.test.foo.Test (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1085,7 +1130,12 @@ publish app org.test.bar.Test (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1165,7 +1215,12 @@ publish app org.test.bar.Test (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1245,7 +1300,12 @@ publish app org.test.bar.Test (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
diff --git a/tests/approved_files/test_approval.test_runtimes.test.versioned.with_sign.with_tests.with_flatpakrepo.deps_sign_none.approved.yaml b/tests/approved_files/test_approval.test_runtimes.test.versioned.with_sign.with_tests.with_flatpakrepo.deps_sign_none.approved.yaml
index 22f273d93dd377ff5c5c59667e7b99a7c6943bfe..ea35c76806f15cd4b6467dcd16905b05f705446f 100644
--- a/tests/approved_files/test_approval.test_runtimes.test.versioned.with_sign.with_tests.with_flatpakrepo.deps_sign_none.approved.yaml
+++ b/tests/approved_files/test_approval.test_runtimes.test.versioned.with_sign.with_tests.with_flatpakrepo.deps_sign_none.approved.yaml
@@ -570,7 +570,12 @@ publish runtime org.test.bar (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -651,7 +656,12 @@ publish runtime org.test.bar (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -732,7 +742,12 @@ publish runtime org.test.bar (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -813,7 +828,12 @@ publish runtime org.test.foo (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -897,7 +917,12 @@ publish runtime org.test.foo (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -981,7 +1006,12 @@ publish runtime org.test.foo (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1065,7 +1095,12 @@ publish app org.test.foo.Test (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1149,7 +1184,12 @@ publish app org.test.foo.Test (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1233,7 +1273,12 @@ publish app org.test.foo.Test (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1317,7 +1362,12 @@ publish app org.test.bar.Test (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1401,7 +1451,12 @@ publish app org.test.bar.Test (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1485,7 +1540,12 @@ publish app org.test.bar.Test (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
diff --git a/tests/approved_files/test_approval.test_runtimes.test.versioned.without_sign.with_tests.with_flatpakrepo.deps_sign_ed25519.approved.yaml b/tests/approved_files/test_approval.test_runtimes.test.versioned.without_sign.with_tests.with_flatpakrepo.deps_sign_ed25519.approved.yaml
index e2ff1b230ff2c8a1fe68e3b342a1ac3636f13a3b..a8f2dcaf12362c1f8dae4a2cda2c5f98d35303f3 100644
--- a/tests/approved_files/test_approval.test_runtimes.test.versioned.without_sign.with_tests.with_flatpakrepo.deps_sign_ed25519.approved.yaml
+++ b/tests/approved_files/test_approval.test_runtimes.test.versioned.without_sign.with_tests.with_flatpakrepo.deps_sign_ed25519.approved.yaml
@@ -558,7 +558,12 @@ publish runtime org.test.bar (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -638,7 +643,12 @@ publish runtime org.test.bar (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -718,7 +728,12 @@ publish runtime org.test.bar (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -798,7 +813,12 @@ publish runtime org.test.foo (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -881,7 +901,12 @@ publish runtime org.test.foo (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -964,7 +989,12 @@ publish runtime org.test.foo (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1047,7 +1077,12 @@ publish app org.test.foo.Test (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1130,7 +1165,12 @@ publish app org.test.foo.Test (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1213,7 +1253,12 @@ publish app org.test.foo.Test (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1296,7 +1341,12 @@ publish app org.test.bar.Test (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1379,7 +1429,12 @@ publish app org.test.bar.Test (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1462,7 +1517,12 @@ publish app org.test.bar.Test (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
diff --git a/tests/approved_files/test_approval.test_runtimes.test.versioned.without_sign.without_tests.without_flatpakrepo.deps_sign_gpg.approved.yaml b/tests/approved_files/test_approval.test_runtimes.test.versioned.without_sign.without_tests.without_flatpakrepo.deps_sign_gpg.approved.yaml
index edb311947d23c52837394a8a280446ef4ce9087a..263daa09f31cc61af30a271a9a86bd75455007aa 100644
--- a/tests/approved_files/test_approval.test_runtimes.test.versioned.without_sign.without_tests.without_flatpakrepo.deps_sign_gpg.approved.yaml
+++ b/tests/approved_files/test_approval.test_runtimes.test.versioned.without_sign.without_tests.without_flatpakrepo.deps_sign_gpg.approved.yaml
@@ -371,7 +371,12 @@ publish runtime org.test.bar (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -451,7 +456,12 @@ publish runtime org.test.bar (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -531,7 +541,12 @@ publish runtime org.test.bar (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -611,7 +626,12 @@ publish runtime org.test.foo (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -691,7 +711,12 @@ publish runtime org.test.foo (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -771,7 +796,12 @@ publish runtime org.test.foo (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -851,7 +881,12 @@ publish app org.test.foo.Test (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -931,7 +966,12 @@ publish app org.test.foo.Test (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1011,7 +1051,12 @@ publish app org.test.foo.Test (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1091,7 +1136,12 @@ publish app org.test.bar.Test (x86_64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1171,7 +1221,12 @@ publish app org.test.bar.Test (aarch64):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
@@ -1251,7 +1306,12 @@ publish app org.test.bar.Test (arm):
                   message=$(ostree show "$prev" \
                               | grep '^ ' \
                               | sed 's/^ *//g')
-                  metadata=$(ostree cat "$prev" metadata)
+
+                  # Trick to preserve any trailing newlines:
+                  # https://unix.stackexchange.com/a/383411/117660
+                  # (The '|| :' at the end is because read always returns an exit code of 1 in
+                  # this case: https://stackoverflow.com/a/67066283/2097780)
+                  IFS= read -rd '' metadata < <(ostree cat "$prev" metadata) || :
 
                   echo 'Applying new changes on top of remote...'
                   ostree commit -b "$ref" -m "$message" \
diff --git a/tests/test_build_pipelines.py b/tests/test_build_pipelines.py
index 85ba50cb2b2c0fcfdc2e127d0fa14ff74e2e18b4..7e48653bc1f0e73a651c0f9afefab1c471325f90 100644
--- a/tests/test_build_pipelines.py
+++ b/tests/test_build_pipelines.py
@@ -496,10 +496,6 @@ def test_subsummaries_flatpak_metadata(subsummaries):
         refs, _meta = subsummary
 
         for ref, (_commit_size, _commit_checksum, ref_metadata) in refs:
-            flatpak_metadata = ref_metadata['xa.data'][2]
-            keyfile = GLib.KeyFile.new()
-            keyfile.load_from_bytes(GLib.Bytes.new(flatpak_metadata.encode('ascii')), 0)
-
             if ref.startswith('runtime/'):
                 group = 'Runtime'
             elif ref.startswith('app/'):
@@ -509,6 +505,15 @@ def test_subsummaries_flatpak_metadata(subsummaries):
             else:
                 assert False, ref
 
+            flatpak_metadata = ref_metadata['xa.data'][2]
+
+            # The metadata file should have a single trailing newline.
+            assert flatpak_metadata.endswith('\n'), ref
+            assert not flatpak_metadata.endswith('\n\n'), ref
+
+            keyfile = GLib.KeyFile.new()
+            keyfile.load_from_bytes(GLib.Bytes.new(flatpak_metadata.encode('ascii')), 0)
+
             ref_id = ref.split('/')[1]
             id_from_metadata = keyfile.get_string(group, 'name')
             assert ref_id == id_from_metadata