rcolebaugh / rpms / bash

Forked from rpms/bash 2 years ago
Clone

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

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