Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package yast2-x11 for openSUSE:Factory 
checked in at 2023-10-24 20:07:28
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-x11 (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-x11.new.24901 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-x11"

Tue Oct 24 20:07:28 2023 rev:25 rq:1119685 version:5.0.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-x11/yast2-x11.changes      2023-10-12 
23:39:40.647616222 +0200
+++ /work/SRC/openSUSE:Factory/.yast2-x11.new.24901/yast2-x11.changes   
2023-10-24 20:07:35.930870296 +0200
@@ -1,0 +2,7 @@
+Mon Oct 23 09:22:36 UTC 2023 - Stefan Hundhammer <shundham...@suse.com>
+
+- Prevent testX from hanging in second stage if no supported WM
+  can be started (bsc#1216297)
+- 5.0.2
+
+-------------------------------------------------------------------

Old:
----
  yast2-x11-5.0.1.tar.bz2

New:
----
  yast2-x11-5.0.2.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ yast2-x11.spec ++++++
--- /var/tmp/diff_new_pack.3DhSYV/_old  2023-10-24 20:07:36.542892547 +0200
+++ /var/tmp/diff_new_pack.3DhSYV/_new  2023-10-24 20:07:36.546892692 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-x11
-Version:        5.0.1
+Version:        5.0.2
 Release:        0
 Summary:        YaST2 - X11 support
 License:        GPL-2.0-only

++++++ yast2-x11-5.0.1.tar.bz2 -> yast2-x11-5.0.2.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-x11-5.0.1/package/yast2-x11.changes 
new/yast2-x11-5.0.2/package/yast2-x11.changes
--- old/yast2-x11-5.0.1/package/yast2-x11.changes       2023-10-11 
10:45:39.000000000 +0200
+++ new/yast2-x11-5.0.2/package/yast2-x11.changes       2023-10-23 
16:49:26.000000000 +0200
@@ -1,4 +1,11 @@
 -------------------------------------------------------------------
+Mon Oct 23 09:22:36 UTC 2023 - Stefan Hundhammer <shundham...@suse.com>
+
+- Prevent testX from hanging in second stage if no supported WM
+  can be started (bsc#1216297)
+- 5.0.2
+
+-------------------------------------------------------------------
 Tue Oct 10 11:09:32 UTC 2023 - Martin Vidner <mvid...@suse.com>
 
 - xkbctrl: use also kbd-model-map.xkb-generated (bsc#1211104)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-x11-5.0.1/package/yast2-x11.spec 
new/yast2-x11-5.0.2/package/yast2-x11.spec
--- old/yast2-x11-5.0.1/package/yast2-x11.spec  2023-10-11 10:45:39.000000000 
+0200
+++ new/yast2-x11-5.0.2/package/yast2-x11.spec  2023-10-23 16:49:26.000000000 
+0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-x11
-Version:        5.0.1
+Version:        5.0.2
 Release:        0
 Summary:        YaST2 - X11 support
 License:        GPL-2.0-only
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-x11-5.0.1/src/tools/testX.c 
new/yast2-x11-5.0.2/src/tools/testX.c
--- old/yast2-x11-5.0.1/src/tools/testX.c       2023-10-11 10:45:39.000000000 
+0200
+++ new/yast2-x11-5.0.2/src/tools/testX.c       2023-10-23 16:49:26.000000000 
+0200
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2012 Novell, Inc.
+ * Copyright (c) 2023 SUSE Linux LLC
  *
  * All Rights Reserved.
  *
@@ -19,37 +20,18 @@
  * find current contact information at www.novell.com.
  */
 
-/**************
-FILE          : testX.c
-***************
-PROJECT       : SaX ( SuSE advanced X configuration )
-              :
-BELONGS TO    : Configuration tool X11 version 4.x
-              : YaST2 inst-sys tools
-              :
-DESCRIPTION   : Checks if the X server is ok and sets the root
-              : window's color. Forks a child that creates an
-              : invisible X client. The child exits when the
-              : X server exits.
-              :
-              : Exit code: 0: X server ok, 1: no X server.
-              :
-STATUS        : Status: Up-to-date
-**************/
 
 #include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
+#include <signal.h>
 #include <X11/Xlib.h>
 #include <X11/Xatom.h>
 #include <X11/Xmu/CurUtil.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 
-//======================================
-// Defines
-//--------------------------------------
 #define ICEWM     "icewm"
 #define FVWM      "fvwm2"
 #define MWM       "mwm"
@@ -58,17 +40,13 @@
 #define ICEWMPREFS "preferences.yast2"
 #define FVWMRC     "fvwmrc.yast2"
 
-//======================================
-// Globals
-//--------------------------------------
 int screen;
 
-//======================================
-// Functions
-//--------------------------------------
 Cursor CreateCursorFromName(Display* dpy, const char* name);
 XColor NameToXColor(Display* dpy, const char* name, unsigned long pixel);
-int RunWindowManager(void);
+void RunWindowManager(void);
+void SigChildHandler(int sig_num);
+
 
 int main(int argc, char** argv)
 {
@@ -79,16 +57,20 @@
     char* cname;
     XColor color;
     Atom prop;
-    Pixmap save_pixmap = (Pixmap)None;
+    Pixmap save_pixmap = (Pixmap) None;
 
     //============================================
     // open display and check if we got a display
     //--------------------------------------------
     display = XOpenDisplay(NULL);
-    if (!display) {
+
+    if (!display)
+    {
        exit (1);
     }
-    if ((argc == 2) && (strcmp(argv[1], "--fast") == 0)) {
+
+    if ((argc == 2) && (strcmp(argv[1], "--fast") == 0))
+    {
        XCloseDisplay(display);
        exit (0);
     }
@@ -101,8 +83,10 @@
     root = RootWindow(display, screen);
     pixel = BlackPixel(display, screen);
 
-    if (XParseColor(display, DefaultColormap(display, screen), cname, &color)) 
{
-       if (XAllocColor(display, DefaultColormap(display, screen), &color)) {
+    if (XParseColor(display, DefaultColormap(display, screen), cname, &color))
+    {
+       if (XAllocColor(display, DefaultColormap(display, screen), &color))
+        {
            pixel = color.pixel;
        }
     }
@@ -110,17 +94,19 @@
     XClearWindow(display, root);
 
     //============================================
-    // set watch cursor
+    // set the cursor
     //--------------------------------------------
     cursor = CreateCursorFromName(display, "top_left_arrow");
-    if (cursor) {
+    if (cursor)
+    {
        XDefineCursor(display, root, cursor);
        XFreeCursor(display, cursor);
     }
 
     //============================================
-    // run the windowmanager (FVWM)
+    // start a window manager
     //--------------------------------------------
+    signal(SIGCHLD, SigChildHandler);
     RunWindowManager();
 
     //============================================
@@ -133,15 +119,13 @@
     XSetCloseDownMode(display, RetainPermanent);
 
     //============================================
-    // close display and exit
+    // Shut down
     //--------------------------------------------
     XCloseDisplay(display);
-    exit (0);
+    exit(0);
 }
 
-//=========================================
-// CreateCursorFromName
-//-----------------------------------------
+
 Cursor CreateCursorFromName(Display* dpy, const char* name)
 {
     XColor fg, bg;
@@ -154,53 +138,81 @@
     bg = NameToXColor(dpy, back_color, WhitePixel(dpy, screen));
 
     i = XmuCursorNameToIndex(name);
+
     if (i == -1)
        return (Cursor) 0;
     fid = XLoadFont (dpy, "cursor");
     if (!fid)
        return (Cursor) 0;
+
     return XCreateGlyphCursor(dpy, fid, fid, i, i+1, &fg, &bg);
 }
 
-//=========================================
-// NameToXColor
-//-----------------------------------------
+
 XColor NameToXColor(Display* dpy, const char* name, unsigned long pixel)
 {
     XColor c;
 
-    if (!name || !*name) {
+    if (!name || !*name)
+    {
        c.pixel = pixel;
        XQueryColor(dpy, DefaultColormap(dpy, screen), &c);
-    } else if (!XParseColor(dpy, DefaultColormap(dpy, screen), name, &c)) {
-       fprintf(stderr, "testX: unknown color or bad color format: %s\n", name);
+    }
+    else if (!XParseColor(dpy, DefaultColormap(dpy, screen), name, &c))
+    {
+       fprintf(stderr, "\ntestX: unknown color or bad color format: %s\n", 
name);
        exit(1);
     }
+
     return c;
 }
 
-//=========================================
-// RunWindowManager
-//-----------------------------------------
-int RunWindowManager(void)
+
+void RunWindowManager(void)
 {
-    int wmpid = fork();
-    switch (wmpid)
+    int wm_pid = fork();
+
+    switch ( wm_pid )
     {
        case -1:
-           return 0;
-           break;
+            // fork() failed
+           fprintf(stderr, "\ntestX: FATAL: fork() failed\n");
+            exit(2);
+
        case 0:
+            // Child process: Start a window manager.
+
            setenv("ICEWM_PRIVCFG", "/etc/icewm/yast2", 1);
            execlp(ICEWM, "icewm", "-c", ICEWMPREFS, "-t", "yast2", NULL);
+
            execlp(FVWM, "fvwm2", "-f", FVWMRC, NULL);
            execlp(MWM, "mwm", NULL);
            execlp(TWM, "twm", NULL);
-           fprintf(stderr, "testX: could not run any windowmanager");
-           return 0;
-           break;
+
+            // exec..() only returns if the process could not be started.
+           fprintf(stderr, "\ntestX: Could not run any windowmanager\n");
+
+            // Exit, don't return. We don't want to return to main() in the
+            // child process to do more X11 calls with the parent process's X
+            // connection.
+            exit(1);
+
        default:
-           waitpid(wmpid, NULL, WNOHANG | WUNTRACED);
+            // Parent process
+
+            // fprintf(stderr, "\ntestX: Started child process %d to start a 
window manager\n", wm_pid);
+            break;
+    }
+}
+
+
+void SigChildHandler(int sig_num)
+{
+    int exit_status = -1;
+    int pid = waitpid(0, &exit_status, WNOHANG | WUNTRACED);
+
+    if (pid != 0 && exit_status > 0)
+    {
+        fprintf(stderr, "\ntestX: Child process %d exited with %d\n", pid, 
exit_status);
     }
-    return 1;
 }

Reply via email to