From: Max Krummenacher <max.oss.09@gmail.com>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
linux-kbuild@vger.kernel.org,
"Max Krummenacher" <max.krummenacher@toradex.com>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Daniel Gomez" <da.gomez@samsung.com>,
"Jiri Slaby" <jirislaby@kernel.org>,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Subject: Re: [PATCH] tty: vt: conmakehash: remove non-portable code printing comment header
Date: Mon, 12 Aug 2024 16:58:21 +0200 [thread overview]
Message-ID: <ZrojDUbr1EvlARXK@toolbox> (raw)
In-Reply-To: <20240809160853.1269466-1-masahiroy@kernel.org>
On Sat, Aug 10, 2024 at 01:07:20AM +0900, Masahiro Yamada wrote:
> Commit 6e20753da6bc ("tty: vt: conmakehash: cope with abs_srctree no
> longer in env") included <linux/limits.h>, which invoked another
> (wrong) patch that tried to address a build error on macOS.
>
> According to the specification [1], the correct header to use PATH_MAX
> is <limits.h>.
>
> The minimal fix would be to replace <linux/limits.h> with <limits.h>.
I can change that in a v2.
>
> However, the following commits seem questionable to me:
>
> - 3bd85c6c97b2 ("tty: vt: conmakehash: Don't mention the full path of the input in output")
> - 6e20753da6bc ("tty: vt: conmakehash: cope with abs_srctree no longer in env")
>
> These commits made too many efforts to cope with a comment header in
> drivers/tty/vt/consolemap_deftbl.c:
>
> /*
> * Do not edit this file; it was automatically generated by
> *
> * conmakehash drivers/tty/vt/cp437.uni > [this file]
> *
> */
This is the output you get when keeping the build artifacts within the
linux source tree.
However if you keep the artifacts outside the source tree
(make O=/somepath ...) the output looks like this:
/*
* Do not edit this file; it was automatically generated by
*
* conmakehash /path-to-kernel-source-tree/drivers/tty/vt/cp437.uni > [this file]
*
*/
i.e. it does keep a reference to where in your filesystem the kernel
source did reside when building which is against the goal of having a
reproducable build.
>
> With this commit, the header part of the generate C file will be
> simplified as follows:
>
> /*
> * Automatically generated file; Do not edit.
> */
This is not what I observed, for me with this proposed commit the
comment becomes with or without the 'O=somepath':
/*
* Do not edit this file; it was automatically generated by
*
* conmakehash cp437.uni > [this file]
*
*/
i.e. it strips the directory path of the chartable source file used.
Regards
Max
>
> BTW, another series of excessive efforts for a comment header can be
> seen in the following:
>
> - 5ef6dc08cfde ("lib/build_OID_registry: don't mention the full path of the script in output")
> - 2fe29fe94563 ("lib/build_OID_registry: avoid non-destructive substitution for Perl < 5.13.2 compat")
>
> [1]: https://pubs.opengroup.org/onlinepubs/009695399/basedefs/limits.h.html
>
> Fixes: 6e20753da6bc ("tty: vt: conmakehash: cope with abs_srctree no longer in env")
> Reported-by: Daniel Gomez <da.gomez@samsung.com>
> Closes: https://lore.kernel.org/all/20240807-macos-build-support-v1-11-4cd1ded85694@samsung.com/
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
>
> drivers/tty/vt/conmakehash.c | 12 ++----------
> 1 file changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/tty/vt/conmakehash.c b/drivers/tty/vt/conmakehash.c
> index 82d9db68b2ce..a931fcde7ad9 100644
> --- a/drivers/tty/vt/conmakehash.c
> +++ b/drivers/tty/vt/conmakehash.c
> @@ -11,8 +11,6 @@
> * Copyright (C) 1995-1997 H. Peter Anvin
> */
>
> -#include <libgen.h>
> -#include <linux/limits.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <sysexits.h>
> @@ -79,7 +77,6 @@ int main(int argc, char *argv[])
> {
> FILE *ctbl;
> const char *tblname;
> - char base_tblname[PATH_MAX];
> char buffer[65536];
> int fontlen;
> int i, nuni, nent;
> @@ -245,20 +242,15 @@ int main(int argc, char *argv[])
> for ( i = 0 ; i < fontlen ; i++ )
> nuni += unicount[i];
>
> - strncpy(base_tblname, tblname, PATH_MAX);
> - base_tblname[PATH_MAX - 1] = 0;
> printf("\
> /*\n\
> - * Do not edit this file; it was automatically generated by\n\
> - *\n\
> - * conmakehash %s > [this file]\n\
> - *\n\
> + * Automatically generated file; Do not edit.\n\
> */\n\
> \n\
> #include <linux/types.h>\n\
> \n\
> u8 dfont_unicount[%d] = \n\
> -{\n\t", basename(base_tblname), fontlen);
> +{\n\t", fontlen);
>
> for ( i = 0 ; i < fontlen ; i++ )
> {
> --
> 2.43.0
>
next prev parent reply other threads:[~2024-08-12 14:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-09 16:07 [PATCH] tty: vt: conmakehash: remove non-portable code printing comment header Masahiro Yamada
2024-08-12 14:58 ` Max Krummenacher [this message]
2024-08-12 15:44 ` Masahiro Yamada
2024-08-12 15:58 ` Max Krummenacher
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=ZrojDUbr1EvlARXK@toolbox \
--to=max.oss.09@gmail.com \
--cc=da.gomez@samsung.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=max.krummenacher@toradex.com \
--cc=u.kleine-koenig@pengutronix.de \
/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).