From: <rsbecker@nexbridge.com>
To: "'Ignacio Encinas Rubio'" <ignacio@iencinas.com>
Cc: <git@vger.kernel.org>, "'Junio C Hamano'" <gitster@pobox.com>,
"'Jeff King'" <peff@peff.net>
Subject: RE: [PATCH v2 1/1] config: learn the "hostname:" includeIf condition
Date: Sat, 16 Mar 2024 14:49:25 -0400 [thread overview]
Message-ID: <006d01da77d2$ae4361e0$0aca25a0$@nexbridge.com> (raw)
In-Reply-To: <ea07fbc2-8937-486b-87c2-e2abe9856d26@iencinas.com>
On Saturday, March 16, 2024 2:06 PM, Ignacio Encinas Rubio wrote:
>On 16/3/24 18:41, rsbecker@nexbridge.com wrote:
>> On Saturday, March 16, 2024 1:03 PM, Junio C Hamano wrote:
>>> Jeff King <peff@peff.net> writes:
>>>
>>>> Do we need to define "hostname" in more detail here? Specifically,
>>>> I'm wondering whether the result will be a FQDN or not (i.e., the
>>>> output of "hostname" vs "hostname -f"). Looking at the code I think
>>>> it will just be the short name returned. That's probably OK, but it
>>>> may be worth documenting.
>>>
>>> That was my first reaction but there are places where "hostname"
>>> already gives a name that is not "short" at all, without being
>>> invoked with
>> "-f".
>>>
>>> For example, the (virtual) workstation I am typing this message on
>>> sits in
>> a $WORK datacenter, where "hostname" gives the same
>>> string as "hostname -f", which looks like "git.c.xxxxxx.tld" ("git"
>>> is the
>> only part I picked myself for it, "c" is shared by those employee
>>> workstations hosted at datacenters, "xxxxxx.tld" is redacted to
>>> conceal the
>> real domain name to protect the culprits ;-).
>>>
>>> I think the most honest answer we can give in the documentation is
>>> that we
>> use what gethostname() [*] gives.
>>
>> I think this is probably a good idea and but value should not be
>> cached. My dev box has a multi-home, multi-cpu IP stack. It makes
>> things really weird sometimes. For example, hostname replies with:
>>
>> ztc0.xxxxxxxx.local
>>
>> and includes the current default IP stack, which is known to DNS,
>> while uname -n, which I prefer to use when deciding what system I am
>> on during tests, reports:
>>
>> xxxxxxxx
>>
>> I am not sure how meaningful hostname is; however, "hostname -f" is
>> not portable. However, includeif depending on whatever gethostname()
>> returns is reasonable, in my opinion, also. I think the series should
>> include a $(uname
>> -n) option in some form for completeness.
>
>Correct me if I'm wrong, but gethostname() seems to be equivalent to $(uname -n)
Glibc definitely uses uname, according to its man page, but that is the exception, not the rule. Evidence from my experimentation on various platforms says that the two values may sometimes be the same but the host configuration may be different, particularly if two stacks are on the same machine with different IP addresses. uname does not go to DNS. gethostname() generally (Windows, S/390, NonStop, Linux where glibc is not used), uses DNS as its first attempt to resolve the name.
next prev parent reply other threads:[~2024-03-16 18:49 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-07 20:50 [RFC PATCH 0/1] Add hostname condition to includeIf Ignacio Encinas
2024-03-07 20:50 ` [RFC PATCH 1/1] config: learn the "hostname:" includeIf condition Ignacio Encinas
2024-03-07 21:40 ` Junio C Hamano
2024-03-09 10:47 ` Ignacio Encinas Rubio
2024-03-09 17:38 ` Junio C Hamano
2024-03-09 18:18 ` [PATCH v2 0/1] Add hostname condition to includeIf Ignacio Encinas
2024-03-09 18:18 ` [PATCH v2 1/1] config: learn the "hostname:" includeIf condition Ignacio Encinas
2024-03-10 16:59 ` Junio C Hamano
2024-03-10 18:46 ` Ignacio Encinas Rubio
2024-03-11 17:39 ` Junio C Hamano
2024-03-13 21:53 ` Ignacio Encinas Rubio
2024-03-16 6:57 ` Jeff King
2024-03-16 11:19 ` Ignacio Encinas Rubio
2024-03-16 16:00 ` Taylor Blau
2024-03-16 16:46 ` Ignacio Encinas Rubio
2024-03-16 17:02 ` Junio C Hamano
2024-03-16 17:41 ` rsbecker
2024-03-16 18:05 ` Ignacio Encinas Rubio
2024-03-16 18:49 ` rsbecker [this message]
2024-03-18 8:17 ` Jeff King
2024-03-16 16:01 ` Taylor Blau
2024-03-16 16:50 ` Ignacio Encinas Rubio
2024-03-19 18:37 ` [PATCH v3 0/2] Add hostname condition to includeIf Ignacio Encinas
2024-03-19 18:37 ` [PATCH v3 1/2] t: add a test helper for getting hostname Ignacio Encinas
2024-03-19 20:31 ` Junio C Hamano
2024-03-19 20:57 ` Jeff King
2024-03-19 21:00 ` Junio C Hamano
2024-03-19 21:11 ` Jeff King
2024-03-19 21:44 ` Junio C Hamano
2024-03-21 0:11 ` Chris Torek
2024-03-19 20:56 ` Jeff King
2024-03-19 18:37 ` [PATCH v3 2/2] config: learn the "hostname:" includeIf condition Ignacio Encinas
2024-03-19 20:53 ` Junio C Hamano
2024-03-19 21:04 ` Jeff King
2024-03-19 21:32 ` Ignacio Encinas Rubio
2024-03-19 20:55 ` [PATCH v3 0/2] Add hostname condition to includeIf Eric Sunshine
2024-03-19 21:12 ` Junio C Hamano
2024-03-19 21:13 ` Eric Sunshine
2024-03-20 0:19 ` Jeff King
2024-03-20 2:49 ` Eric Sunshine
2024-03-20 3:07 ` Eric Sunshine
2024-03-20 14:34 ` Chris Torek
2024-03-20 16:37 ` Eric Sunshine
2024-03-20 20:51 ` Jeff King
2024-03-20 16:49 ` Junio C Hamano
2024-03-19 21:36 ` Dirk Gouders
2024-03-19 22:03 ` rsbecker
2024-03-19 22:26 ` Dirk Gouders
2024-03-19 22:31 ` rsbecker
2024-03-19 22:59 ` Junio C Hamano
2024-03-19 21:22 ` Ignacio Encinas Rubio
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='006d01da77d2$ae4361e0$0aca25a0$@nexbridge.com' \
--to=rsbecker@nexbridge.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=ignacio@iencinas.com \
--cc=peff@peff.net \
/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.
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 NNTP newsgroup(s).