From unknown Mon Aug 18 11:32:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24218: 25.1.50; server-name, server-socket-dir and daemon start through systemd socket Resent-From: Vladimir Lomov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 13 Aug 2016 16:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 24218 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 24218@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.147110619329171 (code B ref -1); Sat, 13 Aug 2016 16:37:02 +0000 Received: (at submit) by debbugs.gnu.org; 13 Aug 2016 16:36:33 +0000 Received: from localhost ([127.0.0.1]:56526 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYbvE-0007aQ-R6 for submit@debbugs.gnu.org; Sat, 13 Aug 2016 12:36:33 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40607) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYbvC-0007aC-CB for submit@debbugs.gnu.org; Sat, 13 Aug 2016 12:36:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bYbv4-0002Kg-IF for submit@debbugs.gnu.org; Sat, 13 Aug 2016 12:36:25 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:53472) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bYbv4-0002Kb-CM for submit@debbugs.gnu.org; Sat, 13 Aug 2016 12:36:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59810) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bYbv0-0000w9-8P for bug-gnu-emacs@gnu.org; Sat, 13 Aug 2016 12:36:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bYbuv-0002Fi-Q5 for bug-gnu-emacs@gnu.org; Sat, 13 Aug 2016 12:36:17 -0400 Received: from forward12h.cmail.yandex.net ([87.250.230.154]:48331) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bYbuu-0002E4-9T for bug-gnu-emacs@gnu.org; Sat, 13 Aug 2016 12:36:13 -0400 Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [77.88.29.84]) by forward12h.cmail.yandex.net (Yandex) with ESMTP id 7B19321503 for ; Sat, 13 Aug 2016 19:35:59 +0300 (MSK) Received: from smtp1p.mail.yandex.net (localhost.localdomain [127.0.0.1]) by smtp1p.mail.yandex.net (Yandex) with ESMTP id 71A9817804FB for ; Sat, 13 Aug 2016 19:35:59 +0300 (MSK) Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id RlBCBJKoPA-ZwL0TXdX; Sat, 13 Aug 2016 19:35:58 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1471106158; bh=d+ifMVWlrBA55f8zdgE5uLP9RweKJzTD3+eBkTgCJ88=; h=From:To:Subject:Date:Message-ID; b=nTIPU+mCdCHEWCBZM4rIuzAP21PwAaO0Vtu6PnBZ5HxWt7G62dwCp+IF+SafBPtvm yLR0HtqWj1zqHqTZSA/uJLC68DPkl+giP77oaaIXc+Lm5/qGA4L2GzBubYahg91VEY oUZMaL++x1Ts47KDbT1H7Y56W2F/C/F2eObcHrg8= Authentication-Results: smtp1p.mail.yandex.net; dkim=pass header.i=@yandex.ru X-Yandex-Suid-Status: 1 0 From: Vladimir Lomov Date: Sun, 14 Aug 2016 00:35:57 +0800 Message-ID: <87popclj82.fsf@yandex.ru> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Hello, first of all I not sure if this is a bug report or more likely it is a feature request. Recently Emacs got code to start daemon by means of systemd. For this one needs to create two files: `emacs.socket` and `emacs.service`, for example, the content of these files can be found in the manual. The problem is that when emacs daemon is started this way any it's client doesn't have correct values for `server-name` and `server-socket-dir` variables. Moreover, attemp to set these variables manually in `.emacs` triggers (that is not surprise, I think) failure in emacs daemon start. I think it should be possible to set these variables to correct values in `.emacs` that don't cause failure in emacs daemon start, especially taking into account that there is `:use-external-socket` variable. To illustrate the situation consider the following `emacs.socket` file [Socket] ListenStream=%t/emacs [Install] WantedBy=sockets.target almost litteraly copied from Emacs manual and following `emacs.service` file [Unit] Description=Emacs [Service] Type=forking ExecStart=/path/to/emacs --daemon ExecStop=/path/to/emacsclient --eval "(kill-emacs)" Restart=always [Install] WantedBy=default.target If one starts `emacs.socket` file $ systemctl --user start emacs.socket and connect to the daemon (which is not started yet) by means of the socket file assuming that `.emacs` is empty $ emacsclient -c -s /run/user/1000/emacs then all is Ok except the values of `server-name` and `server-socket-dir`: they are wrong (they have "default" values: `server` and `/tmp/emacs1000`). If one would use `.emacs` with settings of these variables (setq server-name "emacs" server-socket-dir "/run/user/1000") and run the same command for `emacsclient` in clean conditions (this means that `service` and `socket` must be stopped before that and `socket` must be started again) one finds that daemon is not started. P.S. Sorry if this description isn't clean enough. In GNU Emacs 25.1.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.20.8) of 2016-08-11 built on smoon6-1.vl-lomov.ru Repository revision: cd3524061346dec4ec820c98b6ca8046eda290c3 Windowing system distributor 'The X.Org Foundation', version 11.0.11804000 Recent messages: Auto-saving...done Saving file /home/vladimir/works/org/.git/COMMIT_EDITMSG... bzip2ing .COMMIT_EDITMSG.~undo-tree~.bz2...done Wrote /home/vladimir/works/org/.git/.COMMIT_EDITMSG.~undo-tree~.bz2 Wrote /home/vladimir/works/org/.git/COMMIT_EDITMSG Git finished [2 times] Type C-h i to view popup manual, ? to describe an argument or action. Running git push -v origin master:refs/heads/master [2 times] Git finished [2 times] When done with this frame, type C-x 5 0 Configured using: 'configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libexecdir=/usr/lib --with-x-toolkit=gtk3 --without-gconf 'CFLAGS=-march=x86-64 -mtune=native -O2 -pipe -fstack-protector-strong' LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro CPPFLAGS=-D_FORTIFY_SOURCE=2' Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 LIBSYSTEMD Important settings: value of $LC_COLLATE: C value of $LANG: ru_RU.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: global-undo-tree-mode: t undo-tree-mode: t diff-auto-refine-mode: t magit-auto-revert-mode: t global-git-commit-mode: t global-auto-complete-mode: t auto-complete-mode: t pdf-occur-global-minor-mode: t shell-dirtrack-mode: t ido-everywhere: t display-time-mode: t show-paren-mode: t tooltip-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: /usr/share/emacs/site-lisp/org/org-list hides /usr/share/emacs/25.1.50/lisp/org/org-list /usr/share/emacs/site-lisp/org/org-element hides /usr/share/emacs/25.1.50/lisp/org/org-element /usr/share/emacs/site-lisp/org/org-mouse hides /usr/share/emacs/25.1.50/lisp/org/org-mouse /usr/share/emacs/site-lisp/org/org-attach hides /usr/share/emacs/25.1.50/lisp/org/org-attach /usr/share/emacs/site-lisp/org/org-agenda hides /usr/share/emacs/25.1.50/lisp/org/org-agenda /usr/share/emacs/site-lisp/org/ob-screen hides /usr/share/emacs/25.1.50/lisp/org/ob-screen /usr/share/emacs/site-lisp/org/ox-html hides /usr/share/emacs/25.1.50/lisp/org/ox-html /usr/share/emacs/site-lisp/org/ob-sass hides /usr/share/emacs/25.1.50/lisp/org/ob-sass /usr/share/emacs/site-lisp/org/ob-ditaa hides /usr/share/emacs/25.1.50/lisp/org/ob-ditaa /usr/share/emacs/site-lisp/org/ob-keys hides /usr/share/emacs/25.1.50/lisp/org/ob-keys /usr/share/emacs/site-lisp/org/ob-core hides /usr/share/emacs/25.1.50/lisp/org/ob-core /usr/share/emacs/site-lisp/org/ob-ocaml hides /usr/share/emacs/25.1.50/lisp/org/ob-ocaml /usr/share/emacs/site-lisp/org/ob-comint hides /usr/share/emacs/25.1.50/lisp/org/ob-comint /usr/share/emacs/site-lisp/org/ob-ruby hides /usr/share/emacs/25.1.50/lisp/org/ob-ruby /usr/share/emacs/site-lisp/org/ob-calc hides /usr/share/emacs/25.1.50/lisp/org/ob-calc /usr/share/emacs/site-lisp/org/ob-plantuml hides /usr/share/emacs/25.1.50/lisp/org/ob-plantuml /usr/share/emacs/site-lisp/org/org-macro hides /usr/share/emacs/25.1.50/lisp/org/org-macro /usr/share/emacs/site-lisp/org/org-irc hides /usr/share/emacs/25.1.50/lisp/org/org-irc /usr/share/emacs/site-lisp/org/org-inlinetask hides /usr/share/emacs/25.1.50/lisp/org/org-inlinetask /usr/share/emacs/site-lisp/org/ox-beamer hides /usr/share/emacs/25.1.50/lisp/org/ox-beamer /usr/share/emacs/site-lisp/org/org-info hides /usr/share/emacs/25.1.50/lisp/org/org-info /usr/share/emacs/site-lisp/org/org-indent hides /usr/share/emacs/25.1.50/lisp/org/org-indent /usr/share/emacs/site-lisp/org/ox-ascii hides /usr/share/emacs/25.1.50/lisp/org/ox-ascii /usr/share/emacs/site-lisp/org/org-id hides /usr/share/emacs/25.1.50/lisp/org/org-id /usr/share/emacs/site-lisp/org/org-habit hides /usr/share/emacs/25.1.50/lisp/org/org-habit /usr/share/emacs/site-lisp/org/org-gnus hides /usr/share/emacs/25.1.50/lisp/org/org-gnus /usr/share/emacs/site-lisp/org/org-footnote hides /usr/share/emacs/25.1.50/lisp/org/org-footnote /usr/share/emacs/site-lisp/org/org-timer hides /usr/share/emacs/25.1.50/lisp/org/org-timer /usr/share/emacs/site-lisp/org/org-feed hides /usr/share/emacs/25.1.50/lisp/org/org-feed /usr/share/emacs/site-lisp/org/ox hides /usr/share/emacs/25.1.50/lisp/org/ox /usr/share/emacs/site-lisp/org/org-faces hides /usr/share/emacs/25.1.50/lisp/org/org-faces /usr/share/emacs/site-lisp/org/ox-texinfo hides /usr/share/emacs/25.1.50/lisp/org/ox-texinfo /usr/share/emacs/site-lisp/org/org-eshell hides /usr/share/emacs/25.1.50/lisp/org/org-eshell /usr/share/emacs/site-lisp/org/org-table hides /usr/share/emacs/25.1.50/lisp/org/org-table /usr/share/emacs/site-lisp/org/org-entities hides /usr/share/emacs/25.1.50/lisp/org/org-entities /usr/share/emacs/site-lisp/org/org-src hides /usr/share/emacs/25.1.50/lisp/org/org-src /usr/share/emacs/site-lisp/org/org-rmail hides /usr/share/emacs/25.1.50/lisp/org/org-rmail /usr/share/emacs/site-lisp/org/org-docview hides /usr/share/emacs/25.1.50/lisp/org/org-docview /usr/share/emacs/site-lisp/org/org-protocol hides /usr/share/emacs/25.1.50/lisp/org/org-protocol /usr/share/emacs/site-lisp/org/org-datetree hides /usr/share/emacs/25.1.50/lisp/org/org-datetree /usr/share/emacs/site-lisp/org/org-plot hides /usr/share/emacs/25.1.50/lisp/org/org-plot /usr/share/emacs/site-lisp/org/org-ctags hides /usr/share/emacs/25.1.50/lisp/org/org-ctags /usr/share/emacs/site-lisp/org/ox-publish hides /usr/share/emacs/25.1.50/lisp/org/ox-publish /usr/share/emacs/site-lisp/org/org-crypt hides /usr/share/emacs/25.1.50/lisp/org/org-crypt /usr/share/emacs/site-lisp/org/ox-org hides /usr/share/emacs/25.1.50/lisp/org/ox-org /usr/share/emacs/site-lisp/org/org-compat hides /usr/share/emacs/25.1.50/lisp/org/org-compat /usr/share/emacs/site-lisp/org/org-pcomplete hides /usr/share/emacs/25.1.50/lisp/org/org-pcomplete /usr/share/emacs/site-lisp/org/org-colview hides /usr/share/emacs/25.1.50/lisp/org/org-colview /usr/share/emacs/site-lisp/org/org-clock hides /usr/share/emacs/25.1.50/lisp/org/org-clock /usr/share/emacs/site-lisp/org/ox-odt hides /usr/share/emacs/25.1.50/lisp/org/ox-odt /usr/share/emacs/site-lisp/org/org-capture hides /usr/share/emacs/25.1.50/lisp/org/org-capture /usr/share/emacs/site-lisp/org/org-mobile hides /usr/share/emacs/25.1.50/lisp/org/org-mobile /usr/share/emacs/site-lisp/org/org-bibtex hides /usr/share/emacs/25.1.50/lisp/org/org-bibtex /usr/share/emacs/site-lisp/org/org-mhe hides /usr/share/emacs/25.1.50/lisp/org/org-mhe /usr/share/emacs/site-lisp/org/org-bbdb hides /usr/share/emacs/25.1.50/lisp/org/org-bbdb /usr/share/emacs/site-lisp/org/ox-md hides /usr/share/emacs/25.1.50/lisp/org/ox-md /usr/share/emacs/site-lisp/org/org-macs hides /usr/share/emacs/25.1.50/lisp/org/org-macs /usr/share/emacs/site-lisp/org/org-archive hides /usr/share/emacs/25.1.50/lisp/org/org-archive /usr/share/emacs/site-lisp/org/org-w3m hides /usr/share/emacs/25.1.50/lisp/org/org-w3m /usr/share/emacs/site-lisp/org/org hides /usr/share/emacs/25.1.50/lisp/org/org /usr/share/emacs/site-lisp/org/ob hides /usr/share/emacs/25.1.50/lisp/org/ob /usr/share/emacs/site-lisp/org/ob-tangle hides /usr/share/emacs/25.1.50/lisp/org/ob-tangle /usr/share/emacs/site-lisp/org/ox-man hides /usr/share/emacs/25.1.50/lisp/org/ox-man /usr/share/emacs/site-lisp/org/ob-table hides /usr/share/emacs/25.1.50/lisp/org/ob-table /usr/share/emacs/site-lisp/org/ox-latex hides /usr/share/emacs/25.1.50/lisp/org/ox-latex /usr/share/emacs/site-lisp/org/ob-sqlite hides /usr/share/emacs/25.1.50/lisp/org/ob-sqlite /usr/share/emacs/site-lisp/org/ox-icalendar hides /usr/share/emacs/25.1.50/lisp/org/ox-icalendar /usr/share/emacs/site-lisp/org/ob-sql hides /usr/share/emacs/25.1.50/lisp/org/ob-sql /usr/share/emacs/site-lisp/org/ob-shen hides /usr/share/emacs/25.1.50/lisp/org/ob-shen /usr/share/emacs/site-lisp/org/ob-scheme hides /usr/share/emacs/25.1.50/lisp/org/ob-scheme /usr/share/emacs/site-lisp/org/ob-scala hides /usr/share/emacs/25.1.50/lisp/org/ob-scala /usr/share/emacs/site-lisp/org/ob-python hides /usr/share/emacs/25.1.50/lisp/org/ob-python /usr/share/emacs/site-lisp/org/ob-ref hides /usr/share/emacs/25.1.50/lisp/org/ob-ref /usr/share/emacs/site-lisp/org/ob-lisp hides /usr/share/emacs/25.1.50/lisp/org/ob-lisp /usr/share/emacs/site-lisp/org/ob-fortran hides /usr/share/emacs/25.1.50/lisp/org/ob-fortran /usr/share/emacs/site-lisp/org/ob-exp hides /usr/share/emacs/25.1.50/lisp/org/ob-exp /usr/share/emacs/site-lisp/org/ob-perl hides /usr/share/emacs/25.1.50/lisp/org/ob-perl /usr/share/emacs/site-lisp/org/ob-lilypond hides /usr/share/emacs/25.1.50/lisp/org/ob-lilypond /usr/share/emacs/site-lisp/org/ob-eval hides /usr/share/emacs/25.1.50/lisp/org/ob-eval /usr/share/emacs/site-lisp/org/ob-org hides /usr/share/emacs/25.1.50/lisp/org/ob-org /usr/share/emacs/site-lisp/org/ob-ledger hides /usr/share/emacs/25.1.50/lisp/org/ob-ledger /usr/share/emacs/site-lisp/org/ob-emacs-lisp hides /usr/share/emacs/25.1.50/lisp/org/ob-emacs-lisp /usr/share/emacs/site-lisp/org/ob-maxima hides /usr/share/emacs/25.1.50/lisp/org/ob-maxima /usr/share/emacs/site-lisp/org/ob-haskell hides /usr/share/emacs/25.1.50/lisp/org/ob-haskell /usr/share/emacs/site-lisp/org/ob-dot hides /usr/share/emacs/25.1.50/lisp/org/ob-dot /usr/share/emacs/site-lisp/org/ob-mscgen hides /usr/share/emacs/25.1.50/lisp/org/ob-mscgen /usr/share/emacs/site-lisp/org/ob-js hides /usr/share/emacs/25.1.50/lisp/org/ob-js /usr/share/emacs/site-lisp/org/ob-matlab hides /usr/share/emacs/25.1.50/lisp/org/ob-matlab /usr/share/emacs/site-lisp/org/ob-java hides /usr/share/emacs/25.1.50/lisp/org/ob-java /usr/share/emacs/site-lisp/org/ob-css hides /usr/share/emacs/25.1.50/lisp/org/ob-css /usr/share/emacs/site-lisp/org/ob-octave hides /usr/share/emacs/25.1.50/lisp/org/ob-octave /usr/share/emacs/site-lisp/org/ob-latex hides /usr/share/emacs/25.1.50/lisp/org/ob-latex /usr/share/emacs/site-lisp/org/ob-lob hides /usr/share/emacs/25.1.50/lisp/org/ob-lob /usr/share/emacs/site-lisp/org/ob-io hides /usr/share/emacs/25.1.50/lisp/org/ob-io /usr/share/emacs/site-lisp/org/ob-clojure hides /usr/share/emacs/25.1.50/lisp/org/ob-clojure /usr/share/emacs/site-lisp/org/ob-makefile hides /usr/share/emacs/25.1.50/lisp/org/ob-makefile /usr/share/emacs/site-lisp/org/ob-gnuplot hides /usr/share/emacs/25.1.50/lisp/org/ob-gnuplot /usr/share/emacs/site-lisp/org/ob-R hides /usr/share/emacs/25.1.50/lisp/org/ob-R /usr/share/emacs/site-lisp/org/ob-awk hides /usr/share/emacs/25.1.50/lisp/org/ob-awk /usr/share/emacs/site-lisp/org/ob-C hides /usr/share/emacs/25.1.50/lisp/org/ob-C /usr/share/emacs/site-lisp/org/ob-picolisp hides /usr/share/emacs/25.1.50/lisp/org/ob-picolisp /usr/share/emacs/site-lisp/org/ob-asymptote hides /usr/share/emacs/25.1.50/lisp/org/ob-asymptote /usr/share/emacs/site-lisp/org/org-loaddefs hides /usr/share/emacs/25.1.50/lisp/org/org-loaddefs /usr/share/emacs/site-lisp/org/org-version hides /usr/share/emacs/25.1.50/lisp/org/org-version /usr/share/emacs/site-lisp/org/org-install hides /usr/share/emacs/25.1.50/lisp/org/org-install Features: (shadow sort spook cookie1 mail-extr emacsbug sendmail linum cal-move parse-time calc-map calc-stat calc-vec calc-ext calc-menu calc-aent calc calc-loaddefs calc-macs org-table cdlatex texmathp org-annotate-file org-id org-habit org-info org-docview doc-view org-bibtex bibtex org-bbdb vc-git thingatpt flymake magit-version undo-tree diff magit-blame magit-stash magit-bisect magit-remote magit-commit magit-sequence magit package url-handlers magit-apply magit-wip magit-log magit-diff smerge-mode diff-mode magit-core magit-autorevert autorevert filenotify magit-process magit-popup magit-mode magit-git crm magit-section magit-utils git-commit help-fns radix-tree log-edit message subr-x puny rfc822 mml mml-sec epa epg epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils mailheader pcvs-util add-log with-editor tramp-sh server dash auto-complete-config auto-complete popup calfw-ical url url-proxy url-privacy url-expand url-methods url-history url-cookie url-domsuf url-util url-parse url-vars mailcap icalendar diary-lib diary-loaddefs calfw-org org-capture org-agenda calfw holidays hol-loaddefs cl ob-shell ob-R ob-perl ob-latex ob-asymptote ob-gnuplot ox-odt rng-loc rng-uri rng-parse rng-match rng-dt rng-util rng-pttrn nxml-parse nxml-ns nxml-enc xmltok nxml-util ox-latex ox-icalendar ox-html table ox-ascii ox-publish ox preview-latex tex-site auto-loads pdf-sync pdf-outline pdf-occur ibuf-ext ibuffer ibuffer-loaddefs pdf-links pdf-isearch let-alist pdf-history pdf-annot tablist tablist-filter semantic/wisent/comp semantic/wisent semantic/wisent/wisent semantic/util-modes semantic/util semantic semantic/tag semantic/lex semantic/fw mode-local cedet org-element avl-tree org org-macro org-footnote org-pcomplete org-list org-faces org-entities noutline outline org-version ob-emacs-lisp ob ob-tangle org-src ob-ref ob-lob ob-table ob-keys ob-exp ob-comint tramp tramp-compat tramp-loaddefs trampver ucs-normalize shell pcomplete auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache ob-core ob-eval org-compat org-macs org-loaddefs find-func cal-menu calendar cal-loaddefs pdf-misc imenu pdf-tools compile comint ansi-color ring cus-edit cus-start cus-load wid-edit pdf-view jka-compr pdf-cache pdf-info tq pdf-util image-mode dired+ image-dired format-spec image-file dired-aux bookmark+ bookmark+-key edmacro kmacro easy-mmode advice derived dired-x dired dired-loaddefs bookmark+-1 bookmark+-bmu bookmark+-lit bookmark pp ido seq byte-opt gv bytecomp byte-compile cl-extra cconv quail help-mode easymenu cl-loaddefs pcase cl-lib time flyspell ispell time-date paren mule-util cyril-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese charscript case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote dbusbind inotify dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 496832 58236) (symbols 48 50535 0) (miscs 40 177 481) (strings 32 118385 14977) (string-bytes 1 3804225) (vectors 16 78228) (vector-slots 8 1869287 211061) (floats 8 507 374) (intervals 56 1311 69) (buffers 976 23)) -- WBR, Vladimir Lomov SUN Microsystems: The Network IS the Load Average. EuroFed ASPIC Attorney General Pipe bomb undercover Leuken-Baden Federal Aviation Administration Reflection Palestine Liberation Organization Chemical burn Incident SWS 22nd SAS Sugar Grove Dirty bomb -- From unknown Mon Aug 18 11:32:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24218: 25.1.50; server-name, server-socket-dir and daemon start through systemd socket References: <87popclj82.fsf@yandex.ru> In-Reply-To: <87popclj82.fsf@yandex.ru> Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 15 Aug 2016 02:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24218 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Matthew Leach Cc: 24218@debbugs.gnu.org, Vladimir Lomov Received: via spool by 24218-submit@debbugs.gnu.org id=B24218.147122795813821 (code B ref 24218); Mon, 15 Aug 2016 02:26:02 +0000 Received: (at 24218) by debbugs.gnu.org; 15 Aug 2016 02:25:58 +0000 Received: from localhost ([127.0.0.1]:57751 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZ7bC-0003ar-0W for submit@debbugs.gnu.org; Sun, 14 Aug 2016 22:25:58 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:44045) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZ7bA-0003af-C4 for 24218@debbugs.gnu.org; Sun, 14 Aug 2016 22:25:57 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id E22AF160D3D; Sun, 14 Aug 2016 19:25:50 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id N6b_kVh5ZQmu; Sun, 14 Aug 2016 19:25:49 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id BA013160E3A; Sun, 14 Aug 2016 19:25:49 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 5t8VbEOUZRod; Sun, 14 Aug 2016 19:25:49 -0700 (PDT) Received: from [192.168.1.9] (unknown [100.32.155.148]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 936FF160D3D; Sun, 14 Aug 2016 19:25:49 -0700 (PDT) From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <23b701cf-f800-dd62-0203-5fb3ae8a5d6e@cs.ucla.edu> Date: Sun, 14 Aug 2016 19:25:49 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.5 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) Matthew, can you please look at: http://bugs.gnu.org/24218 and follow up as seems appropriate? You can reply to this email to add to the bug-report log. Thanks. From unknown Mon Aug 18 11:32:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24218: 25.1.50; server-name, server-socket-dir and daemon start through, systemd socket References: <87popclj82.fsf@yandex.ru> In-Reply-To: <87popclj82.fsf@yandex.ru> Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 Jan 2018 21:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24218 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Matthew Leach Cc: 24218@debbugs.gnu.org, Vladimir Lomov Received: via spool by 24218-submit@debbugs.gnu.org id=B24218.151536211816025 (code B ref 24218); Sun, 07 Jan 2018 21:56:01 +0000 Received: (at 24218) by debbugs.gnu.org; 7 Jan 2018 21:55:18 +0000 Received: from localhost ([127.0.0.1]:39924 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eYIuU-0004AO-2m for submit@debbugs.gnu.org; Sun, 07 Jan 2018 16:55:18 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:37840) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eYIuR-0004A4-VO for 24218@debbugs.gnu.org; Sun, 07 Jan 2018 16:55:17 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 35DD51615CE; Sun, 7 Jan 2018 13:55:10 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id I_vEqgUEm0Ji; Sun, 7 Jan 2018 13:55:08 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id EE1E91615D7; Sun, 7 Jan 2018 13:55:07 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id xMsWQ1nIbOzP; Sun, 7 Jan 2018 13:55:07 -0800 (PST) Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id C44791615B2; Sun, 7 Jan 2018 13:55:07 -0800 (PST) From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: Date: Sun, 7 Jan 2018 13:55:04 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------ED4BFDA7601092EF545082E7" Content-Language: en-US X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) This is a multi-part message in MIME format. --------------ED4BFDA7601092EF545082E7 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Matthew proposed a patch for this here: https://lists.gnu.org/r/emacs-devel/2017-12/msg00903.html which I am attaching in git form (see first attached patch). I also propose the second attached patch as a followup. It makes some of the newly-added features "private" (since they don't seem to be generally useful) and moves the low-level initialization code from emacs.c to process.c which is a more-natural home for it. --------------ED4BFDA7601092EF545082E7 Content-Type: text/x-patch; name="0001-Fix-server-name-and-server-socket-dir-for-Bug-24218.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Fix-server-name-and-server-socket-dir-for-Bug-24218.pat"; filename*1="ch" >From 8debb5cd9ada5a8dc7d4a1e5300e7b913fe1e09b Mon Sep 17 00:00:00 2001 From: Matthew Leach Date: Sun, 7 Jan 2018 13:47:12 -0800 Subject: [PATCH 1/2] Fix `server-name' and `server-socket-dir' for Bug#24218 * lisp/server.el: (server-external-socket-initialised): New (server-name): Compute server name from `get-external-sockname'. (server-socket-dir): Compute socket dir from `get-external-sockname'. (server-start): Don't check for existing server when an uninitialised external socket has been passed to Emacs. * src/emacs.c: (main): Obtain socket name via getsockname and pass to `init_process_emacs'. * src/lisp.h: (init_process_emacs): Add second parameter. * src/process.c: (external_sock_name): New. (get-external-sockname): New. (init_process_emacs): Set `external_sock_name' to `sockname' parameter. --- lisp/server.el | 56 ++++++++++++++++++++++++++++++++++++-------------------- src/emacs.c | 16 +++++++++++++--- src/lisp.h | 2 +- src/process.c | 19 ++++++++++++++++++- 4 files changed, 68 insertions(+), 25 deletions(-) diff --git a/lisp/server.el b/lisp/server.el index ac0d701851..e8b53530c9 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -251,8 +251,16 @@ server-existing-buffer are done with it in the server.") (make-variable-buffer-local 'server-existing-buffer) -;;;###autoload -(defcustom server-name "server" +(defvar server-external-socket-initialised nil + "When an external socket is passed into Emacs, we need to call +`server-start' in order to initialise the connection. This flag +prevents multiple initialisations when an external socket has +been consumed.") + +(defcustom server-name + (if (get-external-sockname) + (file-name-nondirectory (get-external-sockname)) + "server") "The name of the Emacs server, if this Emacs process creates one. The command `server-start' makes use of this. It should not be changed while a server is running." @@ -263,8 +271,10 @@ server-name ;; We do not use `temporary-file-directory' here, because emacsclient ;; does not read the init file. (defvar server-socket-dir - (and (featurep 'make-network-process '(:family local)) - (format "%s/emacs%d" (or (getenv "TMPDIR") "/tmp") (user-uid))) + (if (get-external-sockname) + (file-name-directory (get-external-sockname)) + (and (featurep 'make-network-process '(:family local)) + (format "%s/emacs%d" (or (getenv "TMPDIR") "/tmp") (user-uid)))) "The directory in which to place the server socket. If local sockets are not supported, this is nil.") @@ -618,23 +628,29 @@ server-start (when server-process ;; kill it dead! (ignore-errors (delete-process server-process))) - ;; Delete the socket files made by previous server invocations. - (if (not (eq t (server-running-p server-name))) - ;; Remove any leftover socket or authentication file - (ignore-errors - (let (delete-by-moving-to-trash) - (delete-file server-file))) - (setq server-mode nil) ;; already set by the minor mode code - (display-warning - 'server - (concat "Unable to start the Emacs server.\n" - (format "There is an existing Emacs server, named %S.\n" - server-name) - (substitute-command-keys - "To start the server in this Emacs process, stop the existing + ;; Check to see if an uninitialised external socket has been + ;; passed in, if that is the case, skip checking + ;; `server-running-p' as this will return the wrong result. + (if (and (get-external-sockname) + (not server-external-socket-initialised)) + (setq server-external-socket-initialised t) + ;; Delete the socket files made by previous server invocations. + (if (not (eq t (server-running-p server-name))) + ;; Remove any leftover socket or authentication file + (ignore-errors + (let (delete-by-moving-to-trash) + (delete-file server-file))) + (setq server-mode nil) ;; already set by the minor mode code + (display-warning + 'server + (concat "Unable to start the Emacs server.\n" + (format "There is an existing Emacs server, named %S.\n" + server-name) + (substitute-command-keys + "To start the server in this Emacs process, stop the existing server or call `\\[server-force-delete]' to forcibly disconnect it.")) - :warning) - (setq leave-dead t)) + :warning) + (setq leave-dead t))) ;; If this Emacs already had a server, clear out associated status. (while server-clients (server-delete-client (car server-clients))) diff --git a/src/emacs.c b/src/emacs.c index 20ced26283..1af09166b6 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -60,6 +60,7 @@ along with GNU Emacs. If not, see . */ #ifdef HAVE_LIBSYSTEMD # include # include +# include #endif #ifdef HAVE_WINDOW_SYSTEM @@ -1002,6 +1003,7 @@ main (int argc, char **argv) int sockfd = -1; + char *sockname = NULL; if (argmatch (argv, argc, "-fg-daemon", "--fg-daemon", 10, NULL, &skip_args) || argmatch (argv, argc, "-fg-daemon", "--fg-daemon", 10, &dname_arg, &skip_args)) @@ -1061,8 +1063,16 @@ main (int argc, char **argv) "Try 'Accept=false' in the Emacs socket unit file.\n")); else if (systemd_socket == 1 && (0 < sd_is_socket (SD_LISTEN_FDS_START, - AF_UNSPEC, SOCK_STREAM, 1))) - sockfd = SD_LISTEN_FDS_START; + AF_UNIX, SOCK_STREAM, 1))) + { + struct sockaddr_un sockaddr; + socklen_t sockaddr_sz = sizeof(sockaddr); + + sockfd = SD_LISTEN_FDS_START; + + if (!getsockname(sockfd, &sockaddr, &sockaddr_sz)) + sockname = strdup(sockaddr.sun_path); + } #endif /* HAVE_LIBSYSTEMD */ #ifdef USE_GTK @@ -1656,7 +1666,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem /* This can create a thread that may call getenv, so it must follow all calls to putenv and setenv. Also, this sets up add_keyboard_wait_descriptor, which init_display uses. */ - init_process_emacs (sockfd); + init_process_emacs (sockfd, sockname); init_keyboard (); /* This too must precede init_sys_modes. */ if (!noninteractive) diff --git a/src/lisp.h b/src/lisp.h index 3eb6e0d3c1..2e9002a226 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -4313,7 +4313,7 @@ extern void delete_keyboard_wait_descriptor (int); extern void add_gpm_wait_descriptor (int); extern void delete_gpm_wait_descriptor (int); #endif -extern void init_process_emacs (int); +extern void init_process_emacs (int, char *); extern void syms_of_process (void); extern void setup_process_coding_systems (Lisp_Object); diff --git a/src/process.c b/src/process.c index d4440e472d..da8e5714b0 100644 --- a/src/process.c +++ b/src/process.c @@ -276,6 +276,10 @@ static int max_desc; the file descriptor of a socket that is already bound. */ static int external_sock_fd; +/* The name (path) of the socket that was passed to Emacs, when + `external_sock_fd' is not -1. */ +static const char *external_sock_name = NULL; + /* Indexed by descriptor, gives the process (if any) for that descriptor. */ static Lisp_Object chan_process[FD_SETSIZE]; static void wait_for_socket_fds (Lisp_Object, char const *); @@ -7974,10 +7978,21 @@ restore_nofile_limit (void) } +DEFUN ("get-external-sockname", Fget_external_sockname, Sget_external_sockname, 0, 0, 0, + doc: /* Return the path of an external socket passed to Emacs. +Otherwise return nil. */) + (void) +{ + if (external_sock_name) + return make_string(external_sock_name, strlen(external_sock_name)); + else + return Qnil; +} + /* This is not called "init_process" because that is the name of a Mach system call, so it would cause problems on Darwin systems. */ void -init_process_emacs (int sockfd) +init_process_emacs (int sockfd, char *sockname) { #ifdef subprocesses int i; @@ -8012,6 +8027,7 @@ init_process_emacs (int sockfd) #endif external_sock_fd = sockfd; + external_sock_name = sockname; max_desc = -1; memset (fd_callback_info, 0, sizeof (fd_callback_info)); @@ -8306,4 +8322,5 @@ returns non-`nil'. */); defsubr (&Sprocess_inherit_coding_system_flag); defsubr (&Slist_system_processes); defsubr (&Sprocess_attributes); + defsubr (&Sget_external_sockname); } -- 2.14.3 --------------ED4BFDA7601092EF545082E7 Content-Type: text/x-patch; name="0002-Minor-cleanups-for-server-name-fix-Bug-24218.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0002-Minor-cleanups-for-server-name-fix-Bug-24218.patch" >From 51e1d2919b261be0c734ab3a19b3478fb52f43c1 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 7 Jan 2018 13:47:12 -0800 Subject: [PATCH 2/2] Minor cleanups for server-name fix (Bug#24218) * lisp/server.el (server--external-socket-initialized): Rename from server-external-socket-initialised, since it should be private and Emacs uses American spelling. All uses changed. * src/emacs.c, src/lisp.h: Revert previous changes, as the initialization is now done in src/process.c, which already includes the relevant files. * src/process.c (union u_sockaddr): Move decl to top level. (external_sock_name, Fget_external_sockname): Remove, replacing with Vinternal__external_sockname. All uses changed. (init_process_emacs): Deduce socket name ourselves rather than have main.c do it. Use conv_sockaddr_to_lisp instead of doing it by hand. Conditionalize it on HAVE_GETSOCKNAME. --- lisp/server.el | 24 ++++++++++++------------ src/emacs.c | 16 +++------------- src/lisp.h | 2 +- src/process.c | 58 ++++++++++++++++++++++++++++++---------------------------- 4 files changed, 46 insertions(+), 54 deletions(-) diff --git a/lisp/server.el b/lisp/server.el index e8b53530c9..c867fde832 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -251,15 +251,15 @@ server-existing-buffer are done with it in the server.") (make-variable-buffer-local 'server-existing-buffer) -(defvar server-external-socket-initialised nil +(defvar server--external-socket-initialized nil "When an external socket is passed into Emacs, we need to call -`server-start' in order to initialise the connection. This flag -prevents multiple initialisations when an external socket has +`server-start' in order to initialize the connection. This flag +prevents multiple initializations when an external socket has been consumed.") (defcustom server-name - (if (get-external-sockname) - (file-name-nondirectory (get-external-sockname)) + (if internal--external-sockname + (file-name-nondirectory internal--external-sockname) "server") "The name of the Emacs server, if this Emacs process creates one. The command `server-start' makes use of this. It should not be @@ -271,8 +271,8 @@ server-name ;; We do not use `temporary-file-directory' here, because emacsclient ;; does not read the init file. (defvar server-socket-dir - (if (get-external-sockname) - (file-name-directory (get-external-sockname)) + (if internal--external-sockname + (file-name-directory internal--external-sockname) (and (featurep 'make-network-process '(:family local)) (format "%s/emacs%d" (or (getenv "TMPDIR") "/tmp") (user-uid)))) "The directory in which to place the server socket. @@ -628,15 +628,15 @@ server-start (when server-process ;; kill it dead! (ignore-errors (delete-process server-process))) - ;; Check to see if an uninitialised external socket has been + ;; Check to see if an uninitialized external socket has been ;; passed in, if that is the case, skip checking ;; `server-running-p' as this will return the wrong result. - (if (and (get-external-sockname) - (not server-external-socket-initialised)) - (setq server-external-socket-initialised t) + (if (and internal--external-sockname + (not server--external-socket-initialized)) + (setq server--external-socket-initialized t) ;; Delete the socket files made by previous server invocations. (if (not (eq t (server-running-p server-name))) - ;; Remove any leftover socket or authentication file + ;; Remove any leftover socket or authentication file. (ignore-errors (let (delete-by-moving-to-trash) (delete-file server-file))) diff --git a/src/emacs.c b/src/emacs.c index 1af09166b6..20ced26283 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -60,7 +60,6 @@ along with GNU Emacs. If not, see . */ #ifdef HAVE_LIBSYSTEMD # include # include -# include #endif #ifdef HAVE_WINDOW_SYSTEM @@ -1003,7 +1002,6 @@ main (int argc, char **argv) int sockfd = -1; - char *sockname = NULL; if (argmatch (argv, argc, "-fg-daemon", "--fg-daemon", 10, NULL, &skip_args) || argmatch (argv, argc, "-fg-daemon", "--fg-daemon", 10, &dname_arg, &skip_args)) @@ -1063,16 +1061,8 @@ main (int argc, char **argv) "Try 'Accept=false' in the Emacs socket unit file.\n")); else if (systemd_socket == 1 && (0 < sd_is_socket (SD_LISTEN_FDS_START, - AF_UNIX, SOCK_STREAM, 1))) - { - struct sockaddr_un sockaddr; - socklen_t sockaddr_sz = sizeof(sockaddr); - - sockfd = SD_LISTEN_FDS_START; - - if (!getsockname(sockfd, &sockaddr, &sockaddr_sz)) - sockname = strdup(sockaddr.sun_path); - } + AF_UNSPEC, SOCK_STREAM, 1))) + sockfd = SD_LISTEN_FDS_START; #endif /* HAVE_LIBSYSTEMD */ #ifdef USE_GTK @@ -1666,7 +1656,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem /* This can create a thread that may call getenv, so it must follow all calls to putenv and setenv. Also, this sets up add_keyboard_wait_descriptor, which init_display uses. */ - init_process_emacs (sockfd, sockname); + init_process_emacs (sockfd); init_keyboard (); /* This too must precede init_sys_modes. */ if (!noninteractive) diff --git a/src/lisp.h b/src/lisp.h index 2e9002a226..3eb6e0d3c1 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -4313,7 +4313,7 @@ extern void delete_keyboard_wait_descriptor (int); extern void add_gpm_wait_descriptor (int); extern void delete_gpm_wait_descriptor (int); #endif -extern void init_process_emacs (int, char *); +extern void init_process_emacs (int); extern void syms_of_process (void); extern void setup_process_coding_systems (Lisp_Object); diff --git a/src/process.c b/src/process.c index da8e5714b0..2613dd2be0 100644 --- a/src/process.c +++ b/src/process.c @@ -160,6 +160,18 @@ static bool kbd_is_on_hold; when exiting. */ bool inhibit_sentinels; +union u_sockaddr +{ + struct sockaddr sa; + struct sockaddr_in in; +#ifdef AF_INET6 + struct sockaddr_in6 in6; +#endif +#ifdef HAVE_LOCAL_SOCKETS + struct sockaddr_un un; +#endif +}; + #ifdef subprocesses #ifndef SOCK_CLOEXEC @@ -276,10 +288,6 @@ static int max_desc; the file descriptor of a socket that is already bound. */ static int external_sock_fd; -/* The name (path) of the socket that was passed to Emacs, when - `external_sock_fd' is not -1. */ -static const char *external_sock_name = NULL; - /* Indexed by descriptor, gives the process (if any) for that descriptor. */ static Lisp_Object chan_process[FD_SETSIZE]; static void wait_for_socket_fds (Lisp_Object, char const *); @@ -4679,16 +4687,7 @@ server_accept_connection (Lisp_Object server, int channel) struct Lisp_Process *ps = XPROCESS (server); struct Lisp_Process *p; int s; - union u_sockaddr { - struct sockaddr sa; - struct sockaddr_in in; -#ifdef AF_INET6 - struct sockaddr_in6 in6; -#endif -#ifdef HAVE_LOCAL_SOCKETS - struct sockaddr_un un; -#endif - } saddr; + union u_sockaddr saddr; socklen_t len = sizeof saddr; ptrdiff_t count; @@ -7978,21 +7977,10 @@ restore_nofile_limit (void) } -DEFUN ("get-external-sockname", Fget_external_sockname, Sget_external_sockname, 0, 0, 0, - doc: /* Return the path of an external socket passed to Emacs. -Otherwise return nil. */) - (void) -{ - if (external_sock_name) - return make_string(external_sock_name, strlen(external_sock_name)); - else - return Qnil; -} - /* This is not called "init_process" because that is the name of a Mach system call, so it would cause problems on Darwin systems. */ void -init_process_emacs (int sockfd, char *sockname) +init_process_emacs (int sockfd) { #ifdef subprocesses int i; @@ -8027,7 +8015,18 @@ init_process_emacs (int sockfd, char *sockname) #endif external_sock_fd = sockfd; - external_sock_name = sockname; + Lisp_Object sockname = Qnil; +# if HAVE_GETSOCKNAME + if (0 <= sockfd) + { + union u_sockaddr sa; + socklen_t salen = sizeof sa; + if (getsockname (sockfd, &sa.sa, &salen) == 0) + sockname = conv_sockaddr_to_lisp (&sa.sa, salen); + } +# endif + Vinternal__external_sockname = sockname; + max_desc = -1; memset (fd_callback_info, 0, sizeof (fd_callback_info)); @@ -8220,6 +8219,10 @@ These functions are called in the order of the list, until one of them returns non-`nil'. */); Vinterrupt_process_functions = list1 (Qinternal_default_interrupt_process); + DEFVAR_LISP ("internal--external-sockname", Vinternal__external_sockname, + doc: /* Name of external socket passed to Emacs, or nil if none. */); + Vinternal__external_sockname = Qnil; + DEFSYM (Qinternal_default_interrupt_process, "internal-default-interrupt-process"); DEFSYM (Qinterrupt_process_functions, "interrupt-process-functions"); @@ -8322,5 +8325,4 @@ returns non-`nil'. */); defsubr (&Sprocess_inherit_coding_system_flag); defsubr (&Slist_system_processes); defsubr (&Sprocess_attributes); - defsubr (&Sget_external_sockname); } -- 2.14.3 --------------ED4BFDA7601092EF545082E7-- From unknown Mon Aug 18 11:32:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24218: 25.1.50; server-name, server-socket-dir and daemon start through, systemd socket Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 08 Jan 2018 03:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24218 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Paul Eggert Cc: 24218@debbugs.gnu.org, matthew@mattleach.net, lomov.vl@gmail.com Reply-To: Eli Zaretskii Received: via spool by 24218-submit@debbugs.gnu.org id=B24218.151538345529963 (code B ref 24218); Mon, 08 Jan 2018 03:51:01 +0000 Received: (at 24218) by debbugs.gnu.org; 8 Jan 2018 03:50:55 +0000 Received: from localhost ([127.0.0.1]:40072 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eYOSc-0007nC-W5 for submit@debbugs.gnu.org; Sun, 07 Jan 2018 22:50:55 -0500 Received: from eggs.gnu.org ([208.118.235.92]:47620) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eYOSb-0007mx-BG for 24218@debbugs.gnu.org; Sun, 07 Jan 2018 22:50:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eYOSS-00025s-2C for 24218@debbugs.gnu.org; Sun, 07 Jan 2018 22:50:47 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_40,T_RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:54009) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eYOSO-00022j-9y; Sun, 07 Jan 2018 22:50:40 -0500 Received: from [176.228.60.248] (port=2785 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1eYOSN-0000mx-JX; Sun, 07 Jan 2018 22:50:40 -0500 Date: Mon, 08 Jan 2018 05:50:25 +0200 Message-Id: <83608d80vy.fsf@gnu.org> From: Eli Zaretskii In-reply-to: (message from Paul Eggert on Sun, 7 Jan 2018 13:55:04 -0800) References: <87popclj82.fsf@yandex.ru> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) > From: Paul Eggert > Date: Sun, 7 Jan 2018 13:55:04 -0800 > Cc: 24218@debbugs.gnu.org, Vladimir Lomov > > Matthew proposed a patch for this here: > > https://lists.gnu.org/r/emacs-devel/2017-12/msg00903.html > > which I am attaching in git form (see first attached patch). I also > propose the second attached patch as a followup. It makes some of the > newly-added features "private" (since they don't seem to be generally > useful) and moves the low-level initialization code from emacs.c to > process.c which is a more-natural home for it. Thanks. I'm not an expert on this stuff, so I have only minor comments: . Please update the :version tag of server-name, to reflect the fact that its default value changes . This needs a NEWS entry, and I think the description of server-name in the manual should be updated to mention this facility . internal--external-sockname should be documented in the ELisp manual (a better name that doesn't use both "internal" and "external" will be appreciated) From unknown Mon Aug 18 11:32:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24218: 25.1.50; server-name, server-socket-dir and daemon start through, systemd socket Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 08 Jan 2018 04:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24218 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 24218@debbugs.gnu.org, matthew@mattleach.net, lomov.vl@gmail.com Received: via spool by 24218-submit@debbugs.gnu.org id=B24218.1515385506554 (code B ref 24218); Mon, 08 Jan 2018 04:26:01 +0000 Received: (at 24218) by debbugs.gnu.org; 8 Jan 2018 04:25:06 +0000 Received: from localhost ([127.0.0.1]:40097 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eYOzi-00008s-1E for submit@debbugs.gnu.org; Sun, 07 Jan 2018 23:25:06 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:46502) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eYOzg-00008G-Lq for 24218@debbugs.gnu.org; Sun, 07 Jan 2018 23:25:05 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id DFAB01615A6; Sun, 7 Jan 2018 20:24:58 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id yFeMzTUtd-c1; Sun, 7 Jan 2018 20:24:57 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id C85171615B4; Sun, 7 Jan 2018 20:24:57 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 8-bBaBqnvaHY; Sun, 7 Jan 2018 20:24:57 -0800 (PST) Received: from [192.168.1.9] (unknown [47.154.30.119]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 9F2F61615A6; Sun, 7 Jan 2018 20:24:57 -0800 (PST) References: <87popclj82.fsf@yandex.ru> <83608d80vy.fsf@gnu.org> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <5659f93b-a53a-5320-7d8a-a1211d7c18e5@cs.ucla.edu> Date: Sun, 7 Jan 2018 20:24:57 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <83608d80vy.fsf@gnu.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Eli Zaretskii wrote: > . internal--external-sockname should be documented in the ELisp > manual (a better name that doesn't use both "internal" and > "external" will be appreciated) The "internal--" prefix is intended to mean "for Emacs internal use only", i.e., that it should not be documented in the manual. From unknown Mon Aug 18 11:32:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24218: 25.1.50; server-name, server-socket-dir and daemon start through, systemd socket Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 08 Jan 2018 18:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24218 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Paul Eggert Cc: 24218@debbugs.gnu.org, matthew@mattleach.net, lomov.vl@gmail.com Reply-To: Eli Zaretskii Received: via spool by 24218-submit@debbugs.gnu.org id=B24218.15154364078508 (code B ref 24218); Mon, 08 Jan 2018 18:34:01 +0000 Received: (at 24218) by debbugs.gnu.org; 8 Jan 2018 18:33:27 +0000 Received: from localhost ([127.0.0.1]:41652 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eYcEh-0002DA-AQ for submit@debbugs.gnu.org; Mon, 08 Jan 2018 13:33:27 -0500 Received: from eggs.gnu.org ([208.118.235.92]:45479) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eYcEf-0002Cr-KD for 24218@debbugs.gnu.org; Mon, 08 Jan 2018 13:33:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eYcEZ-0008Of-PV for 24218@debbugs.gnu.org; Mon, 08 Jan 2018 13:33:20 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:39587) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eYcEV-0008MH-Vg; Mon, 08 Jan 2018 13:33:16 -0500 Received: from [176.228.60.248] (port=3454 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1eYcEV-0002Aa-D2; Mon, 08 Jan 2018 13:33:15 -0500 Date: Mon, 08 Jan 2018 20:33:04 +0200 Message-Id: <83y3l86w0v.fsf@gnu.org> From: Eli Zaretskii In-reply-to: <5659f93b-a53a-5320-7d8a-a1211d7c18e5@cs.ucla.edu> (message from Paul Eggert on Sun, 7 Jan 2018 20:24:57 -0800) References: <87popclj82.fsf@yandex.ru> <83608d80vy.fsf@gnu.org> <5659f93b-a53a-5320-7d8a-a1211d7c18e5@cs.ucla.edu> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) > Cc: matthew@mattleach.net, 24218@debbugs.gnu.org, lomov.vl@gmail.com > From: Paul Eggert > Date: Sun, 7 Jan 2018 20:24:57 -0800 > > Eli Zaretskii wrote: > > . internal--external-sockname should be documented in the ELisp > > manual (a better name that doesn't use both "internal" and > > "external" will be appreciated) > > The "internal--" prefix is intended to mean "for Emacs internal use only" That's exactly why I made the comment about the name: IMO, this variable's purpose is inconsistent with its being for internal use only. From unknown Mon Aug 18 11:32:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24218: 25.1.50; server-name, server-socket-dir and daemon start through, systemd socket Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 08 Jan 2018 18:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24218 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 24218@debbugs.gnu.org, matthew@mattleach.net, lomov.vl@gmail.com Received: via spool by 24218-submit@debbugs.gnu.org id=B24218.15154369589676 (code B ref 24218); Mon, 08 Jan 2018 18:43:02 +0000 Received: (at 24218) by debbugs.gnu.org; 8 Jan 2018 18:42:38 +0000 Received: from localhost ([127.0.0.1]:41664 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eYcNZ-0002Vy-Qr for submit@debbugs.gnu.org; Mon, 08 Jan 2018 13:42:37 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:38346) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eYcNX-0002VT-Op for 24218@debbugs.gnu.org; Mon, 08 Jan 2018 13:42:36 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id BE82016158A; Mon, 8 Jan 2018 10:42:29 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id q7omQrydu-zT; Mon, 8 Jan 2018 10:42:29 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 196E61615AF; Mon, 8 Jan 2018 10:42:29 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Tqr1Pqu7kVx8; Mon, 8 Jan 2018 10:42:29 -0800 (PST) Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id F06A416158A; Mon, 8 Jan 2018 10:42:28 -0800 (PST) References: <87popclj82.fsf@yandex.ru> <83608d80vy.fsf@gnu.org> <5659f93b-a53a-5320-7d8a-a1211d7c18e5@cs.ucla.edu> <83y3l86w0v.fsf@gnu.org> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <3750e2ed-122d-759c-660f-8be3d777809f@cs.ucla.edu> Date: Mon, 8 Jan 2018 10:42:28 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <83y3l86w0v.fsf@gnu.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) On 01/08/2018 10:33 AM, Eli Zaretskii wrote: > this > variable's purpose is inconsistent with its being for internal use > only. What purpose do you see for the variable, other than its use in Emacs's own Lisp code? From unknown Mon Aug 18 11:32:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24218: 25.1.50; server-name, server-socket-dir and daemon start through, systemd socket Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 08 Jan 2018 19:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24218 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Paul Eggert Cc: 24218@debbugs.gnu.org, matthew@mattleach.net, lomov.vl@gmail.com Reply-To: Eli Zaretskii Received: via spool by 24218-submit@debbugs.gnu.org id=B24218.151543891820588 (code B ref 24218); Mon, 08 Jan 2018 19:16:02 +0000 Received: (at 24218) by debbugs.gnu.org; 8 Jan 2018 19:15:18 +0000 Received: from localhost ([127.0.0.1]:41694 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eYctC-0005M0-EM for submit@debbugs.gnu.org; Mon, 08 Jan 2018 14:15:18 -0500 Received: from eggs.gnu.org ([208.118.235.92]:39473) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eYctA-0005Ll-Lk for 24218@debbugs.gnu.org; Mon, 08 Jan 2018 14:15:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eYct4-0004FD-G3 for 24218@debbugs.gnu.org; Mon, 08 Jan 2018 14:15:11 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:40386) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eYcsz-0004Ag-8l; Mon, 08 Jan 2018 14:15:05 -0500 Received: from [176.228.60.248] (port=3487 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1eYcsy-0000iN-Dw; Mon, 08 Jan 2018 14:15:05 -0500 Date: Mon, 08 Jan 2018 21:14:53 +0200 Message-Id: <83mv1o6u36.fsf@gnu.org> From: Eli Zaretskii In-reply-to: <3750e2ed-122d-759c-660f-8be3d777809f@cs.ucla.edu> (message from Paul Eggert on Mon, 8 Jan 2018 10:42:28 -0800) References: <87popclj82.fsf@yandex.ru> <83608d80vy.fsf@gnu.org> <5659f93b-a53a-5320-7d8a-a1211d7c18e5@cs.ucla.edu> <83y3l86w0v.fsf@gnu.org> <3750e2ed-122d-759c-660f-8be3d777809f@cs.ucla.edu> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) > Cc: matthew@mattleach.net, 24218@debbugs.gnu.org, lomov.vl@gmail.com > From: Paul Eggert > Date: Mon, 8 Jan 2018 10:42:28 -0800 > > On 01/08/2018 10:33 AM, Eli Zaretskii wrote: > > this > > variable's purpose is inconsistent with its being for internal use > > only. > > What purpose do you see for the variable, other than its use in Emacs's > own Lisp code? How many seconds do you think it will take Emacs hackers (in the good meaning of the word) to discover this variable and start (ab)using it? From unknown Mon Aug 18 11:32:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24218: 25.1.50; server-name, server-socket-dir and daemon start through, systemd socket Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 08 Jan 2018 19:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24218 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 24218@debbugs.gnu.org, matthew@mattleach.net, lomov.vl@gmail.com Received: via spool by 24218-submit@debbugs.gnu.org id=B24218.151543942221525 (code B ref 24218); Mon, 08 Jan 2018 19:24:01 +0000 Received: (at 24218) by debbugs.gnu.org; 8 Jan 2018 19:23:42 +0000 Received: from localhost ([127.0.0.1]:41727 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eYd1K-0005b7-6e for submit@debbugs.gnu.org; Mon, 08 Jan 2018 14:23:42 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:47290) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eYd1I-0005at-1Y for 24218@debbugs.gnu.org; Mon, 08 Jan 2018 14:23:40 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 0871F16157F; Mon, 8 Jan 2018 11:23:34 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 2tHZJ52iHhwl; Mon, 8 Jan 2018 11:23:33 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 3F7FF16158A; Mon, 8 Jan 2018 11:23:33 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id OCB1F6pKp0Qy; Mon, 8 Jan 2018 11:23:33 -0800 (PST) Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 211C316157F; Mon, 8 Jan 2018 11:23:33 -0800 (PST) References: <87popclj82.fsf@yandex.ru> <83608d80vy.fsf@gnu.org> <5659f93b-a53a-5320-7d8a-a1211d7c18e5@cs.ucla.edu> <83y3l86w0v.fsf@gnu.org> <3750e2ed-122d-759c-660f-8be3d777809f@cs.ucla.edu> <83mv1o6u36.fsf@gnu.org> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <3a2cab33-e70e-098f-a3d2-2a62cd0a23de@cs.ucla.edu> Date: Mon, 8 Jan 2018 11:23:32 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <83mv1o6u36.fsf@gnu.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) On 01/08/2018 11:14 AM, Eli Zaretskii wrote: > How many seconds do you think it will take Emacs hackers (in the good > meaning of the word) to discover this variable and start (ab)using it? I don't think they'll need to use the variable, which is why I suggested that it be labeled as internal. From unknown Mon Aug 18 11:32:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24218: 25.1.50; server-name, server-socket-dir and daemon start through, systemd socket Resent-From: Matthew Leach Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 09 Jan 2018 19:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24218 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 24218@debbugs.gnu.org, lomov.vl@gmail.com, Paul Eggert Received: via spool by 24218-submit@debbugs.gnu.org id=B24218.151552771827842 (code B ref 24218); Tue, 09 Jan 2018 19:56:02 +0000 Received: (at 24218) by debbugs.gnu.org; 9 Jan 2018 19:55:18 +0000 Received: from localhost ([127.0.0.1]:49929 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eYzzS-0007Ex-IH for submit@debbugs.gnu.org; Tue, 09 Jan 2018 14:55:18 -0500 Received: from mx0.mattleach.net ([176.58.118.143]:33012) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eYzzP-0007ES-Tq for 24218@debbugs.gnu.org; Tue, 09 Jan 2018 14:55:16 -0500 Received: by mx0.mattleach.net (Postfix, from userid 99) id 1B8A36270B; Tue, 9 Jan 2018 19:55:15 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mx0.mattleach.net X-Spam-Level: X-Spam-Status: No, score=-1.0 required=4.0 tests=ALL_TRUSTED,URIBL_BLOCKED autolearn=disabled version=3.4.1 Received: from matt-desktop.mattleach.net (unknown [IPv6:2a02:c7f:bc21:2100:3530:5f1b:917c:3899]) by mx0.mattleach.net (Postfix) with ESMTPSA id 683F561CCF; Tue, 9 Jan 2018 19:55:09 +0000 (GMT) From: Matthew Leach In-Reply-To: <83608d80vy.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 08 Jan 2018 05:50:25 +0200") References: <87popclj82.fsf@yandex.ru> <83608d80vy.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Date: Tue, 09 Jan 2018 19:53:03 +0000 Message-ID: <878td6u7vk.fsf@mattleach.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Paul Eggert >> Date: Sun, 7 Jan 2018 13:55:04 -0800 >> Cc: 24218@debbugs.gnu.org, Vladimir Lomov >> >> Matthew proposed a patch for this here: >> >> https://lists.gnu.org/r/emacs-devel/2017-12/msg00903.html >> >> which I am attaching in git form (see first attached patch). I also >> propose the second attached patch as a followup. It makes some of the >> newly-added features "private" (since they don't seem to be generally >> useful) and moves the low-level initialization code from emacs.c to >> process.c which is a more-natural home for it. Thanks for the cleanup patch Paul! > > Thanks. I'm not an expert on this stuff, so I have only minor > comments: > > . Please update the :version tag of server-name, to reflect the fact > that its default value changes > . This needs a NEWS entry, and I think the description of > server-name in the manual should be updated to mention this > facility Please see the attached patch that should address these points. > > . internal--external-sockname should be documented in the ELisp > manual (a better name that doesn't use both "internal" and > "external" will be appreciated) May I suggest `internal--daemon-sockname'? Thanks, -- Matt --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Update-server-name-version-tag-and-document-sockname.patch >From 5dc51350e7e744f26236e0018112d2eed2dbcc93 Mon Sep 17 00:00:00 2001 From: Matthew Leach Date: Tue, 9 Jan 2018 19:45:30 +0000 Subject: [PATCH] Update `server-name' :version tag and document sockname support * lisp/server.el: (server-name): Update :version tag. * etc/NEWS: Document that `server-name' and `server-socket-dir' automatically update. * doc/misc.texi: (Emacs Server): Likewise. --- doc/emacs/misc.texi | 5 +++++ etc/NEWS | 3 +++ lisp/server.el | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 633e1e881d..c9b8f08252 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -1654,6 +1654,11 @@ Emacs Server @samp{foo}. The @code{emacsclient} program can specify a server by name, using the @samp{-s} option (@pxref{emacsclient Options}). + If Emacs is passed a socket by an external program --- for example +by systemd socket activation --- the value of @code{server-name} and +@code{server-socket-dir} is automatically updated to reflect the name +and path of the socket. + If you want to run multiple Emacs daemons (@pxref{Initial Options}), you can give each daemon its own server name like this: diff --git a/etc/NEWS b/etc/NEWS index f6f36dfc85..66cb0834c5 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -194,6 +194,9 @@ as new-style, bind the new variable 'force-new-style-backquotes' to t. * Lisp Changes in Emacs 27.1 +** The `server-name' and `server-socket-dir' variables are set when a +socket has been pased to Emacs (Bug#24218). + ** Internal parsing commands now use syntax-ppss and disregard open-paren-in-column-0-is-defun-start. This affects mostly things like forward-comment, scan-sexps, and forward-sexp when parsing backward. diff --git a/lisp/server.el b/lisp/server.el index c867fde832..16b3f8e4e2 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -266,7 +266,7 @@ server-name changed while a server is running." :group 'server :type 'string - :version "23.1") + :version "27.1") ;; We do not use `temporary-file-directory' here, because emacsclient ;; does not read the init file. -- 2.15.1 --=-=-=-- From unknown Mon Aug 18 11:32:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24218: 25.1.50; server-name, server-socket-dir and daemon start through, systemd socket Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 24 Jan 2018 23:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24218 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Matthew Leach , Eli Zaretskii Cc: 24218@debbugs.gnu.org, lomov.vl@gmail.com Received: via spool by 24218-submit@debbugs.gnu.org id=B24218.15168348237381 (code B ref 24218); Wed, 24 Jan 2018 23:01:02 +0000 Received: (at 24218) by debbugs.gnu.org; 24 Jan 2018 23:00:23 +0000 Received: from localhost ([127.0.0.1]:41508 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eeU1m-0001uz-Rg for submit@debbugs.gnu.org; Wed, 24 Jan 2018 18:00:23 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:48592) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eeU1k-0001uj-H8 for 24218@debbugs.gnu.org; Wed, 24 Jan 2018 18:00:21 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 99120160AAA; Wed, 24 Jan 2018 15:00:14 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id HnhTzjnTs0R4; Wed, 24 Jan 2018 15:00:13 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id DA248161063; Wed, 24 Jan 2018 15:00:13 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id VcQfF84Q4RVY; Wed, 24 Jan 2018 15:00:13 -0800 (PST) Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id BF681160AAA; Wed, 24 Jan 2018 15:00:13 -0800 (PST) References: <87popclj82.fsf@yandex.ru> <83608d80vy.fsf@gnu.org> <878td6u7vk.fsf@mattleach.net> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <3d2e3962-9592-2d0a-b50b-52e2dddfbb66@cs.ucla.edu> Date: Wed, 24 Jan 2018 15:00:13 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <878td6u7vk.fsf@mattleach.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) On 01/09/2018 11:53 AM, Matthew Leach wrote: > May I suggest `internal--daemon-sockname'? Yes, that sounds good. Can you prepare a patch along those lines? Sorry, I lost track of this bug report. It'd be nice if you could re-propose a self-contained set of patches that address all the issues raised so far. Thanks. From unknown Mon Aug 18 11:32:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24218: 25.1.50; server-name, server-socket-dir and daemon start through, systemd socket Resent-From: Matthew Leach Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 25 Jan 2018 19:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24218 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Paul Eggert Cc: 24218@debbugs.gnu.org, lomov.vl@gmail.com, Eli Zaretskii Received: via spool by 24218-submit@debbugs.gnu.org id=B24218.151691033332468 (code B ref 24218); Thu, 25 Jan 2018 19:59:01 +0000 Received: (at 24218) by debbugs.gnu.org; 25 Jan 2018 19:58:53 +0000 Received: from localhost ([127.0.0.1]:42864 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eenfe-0008RW-1J for submit@debbugs.gnu.org; Thu, 25 Jan 2018 14:58:52 -0500 Received: from mx0.mattleach.net ([176.58.118.143]:45190) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eenKJ-0007xY-7G for 24218@debbugs.gnu.org; Thu, 25 Jan 2018 14:36:48 -0500 Received: by mx0.mattleach.net (Postfix, from userid 99) id 3A1C76270B; Thu, 25 Jan 2018 19:36:46 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mx0.mattleach.net X-Spam-Level: X-Spam-Status: No, score=-1.0 required=4.0 tests=ALL_TRUSTED,URIBL_BLOCKED autolearn=disabled version=3.4.1 Received: from matt-desktop.mattleach.net (unknown [85.255.236.102]) by mx0.mattleach.net (Postfix) with ESMTPSA id A32416220D; Thu, 25 Jan 2018 19:36:40 +0000 (GMT) From: Matthew Leach In-Reply-To: <3d2e3962-9592-2d0a-b50b-52e2dddfbb66@cs.ucla.edu> (Paul Eggert's message of "Wed, 24 Jan 2018 15:00:13 -0800") References: <87popclj82.fsf@yandex.ru> <83608d80vy.fsf@gnu.org> <878td6u7vk.fsf@mattleach.net> <3d2e3962-9592-2d0a-b50b-52e2dddfbb66@cs.ucla.edu> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Date: Thu, 25 Jan 2018 19:34:03 +0000 Message-ID: <87k1w5d978.fsf@1e0.co.uk> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Mailman-Approved-At: Thu, 25 Jan 2018 14:58:48 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) --=-=-= Content-Type: text/plain Paul Eggert writes: > On 01/09/2018 11:53 AM, Matthew Leach wrote: >> May I suggest `internal--daemon-sockname'? > > Yes, that sounds good. Can you prepare a patch along those lines? > Sorry, I lost track of this bug report. It'd be nice if you could > re-propose a self-contained set of patches that address all the issues > raised so far. Thanks. Sure, please see the attached patch series. Thanks, -- Matt --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Fix-server-name-and-server-socket-dir-for-Bug-24218.patch >From e098a2dd17bf9a0701a58f2321c369380d81254e Mon Sep 17 00:00:00 2001 From: Matthew Leach Date: Sun, 7 Jan 2018 13:47:12 -0800 Subject: [PATCH 1/4] Fix `server-name' and `server-socket-dir' for (Bug#24218) * lisp/server.el: (server-external-socket-initialised): New (server-name): Compute server name from `get-external-sockname'. (server-socket-dir): Compute socket dir from `get-external-sockname'. (server-start): Don't check for existing server when an uninitialised external socket has been passed to Emacs. * src/emacs.c: (main): Obtain socket name via getsockname and pass to `init_process_emacs'. * src/lisp.h: (init_process_emacs): Add second parameter. * src/process.c: (external_sock_name): New. (get-external-sockname): New. (init_process_emacs): Set `external_sock_name' to `sockname' parameter. --- lisp/server.el | 56 ++++++++++++++++++++++++++++++++++++-------------------- src/emacs.c | 16 +++++++++++++--- src/lisp.h | 2 +- src/process.c | 19 ++++++++++++++++++- 4 files changed, 68 insertions(+), 25 deletions(-) diff --git a/lisp/server.el b/lisp/server.el index ac0d701851..e8b53530c9 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -251,8 +251,16 @@ server-existing-buffer are done with it in the server.") (make-variable-buffer-local 'server-existing-buffer) -;;;###autoload -(defcustom server-name "server" +(defvar server-external-socket-initialised nil + "When an external socket is passed into Emacs, we need to call +`server-start' in order to initialise the connection. This flag +prevents multiple initialisations when an external socket has +been consumed.") + +(defcustom server-name + (if (get-external-sockname) + (file-name-nondirectory (get-external-sockname)) + "server") "The name of the Emacs server, if this Emacs process creates one. The command `server-start' makes use of this. It should not be changed while a server is running." @@ -263,8 +271,10 @@ server-name ;; We do not use `temporary-file-directory' here, because emacsclient ;; does not read the init file. (defvar server-socket-dir - (and (featurep 'make-network-process '(:family local)) - (format "%s/emacs%d" (or (getenv "TMPDIR") "/tmp") (user-uid))) + (if (get-external-sockname) + (file-name-directory (get-external-sockname)) + (and (featurep 'make-network-process '(:family local)) + (format "%s/emacs%d" (or (getenv "TMPDIR") "/tmp") (user-uid)))) "The directory in which to place the server socket. If local sockets are not supported, this is nil.") @@ -618,23 +628,29 @@ server-start (when server-process ;; kill it dead! (ignore-errors (delete-process server-process))) - ;; Delete the socket files made by previous server invocations. - (if (not (eq t (server-running-p server-name))) - ;; Remove any leftover socket or authentication file - (ignore-errors - (let (delete-by-moving-to-trash) - (delete-file server-file))) - (setq server-mode nil) ;; already set by the minor mode code - (display-warning - 'server - (concat "Unable to start the Emacs server.\n" - (format "There is an existing Emacs server, named %S.\n" - server-name) - (substitute-command-keys - "To start the server in this Emacs process, stop the existing + ;; Check to see if an uninitialised external socket has been + ;; passed in, if that is the case, skip checking + ;; `server-running-p' as this will return the wrong result. + (if (and (get-external-sockname) + (not server-external-socket-initialised)) + (setq server-external-socket-initialised t) + ;; Delete the socket files made by previous server invocations. + (if (not (eq t (server-running-p server-name))) + ;; Remove any leftover socket or authentication file + (ignore-errors + (let (delete-by-moving-to-trash) + (delete-file server-file))) + (setq server-mode nil) ;; already set by the minor mode code + (display-warning + 'server + (concat "Unable to start the Emacs server.\n" + (format "There is an existing Emacs server, named %S.\n" + server-name) + (substitute-command-keys + "To start the server in this Emacs process, stop the existing server or call `\\[server-force-delete]' to forcibly disconnect it.")) - :warning) - (setq leave-dead t)) + :warning) + (setq leave-dead t))) ;; If this Emacs already had a server, clear out associated status. (while server-clients (server-delete-client (car server-clients))) diff --git a/src/emacs.c b/src/emacs.c index 20ced26283..1af09166b6 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -60,6 +60,7 @@ along with GNU Emacs. If not, see . */ #ifdef HAVE_LIBSYSTEMD # include # include +# include #endif #ifdef HAVE_WINDOW_SYSTEM @@ -1002,6 +1003,7 @@ main (int argc, char **argv) int sockfd = -1; + char *sockname = NULL; if (argmatch (argv, argc, "-fg-daemon", "--fg-daemon", 10, NULL, &skip_args) || argmatch (argv, argc, "-fg-daemon", "--fg-daemon", 10, &dname_arg, &skip_args)) @@ -1061,8 +1063,16 @@ main (int argc, char **argv) "Try 'Accept=false' in the Emacs socket unit file.\n")); else if (systemd_socket == 1 && (0 < sd_is_socket (SD_LISTEN_FDS_START, - AF_UNSPEC, SOCK_STREAM, 1))) - sockfd = SD_LISTEN_FDS_START; + AF_UNIX, SOCK_STREAM, 1))) + { + struct sockaddr_un sockaddr; + socklen_t sockaddr_sz = sizeof(sockaddr); + + sockfd = SD_LISTEN_FDS_START; + + if (!getsockname(sockfd, &sockaddr, &sockaddr_sz)) + sockname = strdup(sockaddr.sun_path); + } #endif /* HAVE_LIBSYSTEMD */ #ifdef USE_GTK @@ -1656,7 +1666,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem /* This can create a thread that may call getenv, so it must follow all calls to putenv and setenv. Also, this sets up add_keyboard_wait_descriptor, which init_display uses. */ - init_process_emacs (sockfd); + init_process_emacs (sockfd, sockname); init_keyboard (); /* This too must precede init_sys_modes. */ if (!noninteractive) diff --git a/src/lisp.h b/src/lisp.h index 3eb6e0d3c1..2e9002a226 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -4313,7 +4313,7 @@ extern void delete_keyboard_wait_descriptor (int); extern void add_gpm_wait_descriptor (int); extern void delete_gpm_wait_descriptor (int); #endif -extern void init_process_emacs (int); +extern void init_process_emacs (int, char *); extern void syms_of_process (void); extern void setup_process_coding_systems (Lisp_Object); diff --git a/src/process.c b/src/process.c index d4440e472d..da8e5714b0 100644 --- a/src/process.c +++ b/src/process.c @@ -276,6 +276,10 @@ static int max_desc; the file descriptor of a socket that is already bound. */ static int external_sock_fd; +/* The name (path) of the socket that was passed to Emacs, when + `external_sock_fd' is not -1. */ +static const char *external_sock_name = NULL; + /* Indexed by descriptor, gives the process (if any) for that descriptor. */ static Lisp_Object chan_process[FD_SETSIZE]; static void wait_for_socket_fds (Lisp_Object, char const *); @@ -7974,10 +7978,21 @@ restore_nofile_limit (void) } +DEFUN ("get-external-sockname", Fget_external_sockname, Sget_external_sockname, 0, 0, 0, + doc: /* Return the path of an external socket passed to Emacs. +Otherwise return nil. */) + (void) +{ + if (external_sock_name) + return make_string(external_sock_name, strlen(external_sock_name)); + else + return Qnil; +} + /* This is not called "init_process" because that is the name of a Mach system call, so it would cause problems on Darwin systems. */ void -init_process_emacs (int sockfd) +init_process_emacs (int sockfd, char *sockname) { #ifdef subprocesses int i; @@ -8012,6 +8027,7 @@ init_process_emacs (int sockfd) #endif external_sock_fd = sockfd; + external_sock_name = sockname; max_desc = -1; memset (fd_callback_info, 0, sizeof (fd_callback_info)); @@ -8306,4 +8322,5 @@ returns non-`nil'. */); defsubr (&Sprocess_inherit_coding_system_flag); defsubr (&Slist_system_processes); defsubr (&Sprocess_attributes); + defsubr (&Sget_external_sockname); } -- 2.16.1 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0002-Minor-cleanups-for-server-name-fix-Bug-24218.patch >From a4872a8e24027a0c8cc925140c3d3cda95c096e1 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 7 Jan 2018 13:47:12 -0800 Subject: [PATCH 2/4] Minor cleanups for server-name fix (Bug#24218) * lisp/server.el (server--external-socket-initialized): Rename from server-external-socket-initialised, since it should be private and Emacs uses American spelling. All uses changed. * src/emacs.c, src/lisp.h: Revert previous changes, as the initialization is now done in src/process.c, which already includes the relevant files. * src/process.c (union u_sockaddr): Move decl to top level. (external_sock_name, Fget_external_sockname): Remove, replacing with Vinternal__external_sockname. All uses changed. (init_process_emacs): Deduce socket name ourselves rather than have main.c do it. Use conv_sockaddr_to_lisp instead of doing it by hand. Conditionalize it on HAVE_GETSOCKNAME. --- lisp/server.el | 24 ++++++++++++------------ src/emacs.c | 16 +++------------- src/lisp.h | 2 +- src/process.c | 58 ++++++++++++++++++++++++++++++---------------------------- 4 files changed, 46 insertions(+), 54 deletions(-) diff --git a/lisp/server.el b/lisp/server.el index e8b53530c9..c867fde832 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -251,15 +251,15 @@ server-existing-buffer are done with it in the server.") (make-variable-buffer-local 'server-existing-buffer) -(defvar server-external-socket-initialised nil +(defvar server--external-socket-initialized nil "When an external socket is passed into Emacs, we need to call -`server-start' in order to initialise the connection. This flag -prevents multiple initialisations when an external socket has +`server-start' in order to initialize the connection. This flag +prevents multiple initializations when an external socket has been consumed.") (defcustom server-name - (if (get-external-sockname) - (file-name-nondirectory (get-external-sockname)) + (if internal--external-sockname + (file-name-nondirectory internal--external-sockname) "server") "The name of the Emacs server, if this Emacs process creates one. The command `server-start' makes use of this. It should not be @@ -271,8 +271,8 @@ server-name ;; We do not use `temporary-file-directory' here, because emacsclient ;; does not read the init file. (defvar server-socket-dir - (if (get-external-sockname) - (file-name-directory (get-external-sockname)) + (if internal--external-sockname + (file-name-directory internal--external-sockname) (and (featurep 'make-network-process '(:family local)) (format "%s/emacs%d" (or (getenv "TMPDIR") "/tmp") (user-uid)))) "The directory in which to place the server socket. @@ -628,15 +628,15 @@ server-start (when server-process ;; kill it dead! (ignore-errors (delete-process server-process))) - ;; Check to see if an uninitialised external socket has been + ;; Check to see if an uninitialized external socket has been ;; passed in, if that is the case, skip checking ;; `server-running-p' as this will return the wrong result. - (if (and (get-external-sockname) - (not server-external-socket-initialised)) - (setq server-external-socket-initialised t) + (if (and internal--external-sockname + (not server--external-socket-initialized)) + (setq server--external-socket-initialized t) ;; Delete the socket files made by previous server invocations. (if (not (eq t (server-running-p server-name))) - ;; Remove any leftover socket or authentication file + ;; Remove any leftover socket or authentication file. (ignore-errors (let (delete-by-moving-to-trash) (delete-file server-file))) diff --git a/src/emacs.c b/src/emacs.c index 1af09166b6..20ced26283 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -60,7 +60,6 @@ along with GNU Emacs. If not, see . */ #ifdef HAVE_LIBSYSTEMD # include # include -# include #endif #ifdef HAVE_WINDOW_SYSTEM @@ -1003,7 +1002,6 @@ main (int argc, char **argv) int sockfd = -1; - char *sockname = NULL; if (argmatch (argv, argc, "-fg-daemon", "--fg-daemon", 10, NULL, &skip_args) || argmatch (argv, argc, "-fg-daemon", "--fg-daemon", 10, &dname_arg, &skip_args)) @@ -1063,16 +1061,8 @@ main (int argc, char **argv) "Try 'Accept=false' in the Emacs socket unit file.\n")); else if (systemd_socket == 1 && (0 < sd_is_socket (SD_LISTEN_FDS_START, - AF_UNIX, SOCK_STREAM, 1))) - { - struct sockaddr_un sockaddr; - socklen_t sockaddr_sz = sizeof(sockaddr); - - sockfd = SD_LISTEN_FDS_START; - - if (!getsockname(sockfd, &sockaddr, &sockaddr_sz)) - sockname = strdup(sockaddr.sun_path); - } + AF_UNSPEC, SOCK_STREAM, 1))) + sockfd = SD_LISTEN_FDS_START; #endif /* HAVE_LIBSYSTEMD */ #ifdef USE_GTK @@ -1666,7 +1656,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem /* This can create a thread that may call getenv, so it must follow all calls to putenv and setenv. Also, this sets up add_keyboard_wait_descriptor, which init_display uses. */ - init_process_emacs (sockfd, sockname); + init_process_emacs (sockfd); init_keyboard (); /* This too must precede init_sys_modes. */ if (!noninteractive) diff --git a/src/lisp.h b/src/lisp.h index 2e9002a226..3eb6e0d3c1 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -4313,7 +4313,7 @@ extern void delete_keyboard_wait_descriptor (int); extern void add_gpm_wait_descriptor (int); extern void delete_gpm_wait_descriptor (int); #endif -extern void init_process_emacs (int, char *); +extern void init_process_emacs (int); extern void syms_of_process (void); extern void setup_process_coding_systems (Lisp_Object); diff --git a/src/process.c b/src/process.c index da8e5714b0..2613dd2be0 100644 --- a/src/process.c +++ b/src/process.c @@ -160,6 +160,18 @@ static bool kbd_is_on_hold; when exiting. */ bool inhibit_sentinels; +union u_sockaddr +{ + struct sockaddr sa; + struct sockaddr_in in; +#ifdef AF_INET6 + struct sockaddr_in6 in6; +#endif +#ifdef HAVE_LOCAL_SOCKETS + struct sockaddr_un un; +#endif +}; + #ifdef subprocesses #ifndef SOCK_CLOEXEC @@ -276,10 +288,6 @@ static int max_desc; the file descriptor of a socket that is already bound. */ static int external_sock_fd; -/* The name (path) of the socket that was passed to Emacs, when - `external_sock_fd' is not -1. */ -static const char *external_sock_name = NULL; - /* Indexed by descriptor, gives the process (if any) for that descriptor. */ static Lisp_Object chan_process[FD_SETSIZE]; static void wait_for_socket_fds (Lisp_Object, char const *); @@ -4679,16 +4687,7 @@ server_accept_connection (Lisp_Object server, int channel) struct Lisp_Process *ps = XPROCESS (server); struct Lisp_Process *p; int s; - union u_sockaddr { - struct sockaddr sa; - struct sockaddr_in in; -#ifdef AF_INET6 - struct sockaddr_in6 in6; -#endif -#ifdef HAVE_LOCAL_SOCKETS - struct sockaddr_un un; -#endif - } saddr; + union u_sockaddr saddr; socklen_t len = sizeof saddr; ptrdiff_t count; @@ -7978,21 +7977,10 @@ restore_nofile_limit (void) } -DEFUN ("get-external-sockname", Fget_external_sockname, Sget_external_sockname, 0, 0, 0, - doc: /* Return the path of an external socket passed to Emacs. -Otherwise return nil. */) - (void) -{ - if (external_sock_name) - return make_string(external_sock_name, strlen(external_sock_name)); - else - return Qnil; -} - /* This is not called "init_process" because that is the name of a Mach system call, so it would cause problems on Darwin systems. */ void -init_process_emacs (int sockfd, char *sockname) +init_process_emacs (int sockfd) { #ifdef subprocesses int i; @@ -8027,7 +8015,18 @@ init_process_emacs (int sockfd, char *sockname) #endif external_sock_fd = sockfd; - external_sock_name = sockname; + Lisp_Object sockname = Qnil; +# if HAVE_GETSOCKNAME + if (0 <= sockfd) + { + union u_sockaddr sa; + socklen_t salen = sizeof sa; + if (getsockname (sockfd, &sa.sa, &salen) == 0) + sockname = conv_sockaddr_to_lisp (&sa.sa, salen); + } +# endif + Vinternal__external_sockname = sockname; + max_desc = -1; memset (fd_callback_info, 0, sizeof (fd_callback_info)); @@ -8220,6 +8219,10 @@ These functions are called in the order of the list, until one of them returns non-`nil'. */); Vinterrupt_process_functions = list1 (Qinternal_default_interrupt_process); + DEFVAR_LISP ("internal--external-sockname", Vinternal__external_sockname, + doc: /* Name of external socket passed to Emacs, or nil if none. */); + Vinternal__external_sockname = Qnil; + DEFSYM (Qinternal_default_interrupt_process, "internal-default-interrupt-process"); DEFSYM (Qinterrupt_process_functions, "interrupt-process-functions"); @@ -8322,5 +8325,4 @@ returns non-`nil'. */); defsubr (&Sprocess_inherit_coding_system_flag); defsubr (&Slist_system_processes); defsubr (&Sprocess_attributes); - defsubr (&Sget_external_sockname); } -- 2.16.1 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0003-Update-server-name-version-document-sockname-Bug-242.patch >From 6a82f66d62e2669335419815504a276facfe0bf2 Mon Sep 17 00:00:00 2001 From: Matthew Leach Date: Tue, 9 Jan 2018 19:45:30 +0000 Subject: [PATCH 3/4] Update `server-name' :version & document sockname (Bug#24218) * lisp/server.el: (server-name): Update :version tag. * etc/NEWS: Document that `server-name' and `server-socket-dir' automatically update. * doc/misc.texi: (Emacs Server): Likewise. --- doc/emacs/misc.texi | 5 +++++ etc/NEWS | 3 +++ lisp/server.el | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 633e1e881d..c9b8f08252 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -1654,6 +1654,11 @@ Emacs Server @samp{foo}. The @code{emacsclient} program can specify a server by name, using the @samp{-s} option (@pxref{emacsclient Options}). + If Emacs is passed a socket by an external program --- for example +by systemd socket activation --- the value of @code{server-name} and +@code{server-socket-dir} is automatically updated to reflect the name +and path of the socket. + If you want to run multiple Emacs daemons (@pxref{Initial Options}), you can give each daemon its own server name like this: diff --git a/etc/NEWS b/etc/NEWS index f6f36dfc85..66cb0834c5 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -194,6 +194,9 @@ as new-style, bind the new variable 'force-new-style-backquotes' to t. * Lisp Changes in Emacs 27.1 +** The `server-name' and `server-socket-dir' variables are set when a +socket has been pased to Emacs (Bug#24218). + ** Internal parsing commands now use syntax-ppss and disregard open-paren-in-column-0-is-defun-start. This affects mostly things like forward-comment, scan-sexps, and forward-sexp when parsing backward. diff --git a/lisp/server.el b/lisp/server.el index c867fde832..16b3f8e4e2 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -266,7 +266,7 @@ server-name changed while a server is running." :group 'server :type 'string - :version "23.1") + :version "27.1") ;; We do not use `temporary-file-directory' here, because emacsclient ;; does not read the init file. -- 2.16.1 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0004-Rename-internal-external-sockname-and-document-Bug-2.patch >From 6bc1562dfc674df50f4947653be6e1a4cd436ccf Mon Sep 17 00:00:00 2001 From: Matthew Leach Date: Thu, 25 Jan 2018 19:24:14 +0000 Subject: [PATCH 4/4] Rename internal--external-sockname and document (Bug#24218) * lisp/server.el: Rename `internal--external-sockname' to `internal-daemon-sockname'. * src/process.c: Likewise. * doc/lispref/processes.texi: Document `internal-daemon-sockname'. --- doc/lispref/processes.texi | 17 ++++++++++++++--- lisp/server.el | 10 +++++----- src/process.c | 6 +++--- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index 8a8425cb84..7f078e950f 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi @@ -2860,9 +2860,9 @@ Network Feature Testing @node Misc Network @section Misc Network Facilities - These additional functions are useful for creating and operating -on network connections. Note that they are supported only on some -systems. + These additional functions and variables are useful for creating and +operating on network connections. Note that they are supported only +on some systems. @defun network-interface-list This function returns a list describing the network interfaces @@ -2911,6 +2911,17 @@ Misc Network @code{:@var{p}} suffix. @end defun +@defvar internal--daemon-sockname +This variable is set to the full path of the socket that has been +passed to Emacs during socket activation. This is then used to update +the @code{server-name} and @code{server-socket-dir} variables to +reflect the name and path of the socket that was used to launch the +Emacs daemon process. + +If Emacs wasn't started with socket activation, the value of this +variable is @code{nil}. +@end defvar + @node Serial Ports @section Communicating with Serial Ports @cindex @file{/dev/tty} diff --git a/lisp/server.el b/lisp/server.el index 16b3f8e4e2..4e0afa26f9 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -258,8 +258,8 @@ server--external-socket-initialized been consumed.") (defcustom server-name - (if internal--external-sockname - (file-name-nondirectory internal--external-sockname) + (if internal-daemon-sockname + (file-name-nondirectory internal-daemon-sockname) "server") "The name of the Emacs server, if this Emacs process creates one. The command `server-start' makes use of this. It should not be @@ -271,8 +271,8 @@ server-name ;; We do not use `temporary-file-directory' here, because emacsclient ;; does not read the init file. (defvar server-socket-dir - (if internal--external-sockname - (file-name-directory internal--external-sockname) + (if internal-daemon-sockname + (file-name-directory internal-daemon-sockname) (and (featurep 'make-network-process '(:family local)) (format "%s/emacs%d" (or (getenv "TMPDIR") "/tmp") (user-uid)))) "The directory in which to place the server socket. @@ -631,7 +631,7 @@ server-start ;; Check to see if an uninitialized external socket has been ;; passed in, if that is the case, skip checking ;; `server-running-p' as this will return the wrong result. - (if (and internal--external-sockname + (if (and internal-daemon-sockname (not server--external-socket-initialized)) (setq server--external-socket-initialized t) ;; Delete the socket files made by previous server invocations. diff --git a/src/process.c b/src/process.c index 2613dd2be0..48854e24b4 100644 --- a/src/process.c +++ b/src/process.c @@ -8025,7 +8025,7 @@ init_process_emacs (int sockfd) sockname = conv_sockaddr_to_lisp (&sa.sa, salen); } # endif - Vinternal__external_sockname = sockname; + Vinternal_daemon_sockname = sockname; max_desc = -1; memset (fd_callback_info, 0, sizeof (fd_callback_info)); @@ -8219,9 +8219,9 @@ These functions are called in the order of the list, until one of them returns non-`nil'. */); Vinterrupt_process_functions = list1 (Qinternal_default_interrupt_process); - DEFVAR_LISP ("internal--external-sockname", Vinternal__external_sockname, + DEFVAR_LISP ("internal-daemon-sockname", Vinternal_daemon_sockname, doc: /* Name of external socket passed to Emacs, or nil if none. */); - Vinternal__external_sockname = Qnil; + Vinternal_daemon_sockname = Qnil; DEFSYM (Qinternal_default_interrupt_process, "internal-default-interrupt-process"); -- 2.16.1 --=-=-=-- From unknown Mon Aug 18 11:32:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24218: 25.1.50; server-name, server-socket-dir and daemon start through, systemd socket Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 10 Feb 2018 16:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24218 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Matthew Leach Cc: 24218@debbugs.gnu.org, lomov.vl@gmail.com, Eli Zaretskii Received: via spool by 24218-submit@debbugs.gnu.org id=B24218.151827888113977 (code B ref 24218); Sat, 10 Feb 2018 16:09:02 +0000 Received: (at 24218) by debbugs.gnu.org; 10 Feb 2018 16:08:01 +0000 Received: from localhost ([127.0.0.1]:37167 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ekXh2-0003dI-QV for submit@debbugs.gnu.org; Sat, 10 Feb 2018 11:08:01 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:48246) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ekXgz-0003d3-Lx for 24218@debbugs.gnu.org; Sat, 10 Feb 2018 11:07:59 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 64E21161748; Sat, 10 Feb 2018 08:07:51 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id v12rFScoicJK; Sat, 10 Feb 2018 08:07:48 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id A779616174C; Sat, 10 Feb 2018 08:07:48 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Y53z24uzbhu7; Sat, 10 Feb 2018 08:07:48 -0800 (PST) Received: from [192.168.1.9] (unknown [47.154.30.119]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 3B1ED161748; Sat, 10 Feb 2018 08:07:48 -0800 (PST) References: <87popclj82.fsf@yandex.ru> <83608d80vy.fsf@gnu.org> <878td6u7vk.fsf@mattleach.net> <3d2e3962-9592-2d0a-b50b-52e2dddfbb66@cs.ucla.edu> <87k1w5d978.fsf@1e0.co.uk> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <52b062c7-adb2-c8ad-dc57-b5af849d5b18@cs.ucla.edu> Date: Sat, 10 Feb 2018 08:07:47 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <87k1w5d978.fsf@1e0.co.uk> Content-Type: multipart/mixed; boundary="------------9332E000B217EE43AA5F7FAF" Content-Language: en-US X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) This is a multi-part message in MIME format. --------------9332E000B217EE43AA5F7FAF Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Matthew Leach wrote: > Paul Eggert writes: > >> On 01/09/2018 11:53 AM, Matthew Leach wrote: >>> May I suggest `internal--daemon-sockname'? >> >> Yes, that sounds good. Can you prepare a patch along those lines? > > Sure, please see the attached patch series. Thanks, but aren't there some more places where the variable needs to be renamed to internal--daemon-sockname? Also, I would rather not document it in the Emacs Lisp reference manual, as it is an internal detail that outside code shouldn't depend on. Proposed further patch attached (it's the last of the attachments, which contain all the patches for this bug). --------------9332E000B217EE43AA5F7FAF Content-Type: text/x-patch; name="0001-Fix-server-name-and-server-socket-dir-for-Bug-24218.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Fix-server-name-and-server-socket-dir-for-Bug-24218.pat"; filename*1="ch" >From b71632dbba803c2cd22e9f18231d4eb38b1521f9 Mon Sep 17 00:00:00 2001 From: Matthew Leach Date: Sat, 10 Feb 2018 07:44:13 -0800 Subject: [PATCH 1/5] Fix `server-name' and `server-socket-dir' for (Bug#24218) * lisp/server.el: (server-external-socket-initialised): New (server-name): Compute server name from `get-external-sockname'. (server-socket-dir): Compute socket dir from `get-external-sockname'. (server-start): Don't check for existing server when an uninitialised external socket has been passed to Emacs. * src/emacs.c: (main): Obtain socket name via getsockname and pass to `init_process_emacs'. * src/lisp.h: (init_process_emacs): Add second parameter. * src/process.c: (external_sock_name): New. (get-external-sockname): New. (init_process_emacs): Set `external_sock_name' to `sockname' parameter. --- lisp/server.el | 56 ++++++++++++++++++++++++++++++++++++-------------------- src/emacs.c | 16 +++++++++++++--- src/lisp.h | 2 +- src/process.c | 19 ++++++++++++++++++- 4 files changed, 68 insertions(+), 25 deletions(-) diff --git a/lisp/server.el b/lisp/server.el index d91a51e..d2406e2 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -251,8 +251,16 @@ server-existing-buffer are done with it in the server.") (make-variable-buffer-local 'server-existing-buffer) -;;;###autoload -(defcustom server-name "server" +(defvar server-external-socket-initialised nil + "When an external socket is passed into Emacs, we need to call +`server-start' in order to initialise the connection. This flag +prevents multiple initialisations when an external socket has +been consumed.") + +(defcustom server-name + (if (get-external-sockname) + (file-name-nondirectory (get-external-sockname)) + "server") "The name of the Emacs server, if this Emacs process creates one. The command `server-start' makes use of this. It should not be changed while a server is running." @@ -263,8 +271,10 @@ server-name ;; We do not use `temporary-file-directory' here, because emacsclient ;; does not read the init file. (defvar server-socket-dir - (and (featurep 'make-network-process '(:family local)) - (format "%s/emacs%d" (or (getenv "TMPDIR") "/tmp") (user-uid))) + (if (get-external-sockname) + (file-name-directory (get-external-sockname)) + (and (featurep 'make-network-process '(:family local)) + (format "%s/emacs%d" (or (getenv "TMPDIR") "/tmp") (user-uid)))) "The directory in which to place the server socket. If local sockets are not supported, this is nil.") @@ -618,23 +628,29 @@ server-start (when server-process ;; kill it dead! (ignore-errors (delete-process server-process))) - ;; Delete the socket files made by previous server invocations. - (if (not (eq t (server-running-p server-name))) - ;; Remove any leftover socket or authentication file - (ignore-errors - (let (delete-by-moving-to-trash) - (delete-file server-file))) - (setq server-mode nil) ;; already set by the minor mode code - (display-warning - 'server - (concat "Unable to start the Emacs server.\n" - (format "There is an existing Emacs server, named %S.\n" - server-name) - (substitute-command-keys - "To start the server in this Emacs process, stop the existing + ;; Check to see if an uninitialised external socket has been + ;; passed in, if that is the case, skip checking + ;; `server-running-p' as this will return the wrong result. + (if (and (get-external-sockname) + (not server-external-socket-initialised)) + (setq server-external-socket-initialised t) + ;; Delete the socket files made by previous server invocations. + (if (not (eq t (server-running-p server-name))) + ;; Remove any leftover socket or authentication file + (ignore-errors + (let (delete-by-moving-to-trash) + (delete-file server-file))) + (setq server-mode nil) ;; already set by the minor mode code + (display-warning + 'server + (concat "Unable to start the Emacs server.\n" + (format "There is an existing Emacs server, named %S.\n" + server-name) + (substitute-command-keys + "To start the server in this Emacs process, stop the existing server or call `\\[server-force-delete]' to forcibly disconnect it.")) - :warning) - (setq leave-dead t)) + :warning) + (setq leave-dead t))) ;; If this Emacs already had a server, clear out associated status. (while server-clients (server-delete-client (car server-clients))) diff --git a/src/emacs.c b/src/emacs.c index 8ea61b7..c423faf 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -60,6 +60,7 @@ along with GNU Emacs. If not, see . */ #ifdef HAVE_LIBSYSTEMD # include # include +# include #endif #ifdef HAVE_WINDOW_SYSTEM @@ -1002,6 +1003,7 @@ main (int argc, char **argv) int sockfd = -1; + char *sockname = NULL; if (argmatch (argv, argc, "-fg-daemon", "--fg-daemon", 10, NULL, &skip_args) || argmatch (argv, argc, "-fg-daemon", "--fg-daemon", 10, &dname_arg, &skip_args)) @@ -1061,8 +1063,16 @@ main (int argc, char **argv) "Try 'Accept=false' in the Emacs socket unit file.\n")); else if (systemd_socket == 1 && (0 < sd_is_socket (SD_LISTEN_FDS_START, - AF_UNSPEC, SOCK_STREAM, 1))) - sockfd = SD_LISTEN_FDS_START; + AF_UNIX, SOCK_STREAM, 1))) + { + struct sockaddr_un sockaddr; + socklen_t sockaddr_sz = sizeof(sockaddr); + + sockfd = SD_LISTEN_FDS_START; + + if (!getsockname(sockfd, &sockaddr, &sockaddr_sz)) + sockname = strdup(sockaddr.sun_path); + } #endif /* HAVE_LIBSYSTEMD */ #ifdef USE_GTK @@ -1660,7 +1670,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem /* This can create a thread that may call getenv, so it must follow all calls to putenv and setenv. Also, this sets up add_keyboard_wait_descriptor, which init_display uses. */ - init_process_emacs (sockfd); + init_process_emacs (sockfd, sockname); init_keyboard (); /* This too must precede init_sys_modes. */ if (!noninteractive) diff --git a/src/lisp.h b/src/lisp.h index a7f0a1d..0bd0e5e 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -4316,7 +4316,7 @@ extern void delete_keyboard_wait_descriptor (int); extern void add_gpm_wait_descriptor (int); extern void delete_gpm_wait_descriptor (int); #endif -extern void init_process_emacs (int); +extern void init_process_emacs (int, char *); extern void syms_of_process (void); extern void setup_process_coding_systems (Lisp_Object); diff --git a/src/process.c b/src/process.c index 2cc2c86..405c06d 100644 --- a/src/process.c +++ b/src/process.c @@ -276,6 +276,10 @@ static int max_desc; the file descriptor of a socket that is already bound. */ static int external_sock_fd; +/* The name (path) of the socket that was passed to Emacs, when + `external_sock_fd' is not -1. */ +static const char *external_sock_name = NULL; + /* Indexed by descriptor, gives the process (if any) for that descriptor. */ static Lisp_Object chan_process[FD_SETSIZE]; static void wait_for_socket_fds (Lisp_Object, char const *); @@ -7972,10 +7976,21 @@ restore_nofile_limit (void) } +DEFUN ("get-external-sockname", Fget_external_sockname, Sget_external_sockname, 0, 0, 0, + doc: /* Return the path of an external socket passed to Emacs. +Otherwise return nil. */) + (void) +{ + if (external_sock_name) + return make_string(external_sock_name, strlen(external_sock_name)); + else + return Qnil; +} + /* This is not called "init_process" because that is the name of a Mach system call, so it would cause problems on Darwin systems. */ void -init_process_emacs (int sockfd) +init_process_emacs (int sockfd, char *sockname) { #ifdef subprocesses int i; @@ -8010,6 +8025,7 @@ init_process_emacs (int sockfd) #endif external_sock_fd = sockfd; + external_sock_name = sockname; max_desc = -1; memset (fd_callback_info, 0, sizeof (fd_callback_info)); @@ -8304,4 +8320,5 @@ returns non-`nil'. */); defsubr (&Sprocess_inherit_coding_system_flag); defsubr (&Slist_system_processes); defsubr (&Sprocess_attributes); + defsubr (&Sget_external_sockname); } -- 2.7.4 --------------9332E000B217EE43AA5F7FAF Content-Type: text/x-patch; name="0002-Minor-cleanups-for-server-name-fix-Bug-24218.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0002-Minor-cleanups-for-server-name-fix-Bug-24218.patch" >From dd3e2ccd71a137ec549fdfe6b9c5201c62f5f978 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 10 Feb 2018 07:44:13 -0800 Subject: [PATCH 2/5] Minor cleanups for server-name fix (Bug#24218) * lisp/server.el (server--external-socket-initialized): Rename from server-external-socket-initialised, since it should be private and Emacs uses American spelling. All uses changed. * src/emacs.c, src/lisp.h: Revert previous changes, as the initialization is now done in src/process.c, which already includes the relevant files. * src/process.c (union u_sockaddr): Move decl to top level. (external_sock_name, Fget_external_sockname): Remove, replacing with Vinternal__external_sockname. All uses changed. (init_process_emacs): Deduce socket name ourselves rather than have main.c do it. Use conv_sockaddr_to_lisp instead of doing it by hand. Conditionalize it on HAVE_GETSOCKNAME. --- lisp/server.el | 24 ++++++++++++------------ src/emacs.c | 16 +++------------- src/lisp.h | 2 +- src/process.c | 58 ++++++++++++++++++++++++++++++---------------------------- 4 files changed, 46 insertions(+), 54 deletions(-) diff --git a/lisp/server.el b/lisp/server.el index d2406e2..70ac51e 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -251,15 +251,15 @@ server-existing-buffer are done with it in the server.") (make-variable-buffer-local 'server-existing-buffer) -(defvar server-external-socket-initialised nil +(defvar server--external-socket-initialized nil "When an external socket is passed into Emacs, we need to call -`server-start' in order to initialise the connection. This flag -prevents multiple initialisations when an external socket has +`server-start' in order to initialize the connection. This flag +prevents multiple initializations when an external socket has been consumed.") (defcustom server-name - (if (get-external-sockname) - (file-name-nondirectory (get-external-sockname)) + (if internal--external-sockname + (file-name-nondirectory internal--external-sockname) "server") "The name of the Emacs server, if this Emacs process creates one. The command `server-start' makes use of this. It should not be @@ -271,8 +271,8 @@ server-name ;; We do not use `temporary-file-directory' here, because emacsclient ;; does not read the init file. (defvar server-socket-dir - (if (get-external-sockname) - (file-name-directory (get-external-sockname)) + (if internal--external-sockname + (file-name-directory internal--external-sockname) (and (featurep 'make-network-process '(:family local)) (format "%s/emacs%d" (or (getenv "TMPDIR") "/tmp") (user-uid)))) "The directory in which to place the server socket. @@ -628,15 +628,15 @@ server-start (when server-process ;; kill it dead! (ignore-errors (delete-process server-process))) - ;; Check to see if an uninitialised external socket has been + ;; Check to see if an uninitialized external socket has been ;; passed in, if that is the case, skip checking ;; `server-running-p' as this will return the wrong result. - (if (and (get-external-sockname) - (not server-external-socket-initialised)) - (setq server-external-socket-initialised t) + (if (and internal--external-sockname + (not server--external-socket-initialized)) + (setq server--external-socket-initialized t) ;; Delete the socket files made by previous server invocations. (if (not (eq t (server-running-p server-name))) - ;; Remove any leftover socket or authentication file + ;; Remove any leftover socket or authentication file. (ignore-errors (let (delete-by-moving-to-trash) (delete-file server-file))) diff --git a/src/emacs.c b/src/emacs.c index c423faf..8ea61b7 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -60,7 +60,6 @@ along with GNU Emacs. If not, see . */ #ifdef HAVE_LIBSYSTEMD # include # include -# include #endif #ifdef HAVE_WINDOW_SYSTEM @@ -1003,7 +1002,6 @@ main (int argc, char **argv) int sockfd = -1; - char *sockname = NULL; if (argmatch (argv, argc, "-fg-daemon", "--fg-daemon", 10, NULL, &skip_args) || argmatch (argv, argc, "-fg-daemon", "--fg-daemon", 10, &dname_arg, &skip_args)) @@ -1063,16 +1061,8 @@ main (int argc, char **argv) "Try 'Accept=false' in the Emacs socket unit file.\n")); else if (systemd_socket == 1 && (0 < sd_is_socket (SD_LISTEN_FDS_START, - AF_UNIX, SOCK_STREAM, 1))) - { - struct sockaddr_un sockaddr; - socklen_t sockaddr_sz = sizeof(sockaddr); - - sockfd = SD_LISTEN_FDS_START; - - if (!getsockname(sockfd, &sockaddr, &sockaddr_sz)) - sockname = strdup(sockaddr.sun_path); - } + AF_UNSPEC, SOCK_STREAM, 1))) + sockfd = SD_LISTEN_FDS_START; #endif /* HAVE_LIBSYSTEMD */ #ifdef USE_GTK @@ -1670,7 +1660,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem /* This can create a thread that may call getenv, so it must follow all calls to putenv and setenv. Also, this sets up add_keyboard_wait_descriptor, which init_display uses. */ - init_process_emacs (sockfd, sockname); + init_process_emacs (sockfd); init_keyboard (); /* This too must precede init_sys_modes. */ if (!noninteractive) diff --git a/src/lisp.h b/src/lisp.h index 0bd0e5e..a7f0a1d 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -4316,7 +4316,7 @@ extern void delete_keyboard_wait_descriptor (int); extern void add_gpm_wait_descriptor (int); extern void delete_gpm_wait_descriptor (int); #endif -extern void init_process_emacs (int, char *); +extern void init_process_emacs (int); extern void syms_of_process (void); extern void setup_process_coding_systems (Lisp_Object); diff --git a/src/process.c b/src/process.c index 405c06d..8396a93 100644 --- a/src/process.c +++ b/src/process.c @@ -160,6 +160,18 @@ static bool kbd_is_on_hold; when exiting. */ bool inhibit_sentinels; +union u_sockaddr +{ + struct sockaddr sa; + struct sockaddr_in in; +#ifdef AF_INET6 + struct sockaddr_in6 in6; +#endif +#ifdef HAVE_LOCAL_SOCKETS + struct sockaddr_un un; +#endif +}; + #ifdef subprocesses #ifndef SOCK_CLOEXEC @@ -276,10 +288,6 @@ static int max_desc; the file descriptor of a socket that is already bound. */ static int external_sock_fd; -/* The name (path) of the socket that was passed to Emacs, when - `external_sock_fd' is not -1. */ -static const char *external_sock_name = NULL; - /* Indexed by descriptor, gives the process (if any) for that descriptor. */ static Lisp_Object chan_process[FD_SETSIZE]; static void wait_for_socket_fds (Lisp_Object, char const *); @@ -4677,16 +4685,7 @@ server_accept_connection (Lisp_Object server, int channel) struct Lisp_Process *ps = XPROCESS (server); struct Lisp_Process *p; int s; - union u_sockaddr { - struct sockaddr sa; - struct sockaddr_in in; -#ifdef AF_INET6 - struct sockaddr_in6 in6; -#endif -#ifdef HAVE_LOCAL_SOCKETS - struct sockaddr_un un; -#endif - } saddr; + union u_sockaddr saddr; socklen_t len = sizeof saddr; ptrdiff_t count; @@ -7976,21 +7975,10 @@ restore_nofile_limit (void) } -DEFUN ("get-external-sockname", Fget_external_sockname, Sget_external_sockname, 0, 0, 0, - doc: /* Return the path of an external socket passed to Emacs. -Otherwise return nil. */) - (void) -{ - if (external_sock_name) - return make_string(external_sock_name, strlen(external_sock_name)); - else - return Qnil; -} - /* This is not called "init_process" because that is the name of a Mach system call, so it would cause problems on Darwin systems. */ void -init_process_emacs (int sockfd, char *sockname) +init_process_emacs (int sockfd) { #ifdef subprocesses int i; @@ -8025,7 +8013,18 @@ init_process_emacs (int sockfd, char *sockname) #endif external_sock_fd = sockfd; - external_sock_name = sockname; + Lisp_Object sockname = Qnil; +# if HAVE_GETSOCKNAME + if (0 <= sockfd) + { + union u_sockaddr sa; + socklen_t salen = sizeof sa; + if (getsockname (sockfd, &sa.sa, &salen) == 0) + sockname = conv_sockaddr_to_lisp (&sa.sa, salen); + } +# endif + Vinternal__external_sockname = sockname; + max_desc = -1; memset (fd_callback_info, 0, sizeof (fd_callback_info)); @@ -8218,6 +8217,10 @@ These functions are called in the order of the list, until one of them returns non-`nil'. */); Vinterrupt_process_functions = list1 (Qinternal_default_interrupt_process); + DEFVAR_LISP ("internal--external-sockname", Vinternal__external_sockname, + doc: /* Name of external socket passed to Emacs, or nil if none. */); + Vinternal__external_sockname = Qnil; + DEFSYM (Qinternal_default_interrupt_process, "internal-default-interrupt-process"); DEFSYM (Qinterrupt_process_functions, "interrupt-process-functions"); @@ -8320,5 +8323,4 @@ returns non-`nil'. */); defsubr (&Sprocess_inherit_coding_system_flag); defsubr (&Slist_system_processes); defsubr (&Sprocess_attributes); - defsubr (&Sget_external_sockname); } -- 2.7.4 --------------9332E000B217EE43AA5F7FAF Content-Type: text/x-patch; name="0003-Update-server-name-version-document-sockname-Bug-242.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0003-Update-server-name-version-document-sockname-Bug-242.pa"; filename*1="tch" >From 705e134823603689cc2fb0a58719bd13eb13250c Mon Sep 17 00:00:00 2001 From: Matthew Leach Date: Sat, 10 Feb 2018 07:47:45 -0800 Subject: [PATCH 3/5] Update `server-name' :version & document sockname (Bug#24218) * lisp/server.el: (server-name): Update :version tag. * etc/NEWS: Document that `server-name' and `server-socket-dir' automatically update. * doc/misc.texi: (Emacs Server): Likewise. --- etc/NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index 8fed15a..772dff7 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -248,6 +248,9 @@ forward-comment, scan-sexps, and forward-sexp when parsing backward. The new variable 'comment-use-syntax-ppss' can be set to nil to recover the old behavior if needed. +** The `server-name' and `server-socket-dir' variables are set when a +socket has been pased to Emacs (Bug#24218). + --- ** The 'file-system-info' function is now available on all platforms. instead of just Microsoft platforms. This fixes a 'get-free-disk-space' -- 2.7.4 --------------9332E000B217EE43AA5F7FAF Content-Type: text/x-patch; name="0004-Rename-internal-external-sockname-and-document-Bug-2.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0004-Rename-internal-external-sockname-and-document-Bug-2.pa"; filename*1="tch" >From 84288f3afb711ac27219263aed5c2caa45608d32 Mon Sep 17 00:00:00 2001 From: Matthew Leach Date: Sat, 10 Feb 2018 07:47:45 -0800 Subject: [PATCH 4/5] Rename internal--external-sockname and document (Bug#24218) * lisp/server.el: Rename `internal--external-sockname' to `internal-daemon-sockname'. * src/process.c: Likewise. * doc/lispref/processes.texi: Document `internal-daemon-sockname'. --- doc/lispref/processes.texi | 17 ++++++++++++++--- lisp/server.el | 10 +++++----- src/process.c | 6 +++--- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index af177e0..07317dd 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi @@ -2862,9 +2862,9 @@ Network Feature Testing @node Misc Network @section Misc Network Facilities - These additional functions are useful for creating and operating -on network connections. Note that they are supported only on some -systems. + These additional functions and variables are useful for creating and +operating on network connections. Note that they are supported only +on some systems. @defun network-interface-list This function returns a list describing the network interfaces @@ -2913,6 +2913,17 @@ Misc Network @code{:@var{p}} suffix. @end defun +@defvar internal--daemon-sockname +This variable is set to the full path of the socket that has been +passed to Emacs during socket activation. This is then used to update +the @code{server-name} and @code{server-socket-dir} variables to +reflect the name and path of the socket that was used to launch the +Emacs daemon process. + +If Emacs wasn't started with socket activation, the value of this +variable is @code{nil}. +@end defvar + @node Serial Ports @section Communicating with Serial Ports @cindex @file{/dev/tty} diff --git a/lisp/server.el b/lisp/server.el index 70ac51e..744568a 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -258,8 +258,8 @@ server--external-socket-initialized been consumed.") (defcustom server-name - (if internal--external-sockname - (file-name-nondirectory internal--external-sockname) + (if internal-daemon-sockname + (file-name-nondirectory internal-daemon-sockname) "server") "The name of the Emacs server, if this Emacs process creates one. The command `server-start' makes use of this. It should not be @@ -271,8 +271,8 @@ server-name ;; We do not use `temporary-file-directory' here, because emacsclient ;; does not read the init file. (defvar server-socket-dir - (if internal--external-sockname - (file-name-directory internal--external-sockname) + (if internal-daemon-sockname + (file-name-directory internal-daemon-sockname) (and (featurep 'make-network-process '(:family local)) (format "%s/emacs%d" (or (getenv "TMPDIR") "/tmp") (user-uid)))) "The directory in which to place the server socket. @@ -631,7 +631,7 @@ server-start ;; Check to see if an uninitialized external socket has been ;; passed in, if that is the case, skip checking ;; `server-running-p' as this will return the wrong result. - (if (and internal--external-sockname + (if (and internal-daemon-sockname (not server--external-socket-initialized)) (setq server--external-socket-initialized t) ;; Delete the socket files made by previous server invocations. diff --git a/src/process.c b/src/process.c index 8396a93..fe55a48 100644 --- a/src/process.c +++ b/src/process.c @@ -8023,7 +8023,7 @@ init_process_emacs (int sockfd) sockname = conv_sockaddr_to_lisp (&sa.sa, salen); } # endif - Vinternal__external_sockname = sockname; + Vinternal_daemon_sockname = sockname; max_desc = -1; memset (fd_callback_info, 0, sizeof (fd_callback_info)); @@ -8217,9 +8217,9 @@ These functions are called in the order of the list, until one of them returns non-`nil'. */); Vinterrupt_process_functions = list1 (Qinternal_default_interrupt_process); - DEFVAR_LISP ("internal--external-sockname", Vinternal__external_sockname, + DEFVAR_LISP ("internal-daemon-sockname", Vinternal_daemon_sockname, doc: /* Name of external socket passed to Emacs, or nil if none. */); - Vinternal__external_sockname = Qnil; + Vinternal_daemon_sockname = Qnil; DEFSYM (Qinternal_default_interrupt_process, "internal-default-interrupt-process"); -- 2.7.4 --------------9332E000B217EE43AA5F7FAF Content-Type: text/x-patch; name="0005-Finish-renaming-to-internal-daemon-sockname.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0005-Finish-renaming-to-internal-daemon-sockname.patch" >From f5a3f2a5d79308473cd8aa360b2ff1bd72b7f734 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 10 Feb 2018 08:03:33 -0800 Subject: [PATCH 5/5] Finish renaming to internal--daemon-sockname * doc/lispref/processes.texi (Misc Network): Omit discussion of internal--daemon-sockname, as non-Emacs code shouldn't rely on it. * src/process.c (syms_of_process): Rename internal-daemon-sockname to internal--daemon-sockname. All uses changed. --- doc/lispref/processes.texi | 17 +++-------------- lisp/server.el | 10 +++++----- src/process.c | 6 +++--- 3 files changed, 11 insertions(+), 22 deletions(-) diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index 07317dd..af177e0 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi @@ -2862,9 +2862,9 @@ Network Feature Testing @node Misc Network @section Misc Network Facilities - These additional functions and variables are useful for creating and -operating on network connections. Note that they are supported only -on some systems. + These additional functions are useful for creating and operating +on network connections. Note that they are supported only on some +systems. @defun network-interface-list This function returns a list describing the network interfaces @@ -2913,17 +2913,6 @@ Misc Network @code{:@var{p}} suffix. @end defun -@defvar internal--daemon-sockname -This variable is set to the full path of the socket that has been -passed to Emacs during socket activation. This is then used to update -the @code{server-name} and @code{server-socket-dir} variables to -reflect the name and path of the socket that was used to launch the -Emacs daemon process. - -If Emacs wasn't started with socket activation, the value of this -variable is @code{nil}. -@end defvar - @node Serial Ports @section Communicating with Serial Ports @cindex @file{/dev/tty} diff --git a/lisp/server.el b/lisp/server.el index 744568a..d393388 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -258,8 +258,8 @@ server--external-socket-initialized been consumed.") (defcustom server-name - (if internal-daemon-sockname - (file-name-nondirectory internal-daemon-sockname) + (if internal--daemon-sockname + (file-name-nondirectory internal--daemon-sockname) "server") "The name of the Emacs server, if this Emacs process creates one. The command `server-start' makes use of this. It should not be @@ -271,8 +271,8 @@ server-name ;; We do not use `temporary-file-directory' here, because emacsclient ;; does not read the init file. (defvar server-socket-dir - (if internal-daemon-sockname - (file-name-directory internal-daemon-sockname) + (if internal--daemon-sockname + (file-name-directory internal--daemon-sockname) (and (featurep 'make-network-process '(:family local)) (format "%s/emacs%d" (or (getenv "TMPDIR") "/tmp") (user-uid)))) "The directory in which to place the server socket. @@ -631,7 +631,7 @@ server-start ;; Check to see if an uninitialized external socket has been ;; passed in, if that is the case, skip checking ;; `server-running-p' as this will return the wrong result. - (if (and internal-daemon-sockname + (if (and internal--daemon-sockname (not server--external-socket-initialized)) (setq server--external-socket-initialized t) ;; Delete the socket files made by previous server invocations. diff --git a/src/process.c b/src/process.c index fe55a48..2ec10b1 100644 --- a/src/process.c +++ b/src/process.c @@ -8023,7 +8023,7 @@ init_process_emacs (int sockfd) sockname = conv_sockaddr_to_lisp (&sa.sa, salen); } # endif - Vinternal_daemon_sockname = sockname; + Vinternal__daemon_sockname = sockname; max_desc = -1; memset (fd_callback_info, 0, sizeof (fd_callback_info)); @@ -8217,9 +8217,9 @@ These functions are called in the order of the list, until one of them returns non-`nil'. */); Vinterrupt_process_functions = list1 (Qinternal_default_interrupt_process); - DEFVAR_LISP ("internal-daemon-sockname", Vinternal_daemon_sockname, + DEFVAR_LISP ("internal--daemon-sockname", Vinternal__daemon_sockname, doc: /* Name of external socket passed to Emacs, or nil if none. */); - Vinternal_daemon_sockname = Qnil; + Vinternal__daemon_sockname = Qnil; DEFSYM (Qinternal_default_interrupt_process, "internal-default-interrupt-process"); -- 2.7.4 --------------9332E000B217EE43AA5F7FAF-- From unknown Mon Aug 18 11:32:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24218: 25.1.50; server-name, server-socket-dir and daemon start through, systemd socket Resent-From: Matthew Leach Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 12 Feb 2018 14:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24218 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Paul Eggert Cc: 24218@debbugs.gnu.org, lomov.vl@gmail.com Received: via spool by 24218-submit@debbugs.gnu.org id=B24218.151844564816730 (code B ref 24218); Mon, 12 Feb 2018 14:28:02 +0000 Received: (at 24218) by debbugs.gnu.org; 12 Feb 2018 14:27:28 +0000 Received: from localhost ([127.0.0.1]:39020 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1elF4p-0004Ll-Vf for submit@debbugs.gnu.org; Mon, 12 Feb 2018 09:27:28 -0500 Received: from mx0.mattleach.net ([176.58.118.143]:36374) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1elF4n-0004Ld-NB for 24218@debbugs.gnu.org; Mon, 12 Feb 2018 09:27:26 -0500 Received: by mx0.mattleach.net (Postfix, from userid 99) id D30D161E83; Mon, 12 Feb 2018 14:27:24 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mx0.mattleach.net X-Spam-Level: X-Spam-Status: No, score=-1.0 required=4.0 tests=ALL_TRUSTED,URIBL_BLOCKED autolearn=disabled version=3.4.1 Received: from matt-desktop.mattleach.net (unknown [IPv6:2001:8b0:a772:bfd0:517b:4db3:f1af:cfe9]) by mx0.mattleach.net (Postfix) with ESMTPSA id 82B0361C93; Mon, 12 Feb 2018 14:27:23 +0000 (GMT) From: Matthew Leach In-Reply-To: <52b062c7-adb2-c8ad-dc57-b5af849d5b18@cs.ucla.edu> (Paul Eggert's message of "Sat, 10 Feb 2018 08:07:47 -0800") References: <87popclj82.fsf@yandex.ru> <83608d80vy.fsf@gnu.org> <878td6u7vk.fsf@mattleach.net> <3d2e3962-9592-2d0a-b50b-52e2dddfbb66@cs.ucla.edu> <87k1w5d978.fsf@1e0.co.uk> <52b062c7-adb2-c8ad-dc57-b5af849d5b18@cs.ucla.edu> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Date: Mon, 12 Feb 2018 14:24:06 +0000 Message-ID: <874lmmz3p5.fsf@mattleach.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Paul Eggert writes: > Matthew Leach wrote: >> Paul Eggert writes: >> >>> On 01/09/2018 11:53 AM, Matthew Leach wrote: >>>> May I suggest `internal--daemon-sockname'? >>> >>> Yes, that sounds good. Can you prepare a patch along those lines? >> >> Sure, please see the attached patch series. > > Thanks, but aren't there some more places where the variable needs to > be renamed to internal--daemon-sockname? Oops - I missed an additional `-' on the variable name. > Also, I would rather not document it in the Emacs Lisp reference > manual, as it is an internal detail that outside code shouldn't depend > on. That sounds fine; I wasn't aware that internal variables shouldn't be documented in the Emacs List Reference Manual. > Proposed further patch attached (it's the last of the attachments, > which contain all the patches for this bug). This last patch looks good to me. Thanks, -- Matt From unknown Mon Aug 18 11:32:26 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Vladimir Lomov Subject: bug#24218: closed (Re: bug#24218: 25.1.50; server-name, server-socket-dir and daemon start through, systemd socket) Message-ID: References: <87popclj82.fsf@yandex.ru> X-Gnu-PR-Message: they-closed 24218 X-Gnu-PR-Package: emacs Reply-To: 24218@debbugs.gnu.org Date: Mon, 12 Feb 2018 20:59:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1518469142-2045-1" This is a multi-part message in MIME format... ------------=_1518469142-2045-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #24218: 25.1.50; server-name, server-socket-dir and daemon start through sy= stemd socket which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 24218@debbugs.gnu.org. --=20 24218: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D24218 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1518469142-2045-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 24218-done) by debbugs.gnu.org; 12 Feb 2018 20:58:41 +0000 Received: from localhost ([127.0.0.1]:40091 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1elLBR-0000WU-CJ for submit@debbugs.gnu.org; Mon, 12 Feb 2018 15:58:41 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:50524) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1elLBQ-0000WH-7A for 24218-done@debbugs.gnu.org; Mon, 12 Feb 2018 15:58:40 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 883AD160097; Mon, 12 Feb 2018 12:58:34 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id anWWD1cWtICQ; Mon, 12 Feb 2018 12:58:33 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id D77F61600F3; Mon, 12 Feb 2018 12:58:33 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Ce58wgBxoS7k; Mon, 12 Feb 2018 12:58:33 -0800 (PST) Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id B9728160097; Mon, 12 Feb 2018 12:58:33 -0800 (PST) Subject: Re: bug#24218: 25.1.50; server-name, server-socket-dir and daemon start through, systemd socket To: Matthew Leach References: <87popclj82.fsf@yandex.ru> <83608d80vy.fsf@gnu.org> <878td6u7vk.fsf@mattleach.net> <3d2e3962-9592-2d0a-b50b-52e2dddfbb66@cs.ucla.edu> <87k1w5d978.fsf@1e0.co.uk> <52b062c7-adb2-c8ad-dc57-b5af849d5b18@cs.ucla.edu> <874lmmz3p5.fsf@mattleach.net> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: Date: Mon, 12 Feb 2018 12:58:33 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <874lmmz3p5.fsf@mattleach.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 24218-done Cc: 24218-done@debbugs.gnu.org, lomov.vl@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) On 02/12/2018 06:24 AM, Matthew Leach wrote: > This last patch looks good to me. Thanks for checking; I installed the patches into 'master' and am marking this bug as done. ------------=_1518469142-2045-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 13 Aug 2016 16:36:33 +0000 Received: from localhost ([127.0.0.1]:56526 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYbvE-0007aQ-R6 for submit@debbugs.gnu.org; Sat, 13 Aug 2016 12:36:33 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40607) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYbvC-0007aC-CB for submit@debbugs.gnu.org; Sat, 13 Aug 2016 12:36:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bYbv4-0002Kg-IF for submit@debbugs.gnu.org; Sat, 13 Aug 2016 12:36:25 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:53472) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bYbv4-0002Kb-CM for submit@debbugs.gnu.org; Sat, 13 Aug 2016 12:36:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59810) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bYbv0-0000w9-8P for bug-gnu-emacs@gnu.org; Sat, 13 Aug 2016 12:36:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bYbuv-0002Fi-Q5 for bug-gnu-emacs@gnu.org; Sat, 13 Aug 2016 12:36:17 -0400 Received: from forward12h.cmail.yandex.net ([87.250.230.154]:48331) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bYbuu-0002E4-9T for bug-gnu-emacs@gnu.org; Sat, 13 Aug 2016 12:36:13 -0400 Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [77.88.29.84]) by forward12h.cmail.yandex.net (Yandex) with ESMTP id 7B19321503 for ; Sat, 13 Aug 2016 19:35:59 +0300 (MSK) Received: from smtp1p.mail.yandex.net (localhost.localdomain [127.0.0.1]) by smtp1p.mail.yandex.net (Yandex) with ESMTP id 71A9817804FB for ; Sat, 13 Aug 2016 19:35:59 +0300 (MSK) Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id RlBCBJKoPA-ZwL0TXdX; Sat, 13 Aug 2016 19:35:58 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1471106158; bh=d+ifMVWlrBA55f8zdgE5uLP9RweKJzTD3+eBkTgCJ88=; h=From:To:Subject:Date:Message-ID; b=nTIPU+mCdCHEWCBZM4rIuzAP21PwAaO0Vtu6PnBZ5HxWt7G62dwCp+IF+SafBPtvm yLR0HtqWj1zqHqTZSA/uJLC68DPkl+giP77oaaIXc+Lm5/qGA4L2GzBubYahg91VEY oUZMaL++x1Ts47KDbT1H7Y56W2F/C/F2eObcHrg8= Authentication-Results: smtp1p.mail.yandex.net; dkim=pass header.i=@yandex.ru X-Yandex-Suid-Status: 1 0 From: Vladimir Lomov To: bug-gnu-emacs@gnu.org Subject: 25.1.50; server-name, server-socket-dir and daemon start through systemd socket Date: Sun, 14 Aug 2016 00:35:57 +0800 Message-ID: <87popclj82.fsf@yandex.ru> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Hello, first of all I not sure if this is a bug report or more likely it is a feature request. Recently Emacs got code to start daemon by means of systemd. For this one needs to create two files: `emacs.socket` and `emacs.service`, for example, the content of these files can be found in the manual. The problem is that when emacs daemon is started this way any it's client doesn't have correct values for `server-name` and `server-socket-dir` variables. Moreover, attemp to set these variables manually in `.emacs` triggers (that is not surprise, I think) failure in emacs daemon start. I think it should be possible to set these variables to correct values in `.emacs` that don't cause failure in emacs daemon start, especially taking into account that there is `:use-external-socket` variable. To illustrate the situation consider the following `emacs.socket` file [Socket] ListenStream=%t/emacs [Install] WantedBy=sockets.target almost litteraly copied from Emacs manual and following `emacs.service` file [Unit] Description=Emacs [Service] Type=forking ExecStart=/path/to/emacs --daemon ExecStop=/path/to/emacsclient --eval "(kill-emacs)" Restart=always [Install] WantedBy=default.target If one starts `emacs.socket` file $ systemctl --user start emacs.socket and connect to the daemon (which is not started yet) by means of the socket file assuming that `.emacs` is empty $ emacsclient -c -s /run/user/1000/emacs then all is Ok except the values of `server-name` and `server-socket-dir`: they are wrong (they have "default" values: `server` and `/tmp/emacs1000`). If one would use `.emacs` with settings of these variables (setq server-name "emacs" server-socket-dir "/run/user/1000") and run the same command for `emacsclient` in clean conditions (this means that `service` and `socket` must be stopped before that and `socket` must be started again) one finds that daemon is not started. P.S. Sorry if this description isn't clean enough. In GNU Emacs 25.1.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.20.8) of 2016-08-11 built on smoon6-1.vl-lomov.ru Repository revision: cd3524061346dec4ec820c98b6ca8046eda290c3 Windowing system distributor 'The X.Org Foundation', version 11.0.11804000 Recent messages: Auto-saving...done Saving file /home/vladimir/works/org/.git/COMMIT_EDITMSG... bzip2ing .COMMIT_EDITMSG.~undo-tree~.bz2...done Wrote /home/vladimir/works/org/.git/.COMMIT_EDITMSG.~undo-tree~.bz2 Wrote /home/vladimir/works/org/.git/COMMIT_EDITMSG Git finished [2 times] Type C-h i to view popup manual, ? to describe an argument or action. Running git push -v origin master:refs/heads/master [2 times] Git finished [2 times] When done with this frame, type C-x 5 0 Configured using: 'configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libexecdir=/usr/lib --with-x-toolkit=gtk3 --without-gconf 'CFLAGS=-march=x86-64 -mtune=native -O2 -pipe -fstack-protector-strong' LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro CPPFLAGS=-D_FORTIFY_SOURCE=2' Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 LIBSYSTEMD Important settings: value of $LC_COLLATE: C value of $LANG: ru_RU.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: global-undo-tree-mode: t undo-tree-mode: t diff-auto-refine-mode: t magit-auto-revert-mode: t global-git-commit-mode: t global-auto-complete-mode: t auto-complete-mode: t pdf-occur-global-minor-mode: t shell-dirtrack-mode: t ido-everywhere: t display-time-mode: t show-paren-mode: t tooltip-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: /usr/share/emacs/site-lisp/org/org-list hides /usr/share/emacs/25.1.50/lisp/org/org-list /usr/share/emacs/site-lisp/org/org-element hides /usr/share/emacs/25.1.50/lisp/org/org-element /usr/share/emacs/site-lisp/org/org-mouse hides /usr/share/emacs/25.1.50/lisp/org/org-mouse /usr/share/emacs/site-lisp/org/org-attach hides /usr/share/emacs/25.1.50/lisp/org/org-attach /usr/share/emacs/site-lisp/org/org-agenda hides /usr/share/emacs/25.1.50/lisp/org/org-agenda /usr/share/emacs/site-lisp/org/ob-screen hides /usr/share/emacs/25.1.50/lisp/org/ob-screen /usr/share/emacs/site-lisp/org/ox-html hides /usr/share/emacs/25.1.50/lisp/org/ox-html /usr/share/emacs/site-lisp/org/ob-sass hides /usr/share/emacs/25.1.50/lisp/org/ob-sass /usr/share/emacs/site-lisp/org/ob-ditaa hides /usr/share/emacs/25.1.50/lisp/org/ob-ditaa /usr/share/emacs/site-lisp/org/ob-keys hides /usr/share/emacs/25.1.50/lisp/org/ob-keys /usr/share/emacs/site-lisp/org/ob-core hides /usr/share/emacs/25.1.50/lisp/org/ob-core /usr/share/emacs/site-lisp/org/ob-ocaml hides /usr/share/emacs/25.1.50/lisp/org/ob-ocaml /usr/share/emacs/site-lisp/org/ob-comint hides /usr/share/emacs/25.1.50/lisp/org/ob-comint /usr/share/emacs/site-lisp/org/ob-ruby hides /usr/share/emacs/25.1.50/lisp/org/ob-ruby /usr/share/emacs/site-lisp/org/ob-calc hides /usr/share/emacs/25.1.50/lisp/org/ob-calc /usr/share/emacs/site-lisp/org/ob-plantuml hides /usr/share/emacs/25.1.50/lisp/org/ob-plantuml /usr/share/emacs/site-lisp/org/org-macro hides /usr/share/emacs/25.1.50/lisp/org/org-macro /usr/share/emacs/site-lisp/org/org-irc hides /usr/share/emacs/25.1.50/lisp/org/org-irc /usr/share/emacs/site-lisp/org/org-inlinetask hides /usr/share/emacs/25.1.50/lisp/org/org-inlinetask /usr/share/emacs/site-lisp/org/ox-beamer hides /usr/share/emacs/25.1.50/lisp/org/ox-beamer /usr/share/emacs/site-lisp/org/org-info hides /usr/share/emacs/25.1.50/lisp/org/org-info /usr/share/emacs/site-lisp/org/org-indent hides /usr/share/emacs/25.1.50/lisp/org/org-indent /usr/share/emacs/site-lisp/org/ox-ascii hides /usr/share/emacs/25.1.50/lisp/org/ox-ascii /usr/share/emacs/site-lisp/org/org-id hides /usr/share/emacs/25.1.50/lisp/org/org-id /usr/share/emacs/site-lisp/org/org-habit hides /usr/share/emacs/25.1.50/lisp/org/org-habit /usr/share/emacs/site-lisp/org/org-gnus hides /usr/share/emacs/25.1.50/lisp/org/org-gnus /usr/share/emacs/site-lisp/org/org-footnote hides /usr/share/emacs/25.1.50/lisp/org/org-footnote /usr/share/emacs/site-lisp/org/org-timer hides /usr/share/emacs/25.1.50/lisp/org/org-timer /usr/share/emacs/site-lisp/org/org-feed hides /usr/share/emacs/25.1.50/lisp/org/org-feed /usr/share/emacs/site-lisp/org/ox hides /usr/share/emacs/25.1.50/lisp/org/ox /usr/share/emacs/site-lisp/org/org-faces hides /usr/share/emacs/25.1.50/lisp/org/org-faces /usr/share/emacs/site-lisp/org/ox-texinfo hides /usr/share/emacs/25.1.50/lisp/org/ox-texinfo /usr/share/emacs/site-lisp/org/org-eshell hides /usr/share/emacs/25.1.50/lisp/org/org-eshell /usr/share/emacs/site-lisp/org/org-table hides /usr/share/emacs/25.1.50/lisp/org/org-table /usr/share/emacs/site-lisp/org/org-entities hides /usr/share/emacs/25.1.50/lisp/org/org-entities /usr/share/emacs/site-lisp/org/org-src hides /usr/share/emacs/25.1.50/lisp/org/org-src /usr/share/emacs/site-lisp/org/org-rmail hides /usr/share/emacs/25.1.50/lisp/org/org-rmail /usr/share/emacs/site-lisp/org/org-docview hides /usr/share/emacs/25.1.50/lisp/org/org-docview /usr/share/emacs/site-lisp/org/org-protocol hides /usr/share/emacs/25.1.50/lisp/org/org-protocol /usr/share/emacs/site-lisp/org/org-datetree hides /usr/share/emacs/25.1.50/lisp/org/org-datetree /usr/share/emacs/site-lisp/org/org-plot hides /usr/share/emacs/25.1.50/lisp/org/org-plot /usr/share/emacs/site-lisp/org/org-ctags hides /usr/share/emacs/25.1.50/lisp/org/org-ctags /usr/share/emacs/site-lisp/org/ox-publish hides /usr/share/emacs/25.1.50/lisp/org/ox-publish /usr/share/emacs/site-lisp/org/org-crypt hides /usr/share/emacs/25.1.50/lisp/org/org-crypt /usr/share/emacs/site-lisp/org/ox-org hides /usr/share/emacs/25.1.50/lisp/org/ox-org /usr/share/emacs/site-lisp/org/org-compat hides /usr/share/emacs/25.1.50/lisp/org/org-compat /usr/share/emacs/site-lisp/org/org-pcomplete hides /usr/share/emacs/25.1.50/lisp/org/org-pcomplete /usr/share/emacs/site-lisp/org/org-colview hides /usr/share/emacs/25.1.50/lisp/org/org-colview /usr/share/emacs/site-lisp/org/org-clock hides /usr/share/emacs/25.1.50/lisp/org/org-clock /usr/share/emacs/site-lisp/org/ox-odt hides /usr/share/emacs/25.1.50/lisp/org/ox-odt /usr/share/emacs/site-lisp/org/org-capture hides /usr/share/emacs/25.1.50/lisp/org/org-capture /usr/share/emacs/site-lisp/org/org-mobile hides /usr/share/emacs/25.1.50/lisp/org/org-mobile /usr/share/emacs/site-lisp/org/org-bibtex hides /usr/share/emacs/25.1.50/lisp/org/org-bibtex /usr/share/emacs/site-lisp/org/org-mhe hides /usr/share/emacs/25.1.50/lisp/org/org-mhe /usr/share/emacs/site-lisp/org/org-bbdb hides /usr/share/emacs/25.1.50/lisp/org/org-bbdb /usr/share/emacs/site-lisp/org/ox-md hides /usr/share/emacs/25.1.50/lisp/org/ox-md /usr/share/emacs/site-lisp/org/org-macs hides /usr/share/emacs/25.1.50/lisp/org/org-macs /usr/share/emacs/site-lisp/org/org-archive hides /usr/share/emacs/25.1.50/lisp/org/org-archive /usr/share/emacs/site-lisp/org/org-w3m hides /usr/share/emacs/25.1.50/lisp/org/org-w3m /usr/share/emacs/site-lisp/org/org hides /usr/share/emacs/25.1.50/lisp/org/org /usr/share/emacs/site-lisp/org/ob hides /usr/share/emacs/25.1.50/lisp/org/ob /usr/share/emacs/site-lisp/org/ob-tangle hides /usr/share/emacs/25.1.50/lisp/org/ob-tangle /usr/share/emacs/site-lisp/org/ox-man hides /usr/share/emacs/25.1.50/lisp/org/ox-man /usr/share/emacs/site-lisp/org/ob-table hides /usr/share/emacs/25.1.50/lisp/org/ob-table /usr/share/emacs/site-lisp/org/ox-latex hides /usr/share/emacs/25.1.50/lisp/org/ox-latex /usr/share/emacs/site-lisp/org/ob-sqlite hides /usr/share/emacs/25.1.50/lisp/org/ob-sqlite /usr/share/emacs/site-lisp/org/ox-icalendar hides /usr/share/emacs/25.1.50/lisp/org/ox-icalendar /usr/share/emacs/site-lisp/org/ob-sql hides /usr/share/emacs/25.1.50/lisp/org/ob-sql /usr/share/emacs/site-lisp/org/ob-shen hides /usr/share/emacs/25.1.50/lisp/org/ob-shen /usr/share/emacs/site-lisp/org/ob-scheme hides /usr/share/emacs/25.1.50/lisp/org/ob-scheme /usr/share/emacs/site-lisp/org/ob-scala hides /usr/share/emacs/25.1.50/lisp/org/ob-scala /usr/share/emacs/site-lisp/org/ob-python hides /usr/share/emacs/25.1.50/lisp/org/ob-python /usr/share/emacs/site-lisp/org/ob-ref hides /usr/share/emacs/25.1.50/lisp/org/ob-ref /usr/share/emacs/site-lisp/org/ob-lisp hides /usr/share/emacs/25.1.50/lisp/org/ob-lisp /usr/share/emacs/site-lisp/org/ob-fortran hides /usr/share/emacs/25.1.50/lisp/org/ob-fortran /usr/share/emacs/site-lisp/org/ob-exp hides /usr/share/emacs/25.1.50/lisp/org/ob-exp /usr/share/emacs/site-lisp/org/ob-perl hides /usr/share/emacs/25.1.50/lisp/org/ob-perl /usr/share/emacs/site-lisp/org/ob-lilypond hides /usr/share/emacs/25.1.50/lisp/org/ob-lilypond /usr/share/emacs/site-lisp/org/ob-eval hides /usr/share/emacs/25.1.50/lisp/org/ob-eval /usr/share/emacs/site-lisp/org/ob-org hides /usr/share/emacs/25.1.50/lisp/org/ob-org /usr/share/emacs/site-lisp/org/ob-ledger hides /usr/share/emacs/25.1.50/lisp/org/ob-ledger /usr/share/emacs/site-lisp/org/ob-emacs-lisp hides /usr/share/emacs/25.1.50/lisp/org/ob-emacs-lisp /usr/share/emacs/site-lisp/org/ob-maxima hides /usr/share/emacs/25.1.50/lisp/org/ob-maxima /usr/share/emacs/site-lisp/org/ob-haskell hides /usr/share/emacs/25.1.50/lisp/org/ob-haskell /usr/share/emacs/site-lisp/org/ob-dot hides /usr/share/emacs/25.1.50/lisp/org/ob-dot /usr/share/emacs/site-lisp/org/ob-mscgen hides /usr/share/emacs/25.1.50/lisp/org/ob-mscgen /usr/share/emacs/site-lisp/org/ob-js hides /usr/share/emacs/25.1.50/lisp/org/ob-js /usr/share/emacs/site-lisp/org/ob-matlab hides /usr/share/emacs/25.1.50/lisp/org/ob-matlab /usr/share/emacs/site-lisp/org/ob-java hides /usr/share/emacs/25.1.50/lisp/org/ob-java /usr/share/emacs/site-lisp/org/ob-css hides /usr/share/emacs/25.1.50/lisp/org/ob-css /usr/share/emacs/site-lisp/org/ob-octave hides /usr/share/emacs/25.1.50/lisp/org/ob-octave /usr/share/emacs/site-lisp/org/ob-latex hides /usr/share/emacs/25.1.50/lisp/org/ob-latex /usr/share/emacs/site-lisp/org/ob-lob hides /usr/share/emacs/25.1.50/lisp/org/ob-lob /usr/share/emacs/site-lisp/org/ob-io hides /usr/share/emacs/25.1.50/lisp/org/ob-io /usr/share/emacs/site-lisp/org/ob-clojure hides /usr/share/emacs/25.1.50/lisp/org/ob-clojure /usr/share/emacs/site-lisp/org/ob-makefile hides /usr/share/emacs/25.1.50/lisp/org/ob-makefile /usr/share/emacs/site-lisp/org/ob-gnuplot hides /usr/share/emacs/25.1.50/lisp/org/ob-gnuplot /usr/share/emacs/site-lisp/org/ob-R hides /usr/share/emacs/25.1.50/lisp/org/ob-R /usr/share/emacs/site-lisp/org/ob-awk hides /usr/share/emacs/25.1.50/lisp/org/ob-awk /usr/share/emacs/site-lisp/org/ob-C hides /usr/share/emacs/25.1.50/lisp/org/ob-C /usr/share/emacs/site-lisp/org/ob-picolisp hides /usr/share/emacs/25.1.50/lisp/org/ob-picolisp /usr/share/emacs/site-lisp/org/ob-asymptote hides /usr/share/emacs/25.1.50/lisp/org/ob-asymptote /usr/share/emacs/site-lisp/org/org-loaddefs hides /usr/share/emacs/25.1.50/lisp/org/org-loaddefs /usr/share/emacs/site-lisp/org/org-version hides /usr/share/emacs/25.1.50/lisp/org/org-version /usr/share/emacs/site-lisp/org/org-install hides /usr/share/emacs/25.1.50/lisp/org/org-install Features: (shadow sort spook cookie1 mail-extr emacsbug sendmail linum cal-move parse-time calc-map calc-stat calc-vec calc-ext calc-menu calc-aent calc calc-loaddefs calc-macs org-table cdlatex texmathp org-annotate-file org-id org-habit org-info org-docview doc-view org-bibtex bibtex org-bbdb vc-git thingatpt flymake magit-version undo-tree diff magit-blame magit-stash magit-bisect magit-remote magit-commit magit-sequence magit package url-handlers magit-apply magit-wip magit-log magit-diff smerge-mode diff-mode magit-core magit-autorevert autorevert filenotify magit-process magit-popup magit-mode magit-git crm magit-section magit-utils git-commit help-fns radix-tree log-edit message subr-x puny rfc822 mml mml-sec epa epg epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils mailheader pcvs-util add-log with-editor tramp-sh server dash auto-complete-config auto-complete popup calfw-ical url url-proxy url-privacy url-expand url-methods url-history url-cookie url-domsuf url-util url-parse url-vars mailcap icalendar diary-lib diary-loaddefs calfw-org org-capture org-agenda calfw holidays hol-loaddefs cl ob-shell ob-R ob-perl ob-latex ob-asymptote ob-gnuplot ox-odt rng-loc rng-uri rng-parse rng-match rng-dt rng-util rng-pttrn nxml-parse nxml-ns nxml-enc xmltok nxml-util ox-latex ox-icalendar ox-html table ox-ascii ox-publish ox preview-latex tex-site auto-loads pdf-sync pdf-outline pdf-occur ibuf-ext ibuffer ibuffer-loaddefs pdf-links pdf-isearch let-alist pdf-history pdf-annot tablist tablist-filter semantic/wisent/comp semantic/wisent semantic/wisent/wisent semantic/util-modes semantic/util semantic semantic/tag semantic/lex semantic/fw mode-local cedet org-element avl-tree org org-macro org-footnote org-pcomplete org-list org-faces org-entities noutline outline org-version ob-emacs-lisp ob ob-tangle org-src ob-ref ob-lob ob-table ob-keys ob-exp ob-comint tramp tramp-compat tramp-loaddefs trampver ucs-normalize shell pcomplete auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache ob-core ob-eval org-compat org-macs org-loaddefs find-func cal-menu calendar cal-loaddefs pdf-misc imenu pdf-tools compile comint ansi-color ring cus-edit cus-start cus-load wid-edit pdf-view jka-compr pdf-cache pdf-info tq pdf-util image-mode dired+ image-dired format-spec image-file dired-aux bookmark+ bookmark+-key edmacro kmacro easy-mmode advice derived dired-x dired dired-loaddefs bookmark+-1 bookmark+-bmu bookmark+-lit bookmark pp ido seq byte-opt gv bytecomp byte-compile cl-extra cconv quail help-mode easymenu cl-loaddefs pcase cl-lib time flyspell ispell time-date paren mule-util cyril-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese charscript case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote dbusbind inotify dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 496832 58236) (symbols 48 50535 0) (miscs 40 177 481) (strings 32 118385 14977) (string-bytes 1 3804225) (vectors 16 78228) (vector-slots 8 1869287 211061) (floats 8 507 374) (intervals 56 1311 69) (buffers 976 23)) -- WBR, Vladimir Lomov SUN Microsystems: The Network IS the Load Average. EuroFed ASPIC Attorney General Pipe bomb undercover Leuken-Baden Federal Aviation Administration Reflection Palestine Liberation Organization Chemical burn Incident SWS 22nd SAS Sugar Grove Dirty bomb -- ------------=_1518469142-2045-1--