Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
97311068
Commit
97311068
authored
Dec 29, 2014
by
Paul Eggert
Browse files
Fix previous patch to match its commit message
parent
f9acac75
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
30 additions
and
138 deletions
+30
-138
ChangeLog
ChangeLog
+9
-3
doc/lispref/os.texi
doc/lispref/os.texi
+0
-12
etc/NEWS
etc/NEWS
+3
-1
lisp/dnd.el
lisp/dnd.el
+7
-7
lisp/gnus/message.el
lisp/gnus/message.el
+5
-5
lisp/gnus/nnvirtual.el
lisp/gnus/nnvirtual.el
+4
-4
lisp/startup.el
lisp/startup.el
+2
-0
src/sysdep.c
src/sysdep.c
+0
-106
No files found.
ChangeLog
View file @
97311068
2014-12-29 Paul Eggert <eggert@cs.ucla.edu>
system-name's returned value can vary
Also, the system-name variable is now obsolete.
Fixes Bug#19438.
* doc/lispref/os.texi (System Environment):
* etc/NEWS: Document this.
...
...
@@ -8,6 +9,7 @@
(Displaying the current file name in the titlebar):
* lisp/desktop.el (desktop-save-frameset):
* lisp/dnd.el (dnd-get-local-file-uri):
* lisp/gnus/message.el (message-make-fqdn):
* lisp/gnus/nnvirtual.el (nnvirtual-retrieve-headers)
(nnvirtual-update-xref-header):
* lisp/nxml/rng-uri.el (rng-uri-file-name-1):
...
...
@@ -16,14 +18,18 @@
* src/xrdb.c (get_environ_db):
* src/xterm.c (same_x_server):
* src/xterm.c (x_term_init):
Prefer (system-name) to system-name.
Prefer (system-name) to system-name, and avoid naming
locals 'system-name'.
* doc/misc/smtpmail.texi (Server workarounds): Fix grammar.
* lisp/startup.el (system-name): Now an obsolete variable.
* src/editfns.c (cached_system_name): New static var.
(init_and_cache_system_name): New function.
(init_editfns, Fsystem_name): Use it.
(syms_of_editfns): Initialize it and Vsystem_name to the same value.
* src/sysdep.c (init_system_name): Don't create a new string if
the current value is already correct.
* src/sysdep.c [HAVE_SOCKETS]: Don't include <sys/socket.h>, <netdb.h>.
(h_errno) [TRY_AGAIN && !HAVE_H_ERRNO]: Remove decl.
(init_system_name) [HAVE_SOCKETS]: Don't canonicalize the name.
Don't create a new string if the current value is already correct.
2014-12-28 Paul Eggert <eggert@cs.ucla.edu>
...
...
doc/lispref/os.texi
View file @
97311068
...
...
@@ -917,18 +917,6 @@ This function returns the name of the machine you are running on, as a
string.
@end defun
The symbol @code{system-name} is a variable as well as a function. In
fact, the function normally returns whatever value the variable
@code{system-name} currently holds. Thus, you can set the variable
@code{system-name} in case Emacs is confused about the name of your
system. If you do not set the variable, the function updates
the variable to the current system name; this behavior can be useful
if your Emacs process has changed systems or if the system has changed
names.
The @code{system-name} variable is also useful for constructing frame titles
(@pxref{Frame Titles}).
@c FIXME seems like this section is not the best place for this option?
@defopt mail-host-address
If this variable is non-@code{nil}, it is used instead of
...
...
etc/NEWS
View file @
97311068
...
...
@@ -542,7 +542,9 @@ optional repeat-count argument.
** Function `sort' can deal with vectors.
** Function `system-name' now returns an updated value if the current
system's name has changed, or if the Emacs process has changed systems.
system's name has changed or if the Emacs process has changed systems,
and to avoid long waits it no longer consults DNS to canonicalize the
name. The variable `system-name' is now obsolete.
---
** New utilities in subr-x.el:
...
...
lisp/dnd.el
View file @
97311068
...
...
@@ -122,17 +122,17 @@ Return nil if URI is not a local file."
;; The hostname may be our hostname, in that case, convert to a local
;; file. Otherwise return nil. TODO: How about an IP-address as hostname?
(
let
((
sys
tem-
name
(
system-name
)))
(
let
((
sysname
(
system-name
)))
(
let
((
hostname
(
when
(
string-match
"^file://\\([^/]*\\)"
uri
)
(
downcase
(
match-string
1
uri
))))
(
sys
tem-
name-no-dot
(
downcase
(
if
(
string-match
"^[^\\.]+"
sys
tem-
name
)
(
match-string
0
sys
tem-
name
)
sys
tem-
name
))))
(
sysname-no-dot
(
downcase
(
if
(
string-match
"^[^\\.]+"
sysname
)
(
match-string
0
sysname
)
sysname
))))
(
when
(
and
hostname
(
or
(
string-equal
"localhost"
hostname
)
(
string-equal
(
downcase
sys
tem-
name
)
hostname
)
(
string-equal
sys
tem-
name-no-dot
hostname
)))
(
string-equal
(
downcase
sysname
)
hostname
)
(
string-equal
sysname-no-dot
hostname
)))
(
concat
"file://"
(
substring
uri
(
+
7
(
length
hostname
))))))))
(
defsubst
dnd-unescape-uri
(
uri
)
...
...
lisp/gnus/message.el
View file @
97311068
...
...
@@ -5849,7 +5849,7 @@ give as trustworthy answer as possible."
(defun message-make-fqdn ()
"Return user's fully qualified domain name."
(let* ((sys
tem-
name (system-name))
(let* ((sysname (system-name))
(user-mail (message-user-mail-address))
(user-domain
(if (and user-mail
...
...
@@ -5863,10 +5863,10 @@ give as trustworthy answer as possible."
(not (string-match message-bogus-system-names message-user-fqdn)))
;; `message-user-fqdn' seems to be valid
message-user-fqdn)
((and (string-match message-valid-fqdn-regexp sys
tem-
name)
(not (string-match message-bogus-system-names sys
tem-
name)))
((and (string-match message-valid-fqdn-regexp sysname)
(not (string-match message-bogus-system-names sysname)))
;; `system-name' returned the right result.
sys
tem-
name)
sysname)
;; Try `mail-host-address'.
((and (boundp 'mail-host-address)
(stringp mail-host-address)
...
...
@@ -5881,7 +5881,7 @@ give as trustworthy answer as possible."
user-domain)
;; Default to this bogus thing.
(t
(concat sys
tem-
name
(concat sysname
".i-did-not-set--mail-host-address--so-tickle-me")))))
(defun message-make-domain ()
...
...
lisp/gnus/nnvirtual.el
View file @
97311068
...
...
@@ -99,7 +99,7 @@ component group will show up when you enter the virtual group.")
(
let
((
vbuf
(
nnheader-set-temp-buffer
(
get-buffer-create
" *virtual headers*"
)))
(
carticles
(
nnvirtual-partition-sequence
articles
))
(
sys
tem-
name
(
system-name
))
(
sysname
(
system-name
))
cgroup
carticle
article
result
prefix
)
(
while
carticles
(
setq
cgroup
(
caar
carticles
))
...
...
@@ -151,7 +151,7 @@ component group will show up when you enter the virtual group.")
;; and clean up the xrefs.
(
princ
article
nntp-server-buffer
)
(
nnvirtual-update-xref-header
cgroup
carticle
prefix
(
sys
tem-
name
)
)
prefix
sysname
)
(
forward-line
1
))
)
...
...
@@ -378,7 +378,7 @@ component group will show up when you enter the virtual group.")
(
mapc
'nnheader-insert-nov
headers
))))
(
defun
nnvirtual-update-xref-header
(
group
article
prefix
sys
tem-
name
)
(
defun
nnvirtual-update-xref-header
(
group
article
prefix
sysname
)
"Edit current NOV header in current buffer to have an xref to the component group, and also server prefix any existing xref lines."
;; Move to beginning of Xref field, creating a slot if needed.
(
beginning-of-line
)
...
...
@@ -393,7 +393,7 @@ component group will show up when you enter the virtual group.")
(
forward-char
-1
)
(
delete-char
1
))
(
insert
"Xref: "
(
sys
tem-
name
)
" "
group
":"
)
(
insert
"Xref: "
sysname
" "
group
":"
)
(
princ
article
(
current-buffer
))
(
insert
" "
)
...
...
lisp/startup.el
View file @
97311068
...
...
@@ -358,6 +358,8 @@ this variable usefully is to set it while building and dumping Emacs."
:set (lambda (_variable _value)
(error "
Customizing
`
site-run-file
'
does
not
work
")))
(make-obsolete-variable 'system-name "
use
(
system-name
)
instead
" "
25.1
")
(defcustom mail-host-address nil
"
Name
of
this
machine,
for
purposes
of
naming
users.
If
non-nil,
Emacs
uses
this
instead
of
`
system-name
'
when
constructing
...
...
src/sysdep.c
View file @
97311068
...
...
@@ -1406,17 +1406,6 @@ setup_pty (int fd)
}
#endif
/* HAVE_PTYS */
#ifdef HAVE_SOCKETS
#include <sys/socket.h>
#include <netdb.h>
#endif
/* HAVE_SOCKETS */
#ifdef TRY_AGAIN
#ifndef HAVE_H_ERRNO
extern
int
h_errno
;
#endif
#endif
/* TRY_AGAIN */
void
init_system_name
(
void
)
{
...
...
@@ -1447,101 +1436,6 @@ init_system_name (void)
hostname
=
hostname_alloc
=
xpalloc
(
hostname_alloc
,
&
hostname_size
,
1
,
min
(
PTRDIFF_MAX
,
SIZE_MAX
),
1
);
}
#ifdef HAVE_SOCKETS
/* Turn the hostname into the official, fully-qualified hostname.
Don't do this if we're going to dump; this can confuse system
libraries on some machines and make the dumped emacs core dump. */
#ifndef CANNOT_DUMP
if
(
initialized
)
#endif
/* not CANNOT_DUMP */
if
(
!
strchr
(
hostname
,
'.'
))
{
int
count
;
#ifdef HAVE_GETADDRINFO
struct
addrinfo
*
res
;
struct
addrinfo
hints
;
int
ret
;
memset
(
&
hints
,
0
,
sizeof
(
hints
));
hints
.
ai_socktype
=
SOCK_STREAM
;
hints
.
ai_flags
=
AI_CANONNAME
;
for
(
count
=
0
;;
count
++
)
{
if
((
ret
=
getaddrinfo
(
hostname
,
NULL
,
&
hints
,
&
res
))
==
0
||
ret
!=
EAI_AGAIN
)
break
;
if
(
count
>=
5
)
break
;
Fsleep_for
(
make_number
(
1
),
Qnil
);
}
if
(
ret
==
0
)
{
struct
addrinfo
*
it
=
res
;
while
(
it
)
{
char
*
fqdn
=
it
->
ai_canonname
;
if
(
fqdn
&&
strchr
(
fqdn
,
'.'
)
&&
strcmp
(
fqdn
,
"localhost.localdomain"
)
!=
0
)
break
;
it
=
it
->
ai_next
;
}
if
(
it
)
{
ptrdiff_t
len
=
strlen
(
it
->
ai_canonname
);
if
(
hostname_size
<=
len
)
{
hostname_size
=
len
+
1
;
hostname
=
hostname_alloc
=
xrealloc
(
hostname_alloc
,
hostname_size
);
}
strcpy
(
hostname
,
it
->
ai_canonname
);
}
freeaddrinfo
(
res
);
}
#else
/* !HAVE_GETADDRINFO */
struct
hostent
*
hp
;
for
(
count
=
0
;;
count
++
)
{
#ifdef TRY_AGAIN
h_errno
=
0
;
#endif
hp
=
gethostbyname
(
hostname
);
#ifdef TRY_AGAIN
if
(
!
(
hp
==
0
&&
h_errno
==
TRY_AGAIN
))
#endif
break
;
if
(
count
>=
5
)
break
;
Fsleep_for
(
make_number
(
1
),
Qnil
);
}
if
(
hp
)
{
char
*
fqdn
=
(
char
*
)
hp
->
h_name
;
if
(
!
strchr
(
fqdn
,
'.'
))
{
/* We still don't have a fully qualified domain name.
Try to find one in the list of alternate names */
char
**
alias
=
hp
->
h_aliases
;
while
(
*
alias
&&
(
!
strchr
(
*
alias
,
'.'
)
||
!
strcmp
(
*
alias
,
"localhost.localdomain"
)))
alias
++
;
if
(
*
alias
)
fqdn
=
*
alias
;
}
hostname
=
fqdn
;
}
#endif
/* !HAVE_GETADDRINFO */
}
#endif
/* HAVE_SOCKETS */
#endif
/* HAVE_GETHOSTNAME */
char
*
p
;
for
(
p
=
hostname
;
*
p
;
p
++
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment