From patchwork Thu Oct 6 16:05:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mehmet Tekman X-Patchwork-Id: 43179 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 4CECB27BBEA; Thu, 6 Oct 2022 20:53:22 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 6F56927BBE9 for ; Thu, 6 Oct 2022 20:53:18 +0100 (BST) Received: from localhost ([::1]:50496 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ogWvl-0005sz-LD for patchwork@mira.cbaines.net; Thu, 06 Oct 2022 15:53:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56094) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogUj5-0002LE-EC for guix-patches@gnu.org; Thu, 06 Oct 2022 13:32:08 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:34388) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ogUj4-0001l8-Ih for guix-patches@gnu.org; Thu, 06 Oct 2022 13:32:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ogUj4-0006CU-DF for guix-patches@gnu.org; Thu, 06 Oct 2022 13:32:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#58341] [PATCH] Add x11vnc recipe Resent-From: Mehmet Tekman Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 06 Oct 2022 17:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 58341 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 58341@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.166507747823781 (code B ref -1); Thu, 06 Oct 2022 17:32:02 +0000 Received: (at submit) by debbugs.gnu.org; 6 Oct 2022 17:31:18 +0000 Received: from localhost ([127.0.0.1]:33466 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ogUiK-0006BU-NI for submit@debbugs.gnu.org; Thu, 06 Oct 2022 13:31:18 -0400 Received: from lists.gnu.org ([209.51.188.17]:32972) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ogTOE-0001fA-PU for submit@debbugs.gnu.org; Thu, 06 Oct 2022 12:06:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45380) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogTO2-0000A7-9J for guix-patches@gnu.org; Thu, 06 Oct 2022 12:06:19 -0400 Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]:37604) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ogTO0-0005BZ-2E for guix-patches@gnu.org; Thu, 06 Oct 2022 12:06:13 -0400 Received: by mail-lj1-x232.google.com with SMTP id by36so2764001ljb.4 for ; Thu, 06 Oct 2022 09:06:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=zZauLJV0a8/Wx6UKjAwqIUPwNWNU5k1nYOK9yZSTlGw=; b=JkrO6Em7r7HpW88SBKFnMzSqtODcqg/CenBPZvmHcrjwFzKGABkcsaZaSwIzshrS08 +NRRrvGA2DHfLm4fq4pjuybMVr2+ckVWrzv7hE6anapilP3SXILo13p9roOgucZ9BW2y /DkHrvmJA11DtX+SZQOaGXymnZv4xJW65mYlwrHzq4Ijhg+Av+h+9LB89AAS6Vz5V8xf YexzRybN+/41oH7d7Fm8FVtOaQxSkZISMpxG+D8x/anTk2NjRUGcZlkDeRUYDyUu9VNv 5YmTtrDCRJ3M6eM3Gj428pLx0yUA4Cv+VVb6UYDCrEEAwBLV7rogR2hJKGYAW5zwMkt9 Gczg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=zZauLJV0a8/Wx6UKjAwqIUPwNWNU5k1nYOK9yZSTlGw=; b=13f4L3TUl+bDxE4RYXOoh2wPxBkLXqZIhI4jtB9rS1eZIB066YPaiz/ho7z7WDsSMz HhVvBjf0JYhQAtCMYSK7DkuLvDneQIjtKZcJBR8T+yuByJyH7hFuXJBkPGzZh5lulwk8 iE0ux4nyEWSRFhsLYwywM1a/UHw3+IFQN647ojSN3yKYf1uBCwAkfBqyLmv3TnwGFINh 8zB1pnwhu3gAp1C2dqUsCm3kqZfPvkO5DyCaUDNTHcDRjA37Fkfsz2nHOwhDvud/0iuz 5cPdq6bieT0b4z+usuXnblHEntnnNET1oV7U9YXBF3bCbV8fKUC1/JtWY5gSb6sf/8f5 //3A== X-Gm-Message-State: ACrzQf12nutzXmNM5Tz/l8zLSq8E+E/yjIPxDdbvTbX9q4XQzbgRwmdW eN6uspRuXfSBHa27+3995rcS7XusRsrIRjRQtmvPCe9nn7s4Ww== X-Google-Smtp-Source: AMsMyM4B44XUf1Ux4E1WCeSiapi1qu3s2gcAOXT9pka2V48C0I6WpNk3xAWIqNHZ/dVhyKMoyKmNwLWvWZ1PbOvlD60= X-Received: by 2002:a05:651c:1991:b0:26c:296f:4b32 with SMTP id bx17-20020a05651c199100b0026c296f4b32mr137117ljb.51.1665072367255; Thu, 06 Oct 2022 09:06:07 -0700 (PDT) MIME-Version: 1.0 From: Mehmet Tekman Date: Thu, 6 Oct 2022 18:05:31 +0200 Message-ID: Received-SPF: pass client-ip=2a00:1450:4864:20::232; envelope-from=mtekman89@gmail.com; helo=mail-lj1-x232.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 06 Oct 2022 13:31:15 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Mailman-Approved-At: Thu, 06 Oct 2022 15:52:13 -0400 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches --- gnu/packages/patches/x11vnc-gcc10-fix.patch | 42 ++++++++++ ...c-scan-limit-access-to-shared-memory.patch | 22 ++++++ .../patches/x11vnc-xfc-null-ptr.patch | 29 +++++++ gnu/packages/x11vnc.scm | 79 +++++++++++++++++++ 4 files changed, 172 insertions(+) create mode 100644 gnu/packages/patches/x11vnc-gcc10-fix.patch create mode 100644 gnu/packages/patches/x11vnc-scan-limit-access-to-shared-memory.patch create mode 100644 gnu/packages/patches/x11vnc-xfc-null-ptr.patch create mode 100644 gnu/packages/x11vnc.scm + (license license:gpl2)))) diff --git a/gnu/packages/patches/x11vnc-gcc10-fix.patch b/gnu/packages/patches/x11vnc-gcc10-fix.patch new file mode 100644 index 0000000000..a32d5785d9 --- /dev/null +++ b/gnu/packages/patches/x11vnc-gcc10-fix.patch @@ -0,0 +1,42 @@ +From a48b0b1cd887d7f3ae67f525d7d334bd2feffe60 Mon Sep 17 00:00:00 2001 +From: Alexander Tsoy +Date: Tue, 28 Jan 2020 22:21:01 +0300 +Subject: [PATCH] Fix build with -fno-common + +GCC 10 defaults to -fno-common +--- + src/util.c | 3 +++ + src/util.h | 6 +++--- + 2 files changed, 6 insertions(+), 3 deletions(-) + +diff --git a/src/util.c b/src/util.c +index a82a1a42..6a52ebf4 100644 +--- a/src/util.c ++++ b/src/util.c +@@ -47,6 +47,9 @@ int hxl = 0; + #ifdef LIBVNCSERVER_HAVE_LIBPTHREAD + MUTEX(x11Mutex); + MUTEX(scrollMutex); ++MUTEX(clientMutex); ++MUTEX(inputMutex); ++MUTEX(pointerMutex); + #endif + + int nfix(int i, int n); +diff --git a/src/util.h b/src/util.h +index 35c1afd2..99b5dd1d 100644 +--- a/src/util.h ++++ b/src/util.h +@@ -102,9 +102,9 @@ extern struct timeval _mysleep; + #ifdef LIBVNCSERVER_HAVE_LIBPTHREAD + extern MUTEX(x11Mutex); + extern MUTEX(scrollMutex); +-MUTEX(clientMutex); +-MUTEX(inputMutex); +-MUTEX(pointerMutex); ++extern MUTEX(clientMutex); ++extern MUTEX(inputMutex); ++extern MUTEX(pointerMutex); + #endif + + #define X_INIT INIT_MUTEX(x11Mutex) diff --git a/gnu/packages/patches/x11vnc-scan-limit-access-to-shared-memory.patch b/gnu/packages/patches/x11vnc-scan-limit-access-to-shared-memory.patch new file mode 100644 index 0000000000..5424094434 --- /dev/null +++ b/gnu/packages/patches/x11vnc-scan-limit-access-to-shared-memory.patch @@ -0,0 +1,22 @@ +From 69eeb9f7baa14ca03b16c9de821f9876def7a36a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Gu=C3=A9nal=20DAVALAN?= +Date: Wed, 18 Nov 2020 08:40:45 +0100 +Subject: [PATCH] scan: limit access to shared memory segments to current user + +--- + src/scan.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/scan.c b/src/scan.c +index 43e00d20..12994d52 100644 +--- a/src/scan.c ++++ b/src/scan.c +@@ -320,7 +320,7 @@ static int shm_create(XShmSegmentInfo *shm, XImage **ximg_ptr, int w, int h, + + #if HAVE_XSHM + shm->shmid = shmget(IPC_PRIVATE, +- xim->bytes_per_line * xim->height, IPC_CREAT | 0777); ++ xim->bytes_per_line * xim->height, IPC_CREAT | 0600); + + if (shm->shmid == -1) { + rfbErr("shmget(%s) failed.\n", name); diff --git a/gnu/packages/patches/x11vnc-xfc-null-ptr.patch b/gnu/packages/patches/x11vnc-xfc-null-ptr.patch new file mode 100644 index 0000000000..65f339d716 --- /dev/null +++ b/gnu/packages/patches/x11vnc-xfc-null-ptr.patch @@ -0,0 +1,29 @@ +From 95a10ab64c2dbbec2c8dad91a5ffb73a0d68474b Mon Sep 17 00:00:00 2001 +From: Jonathan Liu +Date: Mon, 16 Mar 2020 20:04:06 +1100 +Subject: [PATCH] src/cursor: fix xfc NULL pointer dereference + +xfc->width and xfc->height for the XFixes cursor image returned from +XFixesGetCursorImage(dpy) are accessed without first checking that xfc +is not NULL. This can result in the server sometimes crashing when +moving a Google Chrome window. + +Fixes: 37c946191a0f ("Broken cursor bugfix for 64 bit systems (#49)") +Signed-off-by: Jonathan Liu +--- + src/cursor.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/cursor.c b/src/cursor.c +index 39e73a69..74a08c69 100644 +--- a/src/cursor.c ++++ b/src/cursor.c +@@ -1311,7 +1311,7 @@ static int get_exact_cursor(int init) { + + /* retrieve the cursor info + pixels from server: */ + xfc = XFixesGetCursorImage(dpy); +- { ++ if (xfc) { + /* 2017-07-09, Stephan Fuhrmann: This fixes an implementation flaw for 64 bit systems. + * The XFixesCursorImage structure says xfc->pixels is (unsigned long*) in the structure, but + * the protocol spec says it's 32 bit per pixel diff --git a/gnu/packages/x11vnc.scm b/gnu/packages/x11vnc.scm new file mode 100644 index 0000000000..55c51305b3 --- /dev/null +++ b/gnu/packages/x11vnc.scm @@ -0,0 +1,79 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2022 Mehmet Tekman +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + + +(define-module (gnu packages x11vnc) + #:use-module (guix packages) + #:use-module (gnu packages) + #:use-module (gnu packages perl) + #:use-module (gnu packages tcl) + #:use-module (gnu packages pkg-config) + #:use-module (gnu packages xorg) + #:use-module (gnu packages tls) + #:use-module (guix git-download) + #:use-module (guix build-system gnu) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (gnu packages autotools) + #:use-module (gnu packages avahi) + #:use-module (gnu packages vnc) + #:use-module (gnu packages compression) + #:use-module (gnu packages image)) + +(define-public x11vnc + (let ((commit "4ca006fed80410bd9b061a1519bd5d9366bb0bc8") + (version "0.9.16") + (revision "1")) + (package + (name "x11vnc") + (version (git-version version revision commit)) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/LibVNC/x11vnc") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1g652mmi79pfq4p5p7spaswa164rpzjhc5rn2phy5pm71lm0vib1")) + (patches + (search-patches "x11vnc-xfc-null-ptr.patch" + "x11vnc-gcc10-fix.patch" + "x11vnc-scan-limit-access-to-shared-memory.patch")))) + (build-system gnu-build-system) + (arguments + '(#:phases + (modify-phases + %standard-phases + (add-before 'bootstrap 'delete-premature-configure + (lambda _ (substitute* "./autogen.sh" + ((".*/configure") ""))))))) + (native-inputs (list + ;; [optional requirements] + ;; perl tk + autoconf automake autobuild pkg-config avahi libvnc + libx11 libxcomposite libxdamage libxext libxfixes libxi + libxinerama libxrandr libxtst + openssl xdpyinfo zlib libjpeg-turbo xf86-video-dummy)) + (synopsis "VNC server for real X displays") + (home-page "https://github.com/LibVNC/x11vnc") + (description + "x11vnc allows one to view remotely and interact with real X +displays (i.e. a display corresponding to a physical monitor, keyboard, and +mouse) with any VNC viewer. In this way it plays the role for Unix/X11 that +WinVNC plays for Windows.")