Skip to content

Commit 6e20753

Browse files
MaxKrummenachergregkh
authored andcommitted
tty: vt: conmakehash: cope with abs_srctree no longer in env
conmakehash uses getenv("abs_srctree") from the environment to strip the absolute path from the generated sources. However since commit e2bad14 ("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: 3bd85c6 ("tty: vt: conmakehash: Don't mention the full path of the input in output") Cc: stable <stable@kernel.org> Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> Link: https://lore.kernel.org/stable/20240725132056.9151-1-max.oss.09%40gmail.com Link: https://lore.kernel.org/r/20240725132056.9151-1-max.oss.09@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 7d3b793 commit 6e20753

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

drivers/tty/vt/conmakehash.c

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
* Copyright (C) 1995-1997 H. Peter Anvin
1212
*/
1313

14+
#include <libgen.h>
15+
#include <linux/limits.h>
1416
#include <stdio.h>
1517
#include <stdlib.h>
1618
#include <sysexits.h>
@@ -76,8 +78,8 @@ static void addpair(int fp, int un)
7678
int main(int argc, char *argv[])
7779
{
7880
FILE *ctbl;
79-
const char *tblname, *rel_tblname;
80-
const char *abs_srctree;
81+
const char *tblname;
82+
char base_tblname[PATH_MAX];
8183
char buffer[65536];
8284
int fontlen;
8385
int i, nuni, nent;
@@ -102,16 +104,6 @@ int main(int argc, char *argv[])
102104
}
103105
}
104106

105-
abs_srctree = getenv("abs_srctree");
106-
if (abs_srctree && !strncmp(abs_srctree, tblname, strlen(abs_srctree)))
107-
{
108-
rel_tblname = tblname + strlen(abs_srctree);
109-
while (*rel_tblname == '/')
110-
++rel_tblname;
111-
}
112-
else
113-
rel_tblname = tblname;
114-
115107
/* For now we assume the default font is always 256 characters. */
116108
fontlen = 256;
117109

@@ -253,6 +245,8 @@ int main(int argc, char *argv[])
253245
for ( i = 0 ; i < fontlen ; i++ )
254246
nuni += unicount[i];
255247

248+
strncpy(base_tblname, tblname, PATH_MAX);
249+
base_tblname[PATH_MAX - 1] = 0;
256250
printf("\
257251
/*\n\
258252
* Do not edit this file; it was automatically generated by\n\
@@ -264,7 +258,7 @@ int main(int argc, char *argv[])
264258
#include <linux/types.h>\n\
265259
\n\
266260
u8 dfont_unicount[%d] = \n\
267-
{\n\t", rel_tblname, fontlen);
261+
{\n\t", basename(base_tblname), fontlen);
268262

269263
for ( i = 0 ; i < fontlen ; i++ )
270264
{

0 commit comments

Comments
 (0)