unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Philipp Stephani <p.stephani2@gmail.com>
Cc: Glenn Morris <rgm@gnu.org>, 44481@debbugs.gnu.org
Subject: bug#44481: 28.0.50; Byte compilation doesn't work with --no-build-details
Date: Sat, 07 Nov 2020 17:30:55 +0100	[thread overview]
Message-ID: <87wnyxceo0.fsf@gmx.de> (raw)
In-Reply-To: <87d00qe6bt.fsf@gmx.de> (Michael Albinus's message of "Fri, 06 Nov 2020 18:35:50 +0100")

[-- Attachment #1: Type: text/plain, Size: 504 bytes --]

Michael Albinus <michael.albinus@gmx.de> writes:

> Glenn Morris <rgm@gnu.org> writes:
>
>> See also https://debbugs.gnu.org/34448 .
>>
>> I would guess Tramp isn't the only thing expecting system-name to be a string.
>
> Perhaps system-name returns better "localhost" but nil? Or at least the
> empty string, at build time with --no-build-details?

Since Tramp must also work for older Emacs versions, it needs an own fix
anyway.

Philipp, does the appended patch work for you?

Best regards, Michael.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 2595 bytes --]

diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 51e15af2ef..b79fb54573 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -4927,7 +4927,7 @@ tramp-maybe-open-connection
 	      (setenv "PS1" tramp-initial-end-of-output)
               (unless (stringp tramp-encoding-shell)
                 (tramp-error vec 'file-error "`tramp-encoding-shell' not set"))
-	      (let* ((current-host (system-name))
+	      (let* ((current-host tramp-system-name)
 		     (target-alist (tramp-compute-multi-hops vec))
 		     ;; We will apply `tramp-ssh-controlmaster-options'
 		     ;; only for the first hop.
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 55f652fa9a..2e32481198 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -175,6 +175,12 @@ tramp-encoding-command-interactive
   :version "24.1"
   :type '(choice (const nil) string))

+;; Since Emacs 26.1, `system-name' can return `nil' at build time if
+;; Emacs is compiled with "--no-build-details".  We do expect it to be
+;; a string.  (Bug#44481)
+(defconst tramp-system-name (or (system-name) "")
+  "The system name Tramp is running locally.")
+
 (defvar tramp-methods nil
   "Alist of methods for remote files.
 This is a list of entries of the form (NAME PARAM1 PARAM2 ...).
@@ -416,7 +422,7 @@ tramp-default-user-alist
 		       (choice :tag "  Host regexp" regexp sexp)
 		       (choice :tag "    User name" string (const nil)))))

-(defcustom tramp-default-host (system-name)
+(defcustom tramp-default-host tramp-system-name
   "Default host to use for transferring files.
 Useful for su and sudo methods mostly."
   :type 'string)
@@ -471,8 +477,8 @@ tramp-save-ad-hoc-proxies
 (defcustom tramp-restricted-shell-hosts-alist
   (when (memq system-type '(windows-nt))
     (list (format "\\`\\(%s\\|%s\\)\\'"
-		  (regexp-quote (downcase (system-name)))
-		  (regexp-quote (upcase (system-name))))))
+		  (regexp-quote (downcase tramp-system-name))
+		  (regexp-quote (upcase tramp-system-name)))))
   "List of hosts, which run a restricted shell.
 This is a list of regular expressions, which denote hosts running
 a restricted shell like \"rbash\".  Those hosts can be used as
@@ -485,7 +491,7 @@ tramp-local-host-regexp
   (concat
    "\\`"
    (regexp-opt
-    (list "localhost" "localhost6" (system-name) "127.0.0.1" "::1") t)
+    (list "localhost" "localhost6" tramp-system-name "127.0.0.1" "::1") t)
    "\\'")
   "Host names which are regarded as local host.
 If the local host runs a chrooted environment, set this to nil."

  reply	other threads:[~2020-11-07 16:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-06 13:23 bug#44481: 28.0.50; Byte compilation doesn't work with --no-build-details Philipp Stephani
2020-11-06 17:16 ` Glenn Morris
2020-11-06 17:35   ` Michael Albinus
2020-11-07 16:30     ` Michael Albinus [this message]
2020-11-14  9:20       ` Michael Albinus
2020-11-21 15:09         ` Michael Albinus
2020-11-22 20:09           ` Philipp Stephani

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wnyxceo0.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=44481@debbugs.gnu.org \
    --cc=p.stephani2@gmail.com \
    --cc=rgm@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).