[PATCH] When in devel mode, do not catch tracebacks, we want the core file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



- also make sure the terminal is in usable state when back in init
---
 loader/init.c   |   11 ++++++++++-
 loader/loader.c |   21 ++++++++++++++++++---
 2 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/loader/init.c b/loader/init.c
index 820d3ef..fff015c 100644
--- a/loader/init.c
+++ b/loader/init.c
@@ -566,7 +566,7 @@ int main(int argc, char **argv) {
         fatal_error(1);
     printf("done\n");
 
-    /* unless the user specifies that they want utf8 */
+    /* check for development mode early */
     int fdn;
     if ((fdn = open("/proc/cmdline", O_RDONLY, 0)) != -1) {
         int len = read(fdn, buf, sizeof(buf) - 1);
@@ -655,11 +655,13 @@ int main(int argc, char **argv) {
 
 #if !defined(__s390__) && !defined(__s390x__)
     static struct termios orig_cmode;
+    static int            orig_flags;
     struct termios cmode, mode;
     int cfd;
     
     cfd =  open("/dev/console", O_RDONLY);
     tcgetattr(cfd,&orig_cmode);
+    orig_flags = fcntl(cfd, F_GETFL);
     close(cfd);
 
     cmode = orig_cmode;
@@ -890,6 +892,13 @@ int main(int argc, char **argv) {
 
     if (!WIFEXITED(waitStatus) ||
         (WIFEXITED(waitStatus) && WEXITSTATUS(waitStatus))) {
+
+        /* Restore terminal */
+        cfd =  open("/dev/console", O_RDONLY);
+        tcsetattr(cfd, TCSANOW, &orig_cmode);
+        fcntl(cfd, F_SETFL, orig_flags);
+        close(cfd);
+
         shutdown_method = DELAYED_REBOOT;
         printf("install exited abnormally [%d/%d] ", WIFEXITED(waitStatus),
                                                      WEXITSTATUS(waitStatus));
diff --git a/loader/loader.c b/loader/loader.c
index 8287311..bab66c0 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -1765,7 +1765,10 @@ void loaderUsrXHandler(int signum) {
     init_sig = signum;
 }
 
-static int anaconda_trace_init(void) {
+static int anaconda_trace_init() {
+    int isDevelMode = 0;
+    char buf[1024];
+
 #ifdef USE_MTRACE
     setenv("MALLOC_TRACE","/malloc",1);
     mtrace();
@@ -1775,8 +1778,20 @@ static int anaconda_trace_init(void) {
      * is well before we might take a SEGV, so they'll go to tty8 */
     initializeTtys();
 
-    /* set up signal handler */
-    setupBacktrace();
+    /* check for development mode early */
+    int fdn;
+    if ((fdn = open("/proc/cmdline", O_RDONLY, 0)) != -1) {
+        int len = read(fdn, buf, sizeof(buf) - 1);
+        close(fdn);
+        if (len > 0 && strstr(buf, "devel")) {
+            printf("Enabling development mode - cores will be dumped\n");
+            isDevelMode = 1;
+        }
+    }
+
+    /* set up signal handler unless we want it to crash in devel mode */
+    if(!isDevelMode)
+        setupBacktrace();
 
     return 0;
 }
-- 
1.6.6.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux