From patchwork Fri Aug 9 16:07:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13758929 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF24D1870; Fri, 9 Aug 2024 16:09:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723219746; cv=none; b=QiXxpcKfLqiXHdCJePEVw9CUrlwx0o+dMCb+dmgl+64qwtHtLGeaOuMn5dDM8QetOc7olMf1S7zkm7GiZrfNzge2pXvCYb3PCpcDZQgNY7/cw4/2lzFyFEBCm6G/z82EwjCJxgsOdV5e5WcIZtDM+3JNpGJQnrWGZnoTzLdyTLI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723219746; c=relaxed/simple; bh=omwvjFoS49SAlXYzfzzu4DPijGXZFsgBINHbieSf1VU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=KkCkKv9R2bOVliOg8XaBNJ0Atwkof7bi0UCSbZIXthL09ARaZbZMiTaTQzyDxyJfl0xeccmPUprDIVp11weiRPzpjTvjO7qOI/L61YZlU4VwEjETIEeVJtt3oPNZuXyTkcI7P4lGAAl7rgrfk73OfWCmLRTgnv0VpVr2VI/zb2w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=s8Z5u4+U; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="s8Z5u4+U" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BC0FC32782; Fri, 9 Aug 2024 16:09:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723219745; bh=omwvjFoS49SAlXYzfzzu4DPijGXZFsgBINHbieSf1VU=; h=From:To:Cc:Subject:Date:From; b=s8Z5u4+UY/TuJZZY19mD6njpuv3yDwbAWJ3FR4U8BXkpMRiqTYbMCvuwBHV6qPn3X QSXnORxzMmAX0CyhHylMhwotNePhrRZ3HQohpBvKnBpY8vic6QHlZwG34ZxBexa0IA 5hQ4pxeaZIRIxESvwdizYORaiBdDn1U15Hw3xk4I+iEzUE4BiT7bCCcarY1GaM9Q8V n1ZHFkwyMOyxoV71Q24CJHWQ4WW8vGt+eDcCOY5vHmMEHC4VTbe/kec0LNrIxIX9v6 9xMk+zq2git1gJZBhIJ7fH8AZzTSl/2MpUAqq6qLgTPg02LkodRfiT/+uCklxKtvOI 8ZzuRBbdlvtkA== From: Masahiro Yamada To: Greg Kroah-Hartman Cc: linux-kbuild@vger.kernel.org, Max Krummenacher , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , Masahiro Yamada , Daniel Gomez , Jiri Slaby , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH] tty: vt: conmakehash: remove non-portable code printing comment header Date: Sat, 10 Aug 2024 01:07:20 +0900 Message-ID: <20240809160853.1269466-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Commit 6e20753da6bc ("tty: vt: conmakehash: cope with abs_srctree no longer in env") included , 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 . The minimal fix would be to replace with . 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] * */ 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: - 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 Closes: https://lore.kernel.org/all/20240807-macos-build-support-v1-11-4cd1ded85694@samsung.com/ Signed-off-by: Masahiro Yamada --- 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 -#include #include #include #include @@ -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 \n\ \n\ u8 dfont_unicount[%d] = \n\ -{\n\t", basename(base_tblname), fontlen); +{\n\t", fontlen); for ( i = 0 ; i < fontlen ; i++ ) {