* [PATCH] tty: vt: conmakehash: cope with abs_srctree no longer in env
@ 2024-07-25 13:20 max.oss.09
2024-07-25 13:28 ` kernel test robot
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: max.oss.09 @ 2024-07-25 13:20 UTC (permalink / raw)
To: Max Krummenacher
Cc: stable, Greg Kroah-Hartman, Jiri Slaby, Uwe Kleine-König,
linux-kernel, linux-serial
From: Max Krummenacher <max.krummenacher@toradex.com>
conmakehash uses getenv("abs_srctree") from the environment to strip
the absolute path from the generated sources.
However since commit e2bad142bb3d ("kbuild: unexport abs_srctree and
abs_objtree") this environment variable no longer gets set.
Instead use basename() to indicate the used file in a comment of the
generated source file.
Fixes: 3bd85c6c97b2 ("tty: vt: conmakehash: Don't mention the full path of the input in output")
Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
---
drivers/tty/vt/conmakehash.c | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
diff --git a/drivers/tty/vt/conmakehash.c b/drivers/tty/vt/conmakehash.c
index dc2177fec715..82d9db68b2ce 100644
--- a/drivers/tty/vt/conmakehash.c
+++ b/drivers/tty/vt/conmakehash.c
@@ -11,6 +11,8 @@
* Copyright (C) 1995-1997 H. Peter Anvin
*/
+#include <libgen.h>
+#include <linux/limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <sysexits.h>
@@ -76,8 +78,8 @@ static void addpair(int fp, int un)
int main(int argc, char *argv[])
{
FILE *ctbl;
- const char *tblname, *rel_tblname;
- const char *abs_srctree;
+ const char *tblname;
+ char base_tblname[PATH_MAX];
char buffer[65536];
int fontlen;
int i, nuni, nent;
@@ -102,16 +104,6 @@ int main(int argc, char *argv[])
}
}
- abs_srctree = getenv("abs_srctree");
- if (abs_srctree && !strncmp(abs_srctree, tblname, strlen(abs_srctree)))
- {
- rel_tblname = tblname + strlen(abs_srctree);
- while (*rel_tblname == '/')
- ++rel_tblname;
- }
- else
- rel_tblname = tblname;
-
/* For now we assume the default font is always 256 characters. */
fontlen = 256;
@@ -253,6 +245,8 @@ 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\
@@ -264,7 +258,7 @@ int main(int argc, char *argv[])
#include <linux/types.h>\n\
\n\
u8 dfont_unicount[%d] = \n\
-{\n\t", rel_tblname, fontlen);
+{\n\t", basename(base_tblname), fontlen);
for ( i = 0 ; i < fontlen ; i++ )
{
--
2.42.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] tty: vt: conmakehash: cope with abs_srctree no longer in env 2024-07-25 13:20 [PATCH] tty: vt: conmakehash: cope with abs_srctree no longer in env max.oss.09 @ 2024-07-25 13:28 ` kernel test robot 2024-08-02 14:09 ` Daiane Angolini 2024-08-17 9:48 ` Luca Weiss 2 siblings, 0 replies; 6+ messages in thread From: kernel test robot @ 2024-07-25 13:28 UTC (permalink / raw) To: max.oss.09; +Cc: stable, oe-kbuild-all Hi, Thanks for your patch. FYI: kernel test robot notices the stable kernel rule is not satisfied. The check is based on https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html#option-1 Rule: add the tag "Cc: stable@vger.kernel.org" in the sign-off area to have the patch automatically included in the stable tree. Subject: [PATCH] tty: vt: conmakehash: cope with abs_srctree no longer in env Link: https://lore.kernel.org/stable/20240725132056.9151-1-max.oss.09%40gmail.com -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] tty: vt: conmakehash: cope with abs_srctree no longer in env 2024-07-25 13:20 [PATCH] tty: vt: conmakehash: cope with abs_srctree no longer in env max.oss.09 2024-07-25 13:28 ` kernel test robot @ 2024-08-02 14:09 ` Daiane Angolini 2024-08-17 9:48 ` Luca Weiss 2 siblings, 0 replies; 6+ messages in thread From: Daiane Angolini @ 2024-08-02 14:09 UTC (permalink / raw) To: max.oss.09 Cc: gregkh, jirislaby, linux-kernel, linux-serial, max.krummenacher, stable, u.kleine-koenig, Daiane Angolini > conmakehash uses getenv("abs_srctree") from the environment to strip > the absolute path from the generated sources. > However since commit e2bad142bb3d ("kbuild: unexport abs_srctree and > abs_objtree") this environment variable no longer gets set. > Instead use basename() to indicate the used file in a comment of the > generated source file. > > Fixes: 3bd85c6c97b2 ("tty: vt: conmakehash: Don't mention the full path of the input in output") > Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> Tested-by: Daiane Angolini <daiane.angolini@foundries.io> ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] tty: vt: conmakehash: cope with abs_srctree no longer in env 2024-07-25 13:20 [PATCH] tty: vt: conmakehash: cope with abs_srctree no longer in env max.oss.09 2024-07-25 13:28 ` kernel test robot 2024-08-02 14:09 ` Daiane Angolini @ 2024-08-17 9:48 ` Luca Weiss 2024-08-17 13:52 ` Max Krummenacher 2 siblings, 1 reply; 6+ messages in thread From: Luca Weiss @ 2024-08-17 9:48 UTC (permalink / raw) To: max.oss.09, Max Krummenacher Cc: stable, Greg Kroah-Hartman, Jiri Slaby, Uwe Kleine-König, linux-kernel, linux-serial On Thu Jul 25, 2024 at 3:20 PM CEST, max.oss.09 wrote: > From: Max Krummenacher <max.krummenacher@toradex.com> > > conmakehash uses getenv("abs_srctree") from the environment to strip > the absolute path from the generated sources. > However since commit e2bad142bb3d ("kbuild: unexport abs_srctree and > abs_objtree") this environment variable no longer gets set. > Instead use basename() to indicate the used file in a comment of the > generated source file. > > Fixes: 3bd85c6c97b2 ("tty: vt: conmakehash: Don't mention the full path of the input in output") > Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> > > --- > > drivers/tty/vt/conmakehash.c | 20 +++++++------------- > 1 file changed, 7 insertions(+), 13 deletions(-) > > diff --git a/drivers/tty/vt/conmakehash.c b/drivers/tty/vt/conmakehash.c > index dc2177fec715..82d9db68b2ce 100644 > --- a/drivers/tty/vt/conmakehash.c > +++ b/drivers/tty/vt/conmakehash.c > @@ -11,6 +11,8 @@ > * Copyright (C) 1995-1997 H. Peter Anvin > */ > > +#include <libgen.h> > +#include <linux/limits.h> Hi Max, Not sure this is the best place to ask but this <linux/limits.h> include appears to rely on this file already being installed in /usr/include and is not taken from the Linux source tree that's being built. This mostly manifests in building Linux kernel e.g. in Alpine Linux package build if 'linux-headers' package is not being explicitly installed, failing with drivers/tty/vt/conmakehash.c:15:10: fatal error: linux/limits.h: No such file or directory 15 | #include <linux/limits.h> | ^~~~~~~~~~~~~~~~ compilation terminated. Apparently this is (understandably) also a problem when building on macOS: https://lore.kernel.org/all/20240807-macos-build-support-v1-11-4cd1ded85694@samsung.com/ I did try that linked patch a bit ago, but unfortunately didn't fix it for the Alpine Linux build environment. Any ideas? Regards Luca > #include <stdio.h> > #include <stdlib.h> > #include <sysexits.h> > @@ -76,8 +78,8 @@ static void addpair(int fp, int un) > int main(int argc, char *argv[]) > { > FILE *ctbl; > - const char *tblname, *rel_tblname; > - const char *abs_srctree; > + const char *tblname; > + char base_tblname[PATH_MAX]; > char buffer[65536]; > int fontlen; > int i, nuni, nent; > @@ -102,16 +104,6 @@ int main(int argc, char *argv[]) > } > } > > - abs_srctree = getenv("abs_srctree"); > - if (abs_srctree && !strncmp(abs_srctree, tblname, strlen(abs_srctree))) > - { > - rel_tblname = tblname + strlen(abs_srctree); > - while (*rel_tblname == '/') > - ++rel_tblname; > - } > - else > - rel_tblname = tblname; > - > /* For now we assume the default font is always 256 characters. */ > fontlen = 256; > > @@ -253,6 +245,8 @@ 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\ > @@ -264,7 +258,7 @@ int main(int argc, char *argv[]) > #include <linux/types.h>\n\ > \n\ > u8 dfont_unicount[%d] = \n\ > -{\n\t", rel_tblname, fontlen); > +{\n\t", basename(base_tblname), fontlen); > > for ( i = 0 ; i < fontlen ; i++ ) > { ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] tty: vt: conmakehash: cope with abs_srctree no longer in env 2024-08-17 9:48 ` Luca Weiss @ 2024-08-17 13:52 ` Max Krummenacher 2024-08-19 6:47 ` Luca Weiss 0 siblings, 1 reply; 6+ messages in thread From: Max Krummenacher @ 2024-08-17 13:52 UTC (permalink / raw) To: Luca Weiss Cc: Max Krummenacher, stable, Greg Kroah-Hartman, Jiri Slaby, Uwe Kleine-König, linux-kernel, linux-serial Hi Luca On Sat, Aug 17, 2024 at 11:48 AM Luca Weiss <luca.weiss@fairphone.com> wrote: > > On Thu Jul 25, 2024 at 3:20 PM CEST, max.oss.09 wrote: > > From: Max Krummenacher <max.krummenacher@toradex.com> > > > > conmakehash uses getenv("abs_srctree") from the environment to strip > > the absolute path from the generated sources. > > However since commit e2bad142bb3d ("kbuild: unexport abs_srctree and > > abs_objtree") this environment variable no longer gets set. > > Instead use basename() to indicate the used file in a comment of the > > generated source file. > > > > Fixes: 3bd85c6c97b2 ("tty: vt: conmakehash: Don't mention the full path of the input in output") > > Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> > > > > --- > > > > drivers/tty/vt/conmakehash.c | 20 +++++++------------- > > 1 file changed, 7 insertions(+), 13 deletions(-) > > > > diff --git a/drivers/tty/vt/conmakehash.c b/drivers/tty/vt/conmakehash.c > > index dc2177fec715..82d9db68b2ce 100644 > > --- a/drivers/tty/vt/conmakehash.c > > +++ b/drivers/tty/vt/conmakehash.c > > @@ -11,6 +11,8 @@ > > * Copyright (C) 1995-1997 H. Peter Anvin > > */ > > > > +#include <libgen.h> > > +#include <linux/limits.h> > > Hi Max, > > Not sure this is the best place to ask but this <linux/limits.h> include > appears to rely on this file already being installed in /usr/include and > is not taken from the Linux source tree that's being built. > > This mostly manifests in building Linux kernel e.g. in Alpine Linux > package build if 'linux-headers' package is not being explicitly > installed, failing with > > drivers/tty/vt/conmakehash.c:15:10: fatal error: linux/limits.h: No such file or directory > 15 | #include <linux/limits.h> > | ^~~~~~~~~~~~~~~~ > compilation terminated. > > Apparently this is (understandably) also a problem when building on > macOS: > https://lore.kernel.org/all/20240807-macos-build-support-v1-11-4cd1ded85694@samsung.com/ > > I did try that linked patch a bit ago, but unfortunately didn't fix it > for the Alpine Linux build environment. This is a bug I introduced. Masahiro Yamada already fixed it with [1]. Sorry about that. Regards Max [1] https://lore.kernel.org/all/20240809160853.1269466-1-masahiroy@kernel.org/ > > Any ideas? > > Regards > Luca > > > > #include <stdio.h> > > #include <stdlib.h> > > #include <sysexits.h> > > @@ -76,8 +78,8 @@ static void addpair(int fp, int un) > > int main(int argc, char *argv[]) > > { > > FILE *ctbl; > > - const char *tblname, *rel_tblname; > > - const char *abs_srctree; > > + const char *tblname; > > + char base_tblname[PATH_MAX]; > > char buffer[65536]; > > int fontlen; > > int i, nuni, nent; > > @@ -102,16 +104,6 @@ int main(int argc, char *argv[]) > > } > > } > > > > - abs_srctree = getenv("abs_srctree"); > > - if (abs_srctree && !strncmp(abs_srctree, tblname, strlen(abs_srctree))) > > - { > > - rel_tblname = tblname + strlen(abs_srctree); > > - while (*rel_tblname == '/') > > - ++rel_tblname; > > - } > > - else > > - rel_tblname = tblname; > > - > > /* For now we assume the default font is always 256 characters. */ > > fontlen = 256; > > > > @@ -253,6 +245,8 @@ 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\ > > @@ -264,7 +258,7 @@ int main(int argc, char *argv[]) > > #include <linux/types.h>\n\ > > \n\ > > u8 dfont_unicount[%d] = \n\ > > -{\n\t", rel_tblname, fontlen); > > +{\n\t", basename(base_tblname), fontlen); > > > > for ( i = 0 ; i < fontlen ; i++ ) > > { > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] tty: vt: conmakehash: cope with abs_srctree no longer in env 2024-08-17 13:52 ` Max Krummenacher @ 2024-08-19 6:47 ` Luca Weiss 0 siblings, 0 replies; 6+ messages in thread From: Luca Weiss @ 2024-08-19 6:47 UTC (permalink / raw) To: Max Krummenacher Cc: Max Krummenacher, stable, Greg Kroah-Hartman, Jiri Slaby, Uwe Kleine-König, linux-kernel, linux-serial On Sat Aug 17, 2024 at 3:52 PM CEST, Max Krummenacher wrote: > Hi Luca > > On Sat, Aug 17, 2024 at 11:48 AM Luca Weiss <luca.weiss@fairphone.com> wrote: > > > > On Thu Jul 25, 2024 at 3:20 PM CEST, max.oss.09 wrote: > > > From: Max Krummenacher <max.krummenacher@toradex.com> > > > > > > conmakehash uses getenv("abs_srctree") from the environment to strip > > > the absolute path from the generated sources. > > > However since commit e2bad142bb3d ("kbuild: unexport abs_srctree and > > > abs_objtree") this environment variable no longer gets set. > > > Instead use basename() to indicate the used file in a comment of the > > > generated source file. > > > > > > Fixes: 3bd85c6c97b2 ("tty: vt: conmakehash: Don't mention the full path of the input in output") > > > Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> > > > > > > --- > > > > > > drivers/tty/vt/conmakehash.c | 20 +++++++------------- > > > 1 file changed, 7 insertions(+), 13 deletions(-) > > > > > > diff --git a/drivers/tty/vt/conmakehash.c b/drivers/tty/vt/conmakehash.c > > > index dc2177fec715..82d9db68b2ce 100644 > > > --- a/drivers/tty/vt/conmakehash.c > > > +++ b/drivers/tty/vt/conmakehash.c > > > @@ -11,6 +11,8 @@ > > > * Copyright (C) 1995-1997 H. Peter Anvin > > > */ > > > > > > +#include <libgen.h> > > > +#include <linux/limits.h> > > > > Hi Max, > > > > Not sure this is the best place to ask but this <linux/limits.h> include > > appears to rely on this file already being installed in /usr/include and > > is not taken from the Linux source tree that's being built. > > > > This mostly manifests in building Linux kernel e.g. in Alpine Linux > > package build if 'linux-headers' package is not being explicitly > > installed, failing with > > > > drivers/tty/vt/conmakehash.c:15:10: fatal error: linux/limits.h: No such file or directory > > 15 | #include <linux/limits.h> > > | ^~~~~~~~~~~~~~~~ > > compilation terminated. > > > > Apparently this is (understandably) also a problem when building on > > macOS: > > https://lore.kernel.org/all/20240807-macos-build-support-v1-11-4cd1ded85694@samsung.com/ > > > > I did try that linked patch a bit ago, but unfortunately didn't fix it > > for the Alpine Linux build environment. > > This is a bug I introduced. > > Masahiro Yamada already fixed it with [1]. Great, I see it's also in torvalds' tree already, so I assume it'll hit stable soon as well. Thanks! > > Sorry about that. > > Regards > Max > > [1] https://lore.kernel.org/all/20240809160853.1269466-1-masahiroy@kernel.org/ > > > > > Any ideas? > > > > Regards > > Luca > > > > > > > #include <stdio.h> > > > #include <stdlib.h> > > > #include <sysexits.h> > > > @@ -76,8 +78,8 @@ static void addpair(int fp, int un) > > > int main(int argc, char *argv[]) > > > { > > > FILE *ctbl; > > > - const char *tblname, *rel_tblname; > > > - const char *abs_srctree; > > > + const char *tblname; > > > + char base_tblname[PATH_MAX]; > > > char buffer[65536]; > > > int fontlen; > > > int i, nuni, nent; > > > @@ -102,16 +104,6 @@ int main(int argc, char *argv[]) > > > } > > > } > > > > > > - abs_srctree = getenv("abs_srctree"); > > > - if (abs_srctree && !strncmp(abs_srctree, tblname, strlen(abs_srctree))) > > > - { > > > - rel_tblname = tblname + strlen(abs_srctree); > > > - while (*rel_tblname == '/') > > > - ++rel_tblname; > > > - } > > > - else > > > - rel_tblname = tblname; > > > - > > > /* For now we assume the default font is always 256 characters. */ > > > fontlen = 256; > > > > > > @@ -253,6 +245,8 @@ 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\ > > > @@ -264,7 +258,7 @@ int main(int argc, char *argv[]) > > > #include <linux/types.h>\n\ > > > \n\ > > > u8 dfont_unicount[%d] = \n\ > > > -{\n\t", rel_tblname, fontlen); > > > +{\n\t", basename(base_tblname), fontlen); > > > > > > for ( i = 0 ; i < fontlen ; i++ ) > > > { > > ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-08-19 6:47 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-07-25 13:20 [PATCH] tty: vt: conmakehash: cope with abs_srctree no longer in env max.oss.09 2024-07-25 13:28 ` kernel test robot 2024-08-02 14:09 ` Daiane Angolini 2024-08-17 9:48 ` Luca Weiss 2024-08-17 13:52 ` Max Krummenacher 2024-08-19 6:47 ` Luca Weiss
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox