svashisht / rpms / bash

Forked from rpms/bash 4 years ago
Clone

Blame SOURCES/bash-4.2-check-debugger.patch

ff19ae
diff -up bash-4.2/builtins/evalfile.c.old bash-4.2/builtins/evalfile.c
ff19ae
--- bash-4.2/builtins/evalfile.c.old	2015-05-14 20:45:31.402793505 +0200
ff19ae
+++ bash-4.2/builtins/evalfile.c	2015-05-14 20:45:47.632794791 +0200
ff19ae
@@ -317,6 +317,23 @@ maybe_execute_file (fname, force_noninte
ff19ae
   return result;
ff19ae
 }
ff19ae
 
ff19ae
+int
ff19ae
+force_execute_file (fname, force_noninteractive)
ff19ae
+     const char *fname;
ff19ae
+     int force_noninteractive;
ff19ae
+{
ff19ae
+  char *filename;
ff19ae
+  int result, flags;
ff19ae
+
ff19ae
+  filename = bash_tilde_expand (fname, 0);
ff19ae
+  flags = 0;
ff19ae
+  if (force_noninteractive)
ff19ae
+    flags |= FEVAL_NONINT;
ff19ae
+  result = _evalfile (filename, flags);
ff19ae
+  free (filename);
ff19ae
+  return result;
ff19ae
+}
ff19ae
+
ff19ae
 #if defined (HISTORY)
ff19ae
 int
ff19ae
 fc_execute_file (filename)
ff19ae
diff -up bash-4.2/configure.in.old bash-4.2/configure.in
ff19ae
--- bash-4.2/configure.in.old	2015-05-14 21:27:20.882449456 +0200
ff19ae
+++ bash-4.2/configure.in	2015-05-14 21:19:25.654612738 +0200
ff19ae
@@ -149,7 +149,7 @@ fi
ff19ae
 fi
ff19ae
 
ff19ae
 if test -z "${DEBUGGER_START_FILE}"; then
ff19ae
-	DEBUGGER_START_FILE='${datadir}/bashdb/bashdb-main.inc'
ff19ae
+	DEBUGGER_START_FILE='/usr/share/bashdb/bashdb-main.inc'
ff19ae
 fi
ff19ae
 
ff19ae
 dnl optional shell features in config.h.in
ff19ae
diff -up bash-4.2/shell.c.old bash-4.2/shell.c
ff19ae
--- bash-4.2/shell.c.old	2015-05-14 20:42:54.379781066 +0200
ff19ae
+++ bash-4.2/shell.c	2015-05-14 20:43:04.966781904 +0200
ff19ae
@@ -1373,12 +1373,19 @@ start_debugger ()
ff19ae
 {
ff19ae
 #if defined (DEBUGGER) && defined (DEBUGGER_START_FILE)
ff19ae
   int old_errexit;
ff19ae
+  int r;
ff19ae
 
ff19ae
   old_errexit = exit_immediately_on_error;
ff19ae
   exit_immediately_on_error = 0;
ff19ae
 
ff19ae
-  maybe_execute_file (DEBUGGER_START_FILE, 1);
ff19ae
-  function_trace_mode = 1;
ff19ae
+  r = force_execute_file (DEBUGGER_START_FILE, 1);
ff19ae
+  if (r < 0)
ff19ae
+    {
ff19ae
+      internal_warning ("cannot start debugger; debugging mode disabled");
ff19ae
+      debugging_mode = function_trace_mode = 0;
ff19ae
+    }
ff19ae
+  else
ff19ae
+    function_trace_mode = 1;
ff19ae
 
ff19ae
   exit_immediately_on_error += old_errexit;
ff19ae
 #endif
ff19ae
diff -up bash-4.2/builtins/evalfile.c.old bash-4.2/builtins/evalfile.c
ff19ae
--- bash-4.2/builtins/evalfile.c.old	2015-05-15 00:52:01.357266353 +0200
ff19ae
+++ bash-4.2/builtins/evalfile.c	2015-05-15 00:52:08.734263236 +0200
ff19ae
@@ -125,7 +125,7 @@ file_error_and_exit:
ff19ae
 	}
ff19ae
 
ff19ae
       return ((flags & FEVAL_BUILTIN) ? EXECUTION_FAILURE
ff19ae
-      				      : ((errno == ENOENT) ? 0 : -1));
ff19ae
+      				      : ((errno == ENOENT && (flags & FEVAL_ENOENTOK) != 0) ? 0 : -1));
ff19ae
     }
ff19ae
 
ff19ae
   errfunc = ((flags & FEVAL_BUILTIN) ? builtin_error : internal_error);
ff19ae
diff -up bash-4.2/builtins/common.h.old bash-4.2/builtins/common.h
ff19ae
--- bash-4.2/builtins/common.h.old	2015-05-15 00:52:01.357266353 +0200
ff19ae
+++ bash-4.2/builtins/common.h	2015-05-15 00:52:08.734263236 +0200
ff19ae
@@ -170,6 +170,7 @@
ff19ae
 
ff19ae
 /* Functions from evalfile.c */
ff19ae
 extern int maybe_execute_file __P((const char *, int));
ff19ae
+extern int force_execute_file __P((const char *, int));
ff19ae
 extern int source_file __P((const char *, int));
ff19ae
 extern int fc_execute_file __P((const char *));
ff19ae