mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: FraSharp <f.duca00@gmail.com>
Cc: FraSharp <s23265@iisve.it>,
	Masahiro Yamada <masahiroy@kernel.org>,
	Michal Marek <michal.lkml@markovi.net>,
	Nick Desaulniers <ndesaulniers@google.com>,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] kbuild: use hostname -s along uname to obtain LINUX_COMPILE_HOST
Date: Fri, 1 Apr 2022 10:21:05 -0700	[thread overview]
Message-ID: <Ykc0ge8SPt/x8IHc@thelio-3990X> (raw)
In-Reply-To: <20220401151706.30697-1-s23265@iisve.it>

Hi Francesco,

On Fri, Apr 01, 2022 at 05:17:06PM +0200, FraSharp wrote:
> * On some systems (e.g. macOS, Debian, Fedora), using commands like 'uname -n' or
>   'hostname' will print something similar to "hostname.domain"
>   ("Francescos-Air.fritz.box" for example), which is very annoying.
>   What works instead is 'hostname -s', which will only write hostname
>   without the domain ("Francescos-Air" for example),
>   but also keep 'uname -n', as some systems as Arch Linux does not have
>   'hostname' as command.
> 
> * This commit is complementary to
>   1e66d50ad3a1dbf0169b14d502be59a4b1213149
>   ("kbuild: Use uname for LINUX_COMPILE_HOST detection")
> 
> Signed-off-by: Francesco Duca <s23265@iisve.it>
> ---
>  scripts/mkcompile_h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h
> index ca40a5258..3eefbafe5 100755
> --- a/scripts/mkcompile_h
> +++ b/scripts/mkcompile_h
> @@ -34,7 +34,7 @@ else
>  	LINUX_COMPILE_BY=$KBUILD_BUILD_USER
>  fi
>  if test -z "$KBUILD_BUILD_HOST"; then
> -	LINUX_COMPILE_HOST=`uname -n`
> +	LINUX_COMPILE_HOST=$(hostname -s 2>/dev/null || uname -n)
>  else
>  	LINUX_COMPILE_HOST=$KBUILD_BUILD_HOST
>  fi
> -- 
> 2.32.0 (Apple Git-132)
> 

I personally think this is going to output something objectively worse
for my use case. I use containers for my main workflow, which have a
hostname of "container name" and domain name of "host's hostname".

For example:

$ uname -n
thelio-3990X

$ distrobox enter dev-arch

$ uname -n
dev-arch.thelio-3990X

With the move to 'hostname -s' by default, I lose the information about
the main host machine, so I am unable to tell exactly which container
built the image:

$ hostname -s
dev-arch

While moving to containers is supposed to help eliminate the need to
know about a particular machine because it should be the same
environment, it is still relevant because I build certain tools on some
machines and not others and I am not necessarily updating each container
on the same timeline, so it is still useful to have this information
included in the kernel image for tracking purposes.

Given this is a purely a subjective/cosmetic issue, why can you not just
add something like

export KBUILD_BUILD_HOST=$(hostname -s)

in your shell's start up file, so that the hostname is in the format
that you desire?

Cheers,
Nathan

      reply	other threads:[~2022-04-01 17:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-30 18:23 [PATCH] " FraSharp
2022-04-01 14:04 ` Masahiro Yamada
2022-04-01 14:19   ` Masahiro Yamada
2022-04-01 15:06     ` Francesco Duca
2022-04-01 15:22       ` Masahiro Yamada
2022-04-01 15:39         ` Francesco Duca
2022-04-01 15:17 ` [PATCH v2] " FraSharp
2022-04-01 17:21   ` Nathan Chancellor [this message]

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=Ykc0ge8SPt/x8IHc@thelio-3990X \
    --to=nathan@kernel.org \
    --cc=f.duca00@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=ndesaulniers@google.com \
    --cc=s23265@iisve.it \
    /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

all inboxes | Powered by JetHome®