3989c83
From 3c4bbdee2059525fafdd6b32a6c85cf2358febe4 Mon Sep 17 00:00:00 2001
3989c83
From: Matej Habrnal <mhabrnal@redhat.com>
3989c83
Date: Wed, 10 Feb 2016 14:53:44 +0100
3989c83
Subject: [PATCH] ccpp: drop %e from the core_pattern
3989c83
3989c83
The argument is no longer need and it must be placed either at the end
3989c83
of the command or enclosed with '' as it can contain white space.
3989c83
3989c83
Threads can have an arbitrary name:
3989c83
    man 3 pthread_setname_np
3989c83
3989c83
Signed-off-by: Jakub Filak <jfilak@redhat.com>
3989c83
---
3989c83
 src/hooks/abrt-hook-ccpp.c          | 16 ++++++++--------
3989c83
 src/hooks/abrt-install-ccpp-hook.in | 12 +-----------
3989c83
 2 files changed, 9 insertions(+), 19 deletions(-)
3989c83
3989c83
diff --git a/src/hooks/abrt-hook-ccpp.c b/src/hooks/abrt-hook-ccpp.c
3989c83
index 58d9c28..ac60840 100644
3989c83
--- a/src/hooks/abrt-hook-ccpp.c
3989c83
+++ b/src/hooks/abrt-hook-ccpp.c
3989c83
@@ -142,9 +142,9 @@ static struct dump_dir *dd;
3989c83
  * %u - uid
3989c83
  * %g - gid
3989c83
  * %t - UNIX time of dump
3989c83
- * %e - executable filename
3989c83
- * %i - crash thread tid
3989c83
  * %P - global pid
3989c83
+ * %I - crash thread tid
3989c83
+ * %e - executable filename (can contain white spaces)
3989c83
  * %% - output one "%"
3989c83
  */
3989c83
 /* Hook must be installed with exactly the same sequence of %c specifiers.
3989c83
@@ -559,9 +559,9 @@ int main(int argc, char** argv)
3989c83
 
3989c83
     if (argc < 8)
3989c83
     {
3989c83
-        /* percent specifier:         %s   %c              %p  %u  %g  %t   %e          %P         %i*/
3989c83
-        /* argv:                  [0] [1]  [2]             [3] [4] [5] [6]  [7]         [8]        [9]*/
3989c83
-        error_msg_and_die("Usage: %s SIGNO CORE_SIZE_LIMIT PID UID GID TIME BINARY_NAME GLOBAL_PID [TID]", argv[0]);
3989c83
+        /* percent specifier:         %s   %c              %p  %u  %g  %t   %P         %T        */
3989c83
+        /* argv:                  [0] [1]  [2]             [3] [4] [5] [6]  [7]        [8]       */
3989c83
+        error_msg_and_die("Usage: %s SIGNO CORE_SIZE_LIMIT PID UID GID TIME GLOBAL_PID GLOBAL_TID", argv[0]);
3989c83
     }
3989c83
 
3989c83
     /* Not needed on 2.6.30.
3989c83
@@ -604,11 +604,11 @@ int main(int argc, char** argv)
3989c83
         else
3989c83
             free(s);
3989c83
     }
3989c83
-    const char *global_pid_str = argv[8];
3989c83
-    pid_t pid = xatoi_positive(argv[8]);
3989c83
+    const char *global_pid_str = argv[7];
3989c83
+    pid_t pid = xatoi_positive(argv[7]);
3989c83
 
3989c83
     pid_t tid = -1;
3989c83
-    const char *tid_str = argv[9];
3989c83
+    const char *tid_str = argv[8];
3989c83
     if (tid_str)
3989c83
     {
3989c83
         tid = xatoi_positive(tid_str);
3989c83
diff --git a/src/hooks/abrt-install-ccpp-hook.in b/src/hooks/abrt-install-ccpp-hook.in
3989c83
index 707c57d..660c209 100755
3989c83
--- a/src/hooks/abrt-install-ccpp-hook.in
3989c83
+++ b/src/hooks/abrt-install-ccpp-hook.in
3989c83
@@ -11,9 +11,7 @@ SAVED_PATTERN_DIR="@VAR_RUN@/abrt"
3989c83
 SAVED_PATTERN_FILE="@VAR_RUN@/abrt/saved_core_pattern"
3989c83
 HOOK_BIN="@libexecdir@/abrt-hook-ccpp"
3989c83
 # Must match percent_specifiers[] order in abrt-hook-ccpp.c:
3989c83
-PATTERN="|$HOOK_BIN %s %c %p %u %g %t %e %P %I"
3989c83
-# Same, but with bogus "executable name" parameter
3989c83
-PATTERN1="|$HOOK_BIN %s %c %p %u %g %t e %P %I"
3989c83
+PATTERN="|$HOOK_BIN %s %c %p %u %g %t %P %I"
3989c83
 
3989c83
 # core_pipe_limit specifies how many dump_helpers can run at the same time
3989c83
 # 0 - means unlimited, but it's not guaranteed that /proc/<pid> of crashing
3989c83
@@ -39,14 +37,6 @@ start() {
3989c83
 	cur=`cat "$PATTERN_FILE"`
3989c83
 	cur_first=`printf "%s" "$cur" | sed 's/ .*//'`
3989c83
 
3989c83
-	# Is there a %e (executable name) in old pattern anywhere?
3989c83
-	if test x"${cur#*%e}" = x"${cur}"; then
3989c83
-		# No. Can use PATTERN with less risk of overflow
3989c83
-		# on expansion (executable names can be LONG).
3989c83
-		# Overflow would cause kernel to abort coredump. BAD.
3989c83
-		PATTERN="$PATTERN1"
3989c83
-	fi
3989c83
-
3989c83
 	$verbose && printf "cur:'%s'\n" "$cur"
3989c83
 	# Is it already installed?
3989c83
 	if test x"$cur_first" != x"|$HOOK_BIN"; then   # no
3989c83
-- 
3989c83
2.5.0
3989c83