Release 0.10.1.1: add debug logs to execl calls 97/324497/1 accepted/tizen/9.0/unified/20250520.172324
authorMichal Bloch <m.bloch@samsung.com>
Thu, 15 May 2025 11:29:50 +0000 (13:29 +0200)
committerMichal Bloch <m.bloch@samsung.com>
Mon, 19 May 2025 16:34:57 +0000 (16:34 +0000)
Change-Id: Id71e6487fe0f9e14dced82f597ad63e3f175a648

packaging/sessiond.spec
src/service/src/os_ops.cpp

index e29105aeed7b504100fca948eb6b747e87c37159..46503510ee7ecd3495274524195e1b7ec60858c4 100644 (file)
@@ -1,6 +1,6 @@
 Name:       sessiond
 Summary:    Service to manage subsessions
-Version:    0.10.1.0
+Version:    0.10.1.1
 Release:    1
 Group:      System/Management
 License:    MIT
index 20d04d211c0c497de611f0a0e94e5c3cf64ed8de..00768d13ffd2b9f588bfc81b8b01816e43bb295c 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "os_ops.hpp"
 
+#include <cassert>
 #include <optional>
 #include <vector>
 #include <string_view>
 #include <sys/wait.h>
 #include <unistd.h>
 
+#undef LOG_TAG
+#define LOG_TAG "SESSIOND"
+#include <dlog.h>
+
 namespace fs = std::filesystem;
 using namespace std::literals;
 
@@ -114,7 +119,7 @@ void OS::do_mkfs(const fs::path& image_path, int uid, int gid, uint64_t size_kB)
 
                std::string size_arg = std::to_string(size_kB);
 
-               execl
+               const auto r = execl
                        ( mkfs.data(), mkfs.data() /* argv[0] convention */
                        , "-F" /* dangerous, but needed for old mkfs.ext4 */
                        , "-E", owner_arg.c_str()
@@ -128,6 +133,14 @@ void OS::do_mkfs(const fs::path& image_path, int uid, int gid, uint64_t size_kB)
                        , (char *) NULL
                );
 
+               LOGE("Failed to execute `%s -E %s %s %s`: %m"
+                       , mkfs.data()
+                       , owner_arg.c_str()
+                       , image_path.c_str()
+                       , size_arg.c_str()
+               );
+               assert(r == -1);
+
                _exit(1);
        } else {
                try {
@@ -145,12 +158,18 @@ void OS::do_umount(const fs::path& path)
        if (child_pid == 0) {
                const auto umount_exe = "/usr/bin/umount"sv;
 
-               execl
+               const auto r = execl
                        ( umount_exe.data(), umount_exe.data() /* argv[0] convention */
                        , path.c_str()
                        , (char *) NULL
                );
 
+               LOGE("Failed to execute `%s %s`: %m"
+                       , umount_exe.data()
+                       , path.c_str()
+               );
+               assert(r == -1);
+
                _exit(1);
        } else {
                OS::throw_if_child_failed(child_pid, "umount failed!");
@@ -167,7 +186,7 @@ void OS::do_mount(const fs::path& image_path, const fs::path& mount_path)
        if (child_pid == 0) {
                const auto mount_exe = "/usr/bin/mount"sv;
 
-               execl
+               const auto r = execl
                        ( mount_exe.data(), mount_exe.data() /* argv[0] convention */
                        , "-o", "loop"
                        , image_path.c_str()
@@ -175,6 +194,13 @@ void OS::do_mount(const fs::path& image_path, const fs::path& mount_path)
                        , (char *) NULL
                );
 
+               LOGE("Failed to execute `%s %s %s`: %m"
+                       , mount_exe.data()
+                       , image_path.c_str()
+                       , mount_path.c_str()
+               );
+               assert(r == -1);
+
                _exit(1);
        } else {
                OS::throw_if_child_failed(child_pid, "mount failed!");