* cvs emacs and (system-name)
@ 2007-04-17 18:31 Tom Tromey
2007-04-17 19:05 ` Andreas Schwab
0 siblings, 1 reply; 22+ messages in thread
From: Tom Tromey @ 2007-04-17 18:31 UTC (permalink / raw)
To: emacs-devel
I updated Emacs from CVS and built it on my x86 FC6 box.
I ran "emacs -nw -q".
Then in *scratch* I tried (system-name) and got:
(system-name)
"localhost.localdomain"
However, 'hostname' on this machine reports 'opsy'.
So, I suspect this is a bug in Emacs.
FWIW I see this same behavior, on both my machines, with the
Fedora-supplied Emacs 21 builds.
Tom
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: cvs emacs and (system-name)
2007-04-17 18:31 cvs emacs and (system-name) Tom Tromey
@ 2007-04-17 19:05 ` Andreas Schwab
2007-04-17 18:50 ` Tom Tromey
0 siblings, 1 reply; 22+ messages in thread
From: Andreas Schwab @ 2007-04-17 19:05 UTC (permalink / raw)
To: tromey; +Cc: emacs-devel
Tom Tromey <tromey@redhat.com> writes:
> Then in *scratch* I tried (system-name) and got:
>
> (system-name)
> "localhost.localdomain"
>
> However, 'hostname' on this machine reports 'opsy'.
What does hostname -f give you?
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: cvs emacs and (system-name)
2007-04-17 19:05 ` Andreas Schwab
@ 2007-04-17 18:50 ` Tom Tromey
2007-04-17 19:45 ` Chong Yidong
0 siblings, 1 reply; 22+ messages in thread
From: Tom Tromey @ 2007-04-17 18:50 UTC (permalink / raw)
To: Andreas Schwab; +Cc: emacs-devel
>>>>> "Andreas" == Andreas Schwab <schwab@suse.de> writes:
>> However, 'hostname' on this machine reports 'opsy'.
Andreas> What does hostname -f give you?
opsy. hostname -f
opsy
Tom
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: cvs emacs and (system-name)
2007-04-17 18:50 ` Tom Tromey
@ 2007-04-17 19:45 ` Chong Yidong
2007-04-17 19:30 ` Tom Tromey
0 siblings, 1 reply; 22+ messages in thread
From: Chong Yidong @ 2007-04-17 19:45 UTC (permalink / raw)
To: tromey; +Cc: Andreas Schwab, emacs-devel
Tom Tromey <tromey@redhat.com> writes:
>>>>>> "Andreas" == Andreas Schwab <schwab@suse.de> writes:
>
>>> However, 'hostname' on this machine reports 'opsy'.
>
> Andreas> What does hostname -f give you?
>
> opsy. hostname -f
> opsy
Could you try to compile the following program and report its output?
#include <stdio.h>
#include <alloca.h>
#include <string.h>
#include <sys/socket.h>
#include <netdb.h>
int main ()
{
int hostname_size = 256;
char *hostname = (char *) alloca (hostname_size);
while (1)
{
gethostname (hostname, hostname_size - 1);
hostname[hostname_size - 1] = '\0';
if (strlen (hostname) < hostname_size - 1)
break;
hostname_size <<= 1;
hostname = (char *) alloca (hostname_size);
}
if (! index (hostname, '.'))
{
struct hostent *hp;
hp = gethostbyname (hostname);
if (hp)
{
char *fqdn = (char *) hp->h_name;
if (!index (fqdn, '.'))
{
char **alias = hp->h_aliases;
while (*alias && !index (*alias, '.'))
alias++;
if (*alias)
fqdn = *alias;
}
hostname = fqdn;
}
}
printf ("%s\n", hostname);
}
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: cvs emacs and (system-name)
2007-04-17 19:45 ` Chong Yidong
@ 2007-04-17 19:30 ` Tom Tromey
2007-04-18 14:55 ` Richard Stallman
0 siblings, 1 reply; 22+ messages in thread
From: Tom Tromey @ 2007-04-17 19:30 UTC (permalink / raw)
To: Chong Yidong; +Cc: Andreas Schwab, emacs-devel
>>>>> "Chong" == Chong Yidong <cyd@stupidchicken.com> writes:
Chong> Could you try to compile the following program and report its output?
Sigh. It does report localhost.localdomain.
So, I suppose the bug is my /etc/hosts entry, which I only now
noticed:
127.0.0.1 opsy localhost.localdomain localhost
Thanks, and sorry for the noise.
Tom
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: cvs emacs and (system-name)
2007-04-17 19:30 ` Tom Tromey
@ 2007-04-18 14:55 ` Richard Stallman
2007-04-18 17:17 ` Glenn Morris
0 siblings, 1 reply; 22+ messages in thread
From: Richard Stallman @ 2007-04-18 14:55 UTC (permalink / raw)
To: tromey; +Cc: schwab, cyd, emacs-devel
Sigh. It does report localhost.localdomain.
So, I suppose the bug is my /etc/hosts entry, which I only now
noticed:
127.0.0.1 opsy localhost.localdomain localhost
Would someone please put something in etc/PROBLEMS
about this?
Also, maybe init_editfns could detect this and warn the user.
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: cvs emacs and (system-name)
2007-04-18 14:55 ` Richard Stallman
@ 2007-04-18 17:17 ` Glenn Morris
2007-04-18 21:40 ` Tom Tromey
2007-04-19 13:42 ` Richard Stallman
0 siblings, 2 replies; 22+ messages in thread
From: Glenn Morris @ 2007-04-18 17:17 UTC (permalink / raw)
To: rms; +Cc: tromey, schwab, cyd, emacs-devel
Richard Stallman wrote:
> Would someone please put something in etc/PROBLEMS about this?
Doesn't the existing entry cover this:
*** Emacs does not know your host's fully-qualified domain name.
You need to configure your machine with a fully qualified domain
name, either in /etc/hosts, /etc/hostname, the NIS, or wherever
your system calls for specifying this.
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: cvs emacs and (system-name)
2007-04-18 17:17 ` Glenn Morris
@ 2007-04-18 21:40 ` Tom Tromey
2007-04-19 5:00 ` Glenn Morris
2007-04-19 13:42 ` Richard Stallman
1 sibling, 1 reply; 22+ messages in thread
From: Tom Tromey @ 2007-04-18 21:40 UTC (permalink / raw)
To: Glenn Morris; +Cc: schwab, cyd, rms, emacs-devel
>>>>> "GM" == Glenn Morris <rgm@gnu.org> writes:
GM> Doesn't the existing entry cover this:
GM> *** Emacs does not know your host's fully-qualified domain name.
GM> You need to configure your machine with a fully qualified domain
GM> name, either in /etc/hosts, /etc/hostname, the NIS, or wherever
GM> your system calls for specifying this.
FWIW it isn't entirely clear to me that my config is buggy.
Unfortunately I don't recall how I got it this way -- I suspect I did
a standard Fedora install but did not specify a domain name (IOW, this
may not affect just me). I don't really have a domain I would put my
machine in, and I think a reasonable number of people may fall into
this category. Emacs picking "localhost.localdomain" over the actual
name of my machine still seems a bit odd.
Tom
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: cvs emacs and (system-name)
2007-04-18 21:40 ` Tom Tromey
@ 2007-04-19 5:00 ` Glenn Morris
2007-04-19 16:14 ` Stefan Monnier
` (2 more replies)
0 siblings, 3 replies; 22+ messages in thread
From: Glenn Morris @ 2007-04-19 5:00 UTC (permalink / raw)
To: tromey; +Cc: schwab, cyd, rms, emacs-devel
Tom Tromey wrote:
> I don't really have a domain I would put my machine in, and I think
> a reasonable number of people may fall into this category. Emacs
> picking "localhost.localdomain" over the actual name of my machine
> still seems a bit odd.
At the moment, we prefer any name with a "." in. We could skip
"localhost.localdomain":
*** sysdep.c 21 Jan 2007 04:18:15 -0000 1.278
--- sysdep.c 19 Apr 2007 05:00:41 -0000
***************
*** 2433,2439 ****
/* 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 && !index (*alias, '.'))
alias++;
if (*alias)
fqdn = *alias;
--- 2433,2440 ----
/* 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 && ( !index (*alias, '.') ||
! !strcmp (*alias, "localhost.localdomain" ) ) )
alias++;
if (*alias)
fqdn = *alias;
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: cvs emacs and (system-name)
2007-04-19 5:00 ` Glenn Morris
@ 2007-04-19 16:14 ` Stefan Monnier
2007-04-19 18:25 ` Tom Tromey
2007-04-19 21:23 ` Stefan Monnier
2007-04-19 23:17 ` Richard Stallman
2 siblings, 1 reply; 22+ messages in thread
From: Stefan Monnier @ 2007-04-19 16:14 UTC (permalink / raw)
To: Glenn Morris; +Cc: tromey, schwab, cyd, rms, emacs-devel
>> I don't really have a domain I would put my machine in, and I think
>> a reasonable number of people may fall into this category. Emacs
>> picking "localhost.localdomain" over the actual name of my machine
>> still seems a bit odd.
But it's kind of difficult for Emacs to guess which of the three names you
put there is "my machine name". Maybe "localhost" could be ruled out
because it's sufficiently standard. But "localhost.localdomain" is not
particularly standard, AFAIK.
Maybe the answer is that Emacs should just disregard the "127.*.*.*"
IP range.
> ! while (*alias && ( !index (*alias, '.') ||
> ! !strcmp (*alias, "localhost.localdomain" ) ) )
Yuck!!
Stefan
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: cvs emacs and (system-name)
2007-04-19 16:14 ` Stefan Monnier
@ 2007-04-19 18:25 ` Tom Tromey
2007-04-19 18:48 ` Chong Yidong
2007-04-19 21:25 ` Stefan Monnier
0 siblings, 2 replies; 22+ messages in thread
From: Tom Tromey @ 2007-04-19 18:25 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Glenn Morris, cyd, emacs-devel, rms, schwab
>>>>> "Stefan" == Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>> I don't really have a domain I would put my machine in, and I think
>>> a reasonable number of people may fall into this category. Emacs
>>> picking "localhost.localdomain" over the actual name of my machine
>>> still seems a bit odd.
Stefan> But it's kind of difficult for Emacs to guess which of the
Stefan> three names you put there is "my machine name".
My recollection is that traditionally the first host name is
considered the canonical one. 'man 5 hosts' backs me up on this :)
Stefan> Maybe "localhost" could be ruled out
Stefan> because it's sufficiently standard. But "localhost.localdomain" is not
Stefan> particularly standard, AFAIK.
I don't recall seeing 'localhost.localdomain' back in the day -- but I
know *I* didn't put it there. If Fedora does it then that is standard
enough for me; we're talking about thousands or millions of hosts
here.
Stefan> Maybe the answer is that Emacs should just disregard the
Stefan> "127.*.*.*" IP range.
I don't have any other entry in /etc/hosts. My machine has no fixed
address and is not in a domain. This, I believe, is extremely common
among laptop users.
Perhaps if only "localhost" and "localhost.localdomain" are found,
Emacs could fall back to gethostname(2) or uname(2). With glibc the
latter appears to try to return the domain name as well.
Tom
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: cvs emacs and (system-name)
2007-04-19 18:25 ` Tom Tromey
@ 2007-04-19 18:48 ` Chong Yidong
2007-04-19 21:25 ` Stefan Monnier
1 sibling, 0 replies; 22+ messages in thread
From: Chong Yidong @ 2007-04-19 18:48 UTC (permalink / raw)
To: tromey; +Cc: Glenn Morris, emacs-devel, Stefan Monnier, rms, schwab
Tom Tromey <tromey@redhat.com> writes:
> Stefan> Maybe "localhost" could be ruled out because it's
> Stefan> sufficiently standard. But "localhost.localdomain" is not
> Stefan> particularly standard, AFAIK.
>
> I don't recall seeing 'localhost.localdomain' back in the day -- but
> I know *I* didn't put it there. If Fedora does it then that is
> standard enough for me; we're talking about thousands or millions of
> hosts here.
FWIW, my Debian or Ubuntu boxes don't seem to have this problem.
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: cvs emacs and (system-name)
2007-04-19 18:25 ` Tom Tromey
2007-04-19 18:48 ` Chong Yidong
@ 2007-04-19 21:25 ` Stefan Monnier
1 sibling, 0 replies; 22+ messages in thread
From: Stefan Monnier @ 2007-04-19 21:25 UTC (permalink / raw)
To: tromey; +Cc: Glenn Morris, cyd, emacs-devel, rms, schwab
>>>> I don't really have a domain I would put my machine in, and I think
>>>> a reasonable number of people may fall into this category. Emacs
>>>> picking "localhost.localdomain" over the actual name of my machine
>>>> still seems a bit odd.
Stefan> But it's kind of difficult for Emacs to guess which of the
Stefan> three names you put there is "my machine name".
> My recollection is that traditionally the first host name is
> considered the canonical one. 'man 5 hosts' backs me up on this :)
I believe the problem is that it is common to see entries in arbitrary order
in there. Especially the fully-qualified entry is not necessarily first
(although it should).
> I don't have any other entry in /etc/hosts. My machine has no fixed
> address and is not in a domain. This, I believe, is extremely common
> among laptop users.
And in that case it's indeed rather unimportant which name Emacs chooses.
> Perhaps if only "localhost" and "localhost.localdomain" are found,
> Emacs could fall back to gethostname(2) or uname(2). With glibc the
> latter appears to try to return the domain name as well.
What I was suggesting (tho implicitly) is to do that whenever the IP address
is 127.*.*.*.
Stefan
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: cvs emacs and (system-name)
2007-04-19 5:00 ` Glenn Morris
2007-04-19 16:14 ` Stefan Monnier
@ 2007-04-19 21:23 ` Stefan Monnier
2007-04-19 21:30 ` Chong Yidong
2007-04-20 14:52 ` Richard Stallman
2007-04-19 23:17 ` Richard Stallman
2 siblings, 2 replies; 22+ messages in thread
From: Stefan Monnier @ 2007-04-19 21:23 UTC (permalink / raw)
To: Glenn Morris; +Cc: tromey, schwab, cyd, rms, emacs-devel
> ! while (*alias && ( !index (*alias, '.') ||
> ! !strcmp (*alias, "localhost.localdomain" ) ) )
How 'bout the patch below instead.
Stefan
PS: Now that I think about it, maybe a better approach is to look for
an alias that not only has a "." but additionally has the hostname
as prefix. This is what my second patch does. Both patches are
guaranteed 100% untested.
--- orig/src/sysdep.c
+++ mod/src/sysdep.c
@@ -2428,7 +2428,13 @@
char *p;
#endif
- if (!index (fqdn, '.'))
+ if (!index (fqdn, '.')
+ /* If the IP address is 127.*.*.*, don't bother looking for
+ a fqdn in the aliases since the name itself won't matter
+ much and we may end up with localhost.localdomain
+ or some other meaningless "fqdn". */
+ && !(hp->h_addrtype == AF_INET
+ && hp->h_addr[0] == 127))
{
/* We still don't have a fully qualified domain name.
Try to find one in the list of alternate names */
--- orig/src/sysdep.c
+++ mod/src/sysdep.c
@@ -2428,8 +2428,16 @@
/* 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 && !index (*alias, '.'))
- alias++;
+ while (*alias)
+ {
+ char *i = index (*alias, '.');
+ /* hp->h_name is supposed to be the "official name" so we
+ should not take any random fully qualified alias. */
+ if (i && strlen (fqdn) == i - *alias
+ && !strncmp (fqdn, *alias, i - *alias))
+ break;
+ alias++;
+ }
if (*alias)
fqdn = *alias;
}
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: cvs emacs and (system-name)
2007-04-19 21:23 ` Stefan Monnier
@ 2007-04-19 21:30 ` Chong Yidong
2007-04-19 21:31 ` Glenn Morris
2007-04-20 14:52 ` Richard Stallman
1 sibling, 1 reply; 22+ messages in thread
From: Chong Yidong @ 2007-04-19 21:30 UTC (permalink / raw)
To: Stefan Monnier; +Cc: tromey, Glenn Morris, emacs-devel, rms, schwab
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> ! while (*alias && ( !index (*alias, '.') ||
>> ! !strcmp (*alias, "localhost.localdomain" ) ) )
>
> How 'bout the patch below instead.
>
> PS: Now that I think about it, maybe a better approach is to look for
> an alias that not only has a "." but additionally has the hostname
> as prefix. This is what my second patch does. Both patches are
> guaranteed 100% untested.
Is there any reason to think that we need to solve this for Emacs
22.1?
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: cvs emacs and (system-name)
2007-04-19 21:23 ` Stefan Monnier
2007-04-19 21:30 ` Chong Yidong
@ 2007-04-20 14:52 ` Richard Stallman
2007-04-20 21:39 ` Chong Yidong
1 sibling, 1 reply; 22+ messages in thread
From: Richard Stallman @ 2007-04-20 14:52 UTC (permalink / raw)
To: Stefan Monnier; +Cc: tromey, rgm, cyd, emacs-devel, schwab
PS: Now that I think about it, maybe a better approach is to look for
an alias that not only has a "." but additionally has the hostname
as prefix. This is what my second patch does. Both patches are
guaranteed 100% untested.
This patch does seem likely to be really right, but it has the potential
to cause problems in peculiar cases. For now, please install your limited
patch that rejects just localhost.localdomain.
After the release, please install the newer "more correct" patch.
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: cvs emacs and (system-name)
2007-04-20 14:52 ` Richard Stallman
@ 2007-04-20 21:39 ` Chong Yidong
0 siblings, 0 replies; 22+ messages in thread
From: Chong Yidong @ 2007-04-20 21:39 UTC (permalink / raw)
To: rms; +Cc: tromey, rgm, emacs-devel, Stefan Monnier, schwab
Richard Stallman <rms@gnu.org> writes:
> PS: Now that I think about it, maybe a better approach is to look for
> an alias that not only has a "." but additionally has the hostname
> as prefix. This is what my second patch does. Both patches are
> guaranteed 100% untested.
>
> This patch does seem likely to be really right, but it has the potential
> to cause problems in peculiar cases. For now, please install your limited
> patch that rejects just localhost.localdomain.
>
> After the release, please install the newer "more correct" patch.
OK, checked in.
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: cvs emacs and (system-name)
2007-04-19 5:00 ` Glenn Morris
2007-04-19 16:14 ` Stefan Monnier
2007-04-19 21:23 ` Stefan Monnier
@ 2007-04-19 23:17 ` Richard Stallman
2007-04-20 1:27 ` Glenn Morris
2 siblings, 1 reply; 22+ messages in thread
From: Richard Stallman @ 2007-04-19 23:17 UTC (permalink / raw)
To: Glenn Morris; +Cc: tromey, schwab, cyd, emacs-devel
At the moment, we prefer any name with a "." in. We could skip
"localhost.localdomain":
That is a good idea. Please do it.
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: cvs emacs and (system-name)
2007-04-18 17:17 ` Glenn Morris
2007-04-18 21:40 ` Tom Tromey
@ 2007-04-19 13:42 ` Richard Stallman
2007-04-19 17:05 ` Glenn Morris
1 sibling, 1 reply; 22+ messages in thread
From: Richard Stallman @ 2007-04-19 13:42 UTC (permalink / raw)
To: Glenn Morris; +Cc: tromey, schwab, cyd, emacs-devel
> Would someone please put something in etc/PROBLEMS about this?
Doesn't the existing entry cover this:
*** Emacs does not know your host's fully-qualified domain name.
You need to configure your machine with a fully qualified domain
name, either in /etc/hosts, /etc/hostname, the NIS, or wherever
your system calls for specifying this.
It seems to be about this situation, but it may be hard to recognize
that this relates. It would be easier to recognize that if it stated
more concretely what the problem is -- that (system-name) returns
something like "localhost".
^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2007-04-20 21:39 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-17 18:31 cvs emacs and (system-name) Tom Tromey
2007-04-17 19:05 ` Andreas Schwab
2007-04-17 18:50 ` Tom Tromey
2007-04-17 19:45 ` Chong Yidong
2007-04-17 19:30 ` Tom Tromey
2007-04-18 14:55 ` Richard Stallman
2007-04-18 17:17 ` Glenn Morris
2007-04-18 21:40 ` Tom Tromey
2007-04-19 5:00 ` Glenn Morris
2007-04-19 16:14 ` Stefan Monnier
2007-04-19 18:25 ` Tom Tromey
2007-04-19 18:48 ` Chong Yidong
2007-04-19 21:25 ` Stefan Monnier
2007-04-19 21:23 ` Stefan Monnier
2007-04-19 21:30 ` Chong Yidong
2007-04-19 21:31 ` Glenn Morris
2007-04-20 14:52 ` Richard Stallman
2007-04-20 21:39 ` Chong Yidong
2007-04-19 23:17 ` Richard Stallman
2007-04-20 1:27 ` Glenn Morris
2007-04-19 13:42 ` Richard Stallman
2007-04-19 17:05 ` Glenn Morris
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).