From a40d2daf2795d89e3ef8af0413b25190558831ec Mon Sep 17 00:00:00 2001
From: Bruce Ashfield <bruce.ashfield@gmail.com>
Date: Thu, 14 Jul 2022 14:43:46 -0400
Subject: [PATCH] pnmtologo: use relocatable file name

The logo generation utility is capturing the source of the logo
in the generated .c file. The source file is absolute (as passed
by make), so the full path is captured.

This makes the source fail reproducibility tests.

We use basename() to just get the source file name, and use
that in the generated .c file.

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>

Upstream-Status: Inappropriate

Signed-off-by: Denys Dmytriyenko <denys@konsulko.com>
---
 drivers/video/logo/pnmtologo.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/video/logo/pnmtologo.c b/drivers/video/logo/pnmtologo.c
index ada5ef6e51b7..7527be845443 100644
--- a/drivers/video/logo/pnmtologo.c
+++ b/drivers/video/logo/pnmtologo.c
@@ -13,7 +13,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-
+#include <libgen.h>

 static const char *programname;
 static const char *filename;
@@ -223,6 +223,7 @@ static inline int is_equal(struct color c1, struct color c2)

 static void write_header(void)
 {
+	char *filename_basename = basename(filename);
	/* open logo file */
	if (outputname) {
		out = fopen(outputname, "w");
@@ -235,7 +236,7 @@ static void write_header(void)
	fputs("/*\n", out);
	fputs(" *  DO NOT EDIT THIS FILE!\n", out);
	fputs(" *\n", out);
-	fprintf(out, " *  It was automatically generated from %s\n", filename);
+	fprintf(out, " *  It was automatically generated from %s\n", filename_basename);
	fputs(" *\n", out);
	fprintf(out, " *  Linux logo %s\n", logoname);
	fputs(" */\n\n", out);
--
2.25.1
