Skip to content

Commit 7258fdd

Browse files
masahir0ygregkh
authored andcommitted
tty: vt: conmakehash: remove non-portable code printing comment header
Commit 6e20753 ("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>. However, the following commits seem questionable to me: - 3bd85c6 ("tty: vt: conmakehash: Don't mention the full path of the input in output") - 6e20753 ("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] * */ With this commit, the header part of the generate C file will be simplified as follows: /* * Automatically generated file; Do not edit. */ BTW, another series of excessive efforts for a comment header can be seen in the following: - 5ef6dc0 ("lib/build_OID_registry: don't mention the full path of the script in output") - 2fe29fe ("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: 6e20753 ("tty: vt: conmakehash: cope with abs_srctree no longer in env") Cc: stable <stable@kernel.org> 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> Link: https://lore.kernel.org/r/20240809160853.1269466-1-masahiroy@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent dc98d76 commit 7258fdd

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

drivers/tty/vt/conmakehash.c

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

14-
#include <libgen.h>
15-
#include <linux/limits.h>
1614
#include <stdio.h>
1715
#include <stdlib.h>
1816
#include <sysexits.h>
@@ -79,7 +77,6 @@ int main(int argc, char *argv[])
7977
{
8078
FILE *ctbl;
8179
const char *tblname;
82-
char base_tblname[PATH_MAX];
8380
char buffer[65536];
8481
int fontlen;
8582
int i, nuni, nent;
@@ -245,20 +242,15 @@ int main(int argc, char *argv[])
245242
for ( i = 0 ; i < fontlen ; i++ )
246243
nuni += unicount[i];
247244

248-
strncpy(base_tblname, tblname, PATH_MAX);
249-
base_tblname[PATH_MAX - 1] = 0;
250245
printf("\
251246
/*\n\
252-
* Do not edit this file; it was automatically generated by\n\
253-
*\n\
254-
* conmakehash %s > [this file]\n\
255-
*\n\
247+
* Automatically generated file; Do not edit.\n\
256248
*/\n\
257249
\n\
258250
#include <linux/types.h>\n\
259251
\n\
260252
u8 dfont_unicount[%d] = \n\
261-
{\n\t", basename(base_tblname), fontlen);
253+
{\n\t", fontlen);
262254

263255
for ( i = 0 ; i < fontlen ; i++ )
264256
{

0 commit comments

Comments
 (0)