From: Brad Smith Subject: Re: mplayer generates X11 errors and no longer renders video To: Matthieu Herrb Cc: bugs@openbsd.org, ports@openbsd.org Date: Sun, 1 Dec 2024 19:13:57 -0500 On 2024-12-01 9:57 a.m., Matthieu Herrb wrote: > On Fri, Nov 29, 2024 at 09:07:16PM -0500, Brad Smith wrote: >> On 2024-11-29 4:10 p.m., Stuart Henderson wrote: >>> dmesg is missing. It would also be helpful to include pkg_info to see >>> which packages are installed (both for version numbers of things, and >>> to see if anything vaapi-related is there). >> >> The last part is not relevant for MPlayer, but more details are necessary. >> > Hi Brad, > > I can reproduce this with mplayer-20240803. This is caused by mplayer > still using the 20th century XSHM api and having changed shmget() to > create the shared memory segment with mode 0600 instead of 0777. > > The patch below to the mplayer port should fix it. > > ok ? > > Index: Makefile > =================================================================== > RCS file: /local/cvs/ports/x11/mplayer/Makefile,v > diff -u -p -u -r1.332 Makefile > --- Makefile 29 Nov 2024 09:52:09 -0000 1.332 > +++ Makefile 1 Dec 2024 14:56:36 -0000 > @@ -3,7 +3,7 @@ COMMENT= movie player supporting many fo > V= 20240803 > FFMPEG_V= 6.1.2 > DISTNAME= mplayer-${V} > -REVISION= 0 > +REVISION= 1 > CATEGORIES= x11 multimedia > SITES= https://comstyle.com/source/ > EXTRACT_SUFX= .tar.xz > Index: patches/patch-libvo_vo_x11_c > =================================================================== > RCS file: patches/patch-libvo_vo_x11_c > diff -N patches/patch-libvo_vo_x11_c > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-libvo_vo_x11_c 1 Dec 2024 14:56:36 -0000 > @@ -0,0 +1,12 @@ > +Index: libvo/vo_x11.c > +--- libvo/vo_x11.c.orig > ++++ libvo/vo_x11.c > +@@ -150,7 +150,7 @@ static void getMyXImage(void) > + } > + Shminfo[0].shmid = shmget(IPC_PRIVATE, > + myximage->bytes_per_line * > +- myximage->height, IPC_CREAT | SHM_R | SHM_W); > ++ myximage->height, IPC_CREAT | 0777); > + if (Shminfo[0].shmid< 0) + { + XDestroyImage(myximage); Index: patches/patch-libvo_vo_xv_c > =================================================================== > RCS file: patches/patch-libvo_vo_xv_c diff -N > patches/patch-libvo_vo_xv_c --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-libvo_vo_xv_c 1 Dec 2024 14:56:36 -0000 @@ -0,0 > +1,12 @@ +Index: libvo/vo_xv.c +--- libvo/vo_xv.c.orig ++++ > libvo/vo_xv.c +@@ -279,7 +279,7 @@ static void allocate_xvimage(int > foo) + &Shminfo[foo]); + + Shminfo[foo].shmid = +- shmget(IPC_PRIVATE, > xvimage[foo]->data_size, IPC_CREAT | SHM_R | SHM_W); > ++ shmget(IPC_PRIVATE, xvimage[foo]->data_size, IPC_CREAT | 0777); > + Shminfo[foo].shmaddr = (char *) shmat(Shminfo[foo].shmid, 0, 0); > + Shminfo[foo].readOnly = False; > + Yup, here is the original commit. r38419 | ib | 2023-04-22 18:58:52 -0400 (Sat, 22 Apr 2023) | 10 lines Use appropriate shared memory permissions. An umask setting does not affect the permissions assigned to System V IPC objects created by the process using shmget(). Original patch by Vladimir D. Seleznev, vseleznv altlinux org, slightly modified by committer. Reported by Wladmis, dev wladmis org. $ svn diff -r38418:38419 Index: gui/wm/ws.c =================================================================== --- gui/wm/ws.c (revision 38418) +++ gui/wm/ws.c (revision 38419) @@ -1357,7 +1357,7 @@              mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0);          } -        win->Shminfo.shmid = shmget(IPC_PRIVATE, win->xImage->bytes_per_line * win->xImage->height, IPC_CREAT | 0777); +        win->Shminfo.shmid = shmget(IPC_PRIVATE, win->xImage->bytes_per_line * win->xImage->height, IPC_CREAT | SHM_R | SHM_W);          if (win->Shminfo.shmid < 0) {              XDestroyImage(win->xImage); Index: libvo/vo_x11.c =================================================================== --- libvo/vo_x11.c      (revision 38418) +++ libvo/vo_x11.c      (revision 38419) @@ -150,7 +150,7 @@          }          Shminfo[0].shmid = shmget(IPC_PRIVATE,                                    myximage->bytes_per_line * -                                  myximage->height, IPC_CREAT | 0777); +                                  myximage->height, IPC_CREAT | SHM_R | SHM_W);          if (Shminfo[0].shmid < 0)          {              XDestroyImage(myximage); Index: libvo/vo_xv.c =================================================================== --- libvo/vo_xv.c       (revision 38418) +++ libvo/vo_xv.c       (revision 38419) @@ -279,7 +279,7 @@                                           &Shminfo[foo]);          Shminfo[foo].shmid = -            shmget(IPC_PRIVATE, xvimage[foo]->data_size, IPC_CREAT | 0777); +            shmget(IPC_PRIVATE, xvimage[foo]->data_size, IPC_CREAT | SHM_R | SHM_W);          Shminfo[foo].shmaddr = (char *) shmat(Shminfo[foo].shmid, 0, 0);          Shminfo[foo].readOnly = False; Index: libvo/vo_xvmc.c =================================================================== --- libvo/vo_xvmc.c     (revision 38418) +++ libvo/vo_xvmc.c     (revision 38419) @@ -203,7 +203,7 @@          if (!xvimage->data_size)              goto shmgetfail; -        Shminfo.shmid    = shmget(IPC_PRIVATE, xvimage->data_size, IPC_CREAT | 0777); +        Shminfo.shmid    = shmget(IPC_PRIVATE, xvimage->data_size, IPC_CREAT | SHM_R | SHM_W);          if (Shminfo.shmid == -1)              goto shmgetfail;          Shminfo.shmaddr  = (char *) shmat(Shminfo.shmid, 0, 0);