Change compressing format to zip 90/100490/4
authorSunmin Lee <sunm.lee@samsung.com>
Mon, 28 Nov 2016 08:57:57 +0000 (17:57 +0900)
committerSunmin Lee <sunm.lee@samsung.com>
Wed, 7 Dec 2016 05:58:39 +0000 (14:58 +0900)
Change compressing format from tar.gz to zip
due to compatibility issues

Change-Id: I1e08c1c139617af9baf3b488c3b8db4bd360e95c
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
packaging/crash-worker.spec
src/crash-manager/crash-manager.c
src/log_dump/log_dump.c

index 7e111425415d1c3edec0154a380971bca99e9df1..e61b43151913baaa9c02329d0e204ba120bb07a3 100644 (file)
@@ -26,6 +26,7 @@ Requires(post): coreutils
 Requires(post): tar
 Requires(post): gzip
 Requires: libunwind
+Requires: zip
 # If you need support for core dump files (see building below),
 # you should add this dependency
 # Requires: libebl
index d0142df0f7d053951d5b9a8835619dd62ec79a96..80d5422ccb3b8adfbd88b3a7b82ac2c262cbd78f 100644 (file)
@@ -243,7 +243,7 @@ static int set_crash_info(char *argv[])
        if (allow_zip)
                ret = snprintf(crash_info.result_path,
                                sizeof(crash_info.result_path),
-                               "%s/%s.tar.gz", CRASH_PATH, crash_info.name);
+                               "%s/%s.zip", CRASH_PATH, crash_info.name);
        else
                ret = snprintf(crash_info.result_path,
                                sizeof(crash_info.result_path),
@@ -494,29 +494,28 @@ static void dump_unlock(void)
 static void compress(void)
 {
        int ret;
-       char tar_path[PATH_MAX];
+       char zip_path[PATH_MAX];
        char command[PATH_MAX];
 
-       ret = snprintf(tar_path, sizeof(tar_path), "%s/report.tar.gz",
+       ret = snprintf(zip_path, sizeof(zip_path), "%s/report.zip",
                        crash_info.temp_dir);
        if (ret < 0) {
-               LOGE("Failed to snprintf for tar path");
+               LOGE("Failed to snprintf for zip path");
                return;
        }
 
-       ret = snprintf(command, sizeof(command),
-                       "/bin/tar -czf %s -C %s %s",
-                       tar_path, crash_info.temp_dir, crash_info.name);
+       ret = snprintf(command, sizeof(command), "cd %s && /bin/zip -r %s %s > /dev/null 2>&1",
+                       crash_info.temp_dir, zip_path, crash_info.name);
        if (ret < 0) {
-               LOGE("Failed to snprintf for tar command");
+               LOGE("Failed to snprintf for zip command");
                return;
        }
        system_command(command);
 
        dump_lock();
-       if (rename(tar_path, crash_info.result_path) < 0)
+       if (rename(zip_path, crash_info.result_path) < 0)
                LOGE("Failed to move %s to %s",
-                               tar_path, crash_info.result_path);
+                               zip_path, crash_info.result_path);
        dump_unlock();
 
        ret = remove_dir(crash_info.temp_dir, 1);
index 912aeefb124f220d49dfcaa01a6910ac85b5f605..ffe3c56e7124233eb923ae50e7e2beb56a16c633 100644 (file)
@@ -176,19 +176,20 @@ int log_dump(int option)
                }
 
                ret = snprintf(command, sizeof(command),
-                               "/bin/tar -zcf %s/%s%s.tar.gz -C %s %s %s",
+                               "cd %s && /bin/zip -r %s/%s%s.zip %s %s > /dev/null 2>&1",
+                               LOG_DUMP_ROOT,
                                LOG_DUMP_RESULT, dump_filename, timestr,
-                               LOG_DUMP_ROOT, basename(dump_dirname),
-                               basename(crash_dirname));
+                               basename(dump_dirname), basename(crash_dirname));
                if (ret < 0) {
                        LOGE("Failed to snprintf for command");
                        goto exit;
                }
        } else {
                ret = snprintf(command, sizeof(command),
-                               "/bin/tar -zcf %s/%s%s.tar.gz -C %s %s",
+                               "cd %s && /bin/zip -r %s/%s%s.zip %s > /dev/null 2>&1",
+                               LOG_DUMP_ROOT,
                                LOG_DUMP_RESULT, dump_filename, timestr,
-                               LOG_DUMP_ROOT, basename(dump_dirname));
+                               basename(dump_dirname));
                if (ret < 0) {
                        LOGE("Failed to snprintf for command");
                        goto exit;