Hello,

On 21/08/2025 04:59, Santiago Vila wrote:
> Thanks for the report. Your patch may look simple and innocent, but
> every "parameterization" adds some complexity and the problem is that
> we know how it starts, but we don't know how it can end. See #959471
> for an example of a similar request.

Thanks for your feedback, and pointer to another discussion.

I see that, in #959471, Guillem aims at the definitive solution. I
completely support his approach, from the point of view of a Debian
derivative, it's just great. But of course it's a harder sell to accept
his patch, because of reviewing the changes, and assessing how it will
fare in the long run...

While here I propose a change that is much lighter, and still provides a
real benefit for derivatives.

Let me also attach two patches, an implementation for the second
approach I proposed, ie. changing the value of OSNAME from "GNU/Linux"
to "Debian GNU/Linux". I find it a bit more elegant.


> So, I'm keeping this open as wishlist because I have not decided yet
> how much support I want to provide to forks (if any at all).

Note that any derivative HAVE TO fork base-files, whether they like it
or not.

Because there's no clear path for how to fork and modify base-files,
some derivatives don't do it right, so "Debian" is still hardcoded in
some system files, instead of having been replaced with
"<DerivativeName>". Or, when users of the derivative want to file a bug,
it lands on bugs.debian.org, instead of landing on the bugtracker of the
derivative.

IMO it's a win for both Debian and its derivatives if base-files is easy
to fork, so what Guillem proposes at #959471 makes lots of sense.

But as you said, it adds complexity and it's a cost for the maintenance
of the package, and that's at your appreciation.

Thanks for your reading!

Best,

Arnaud
From 30fed3a9a275e1e9ffdb3f21f7b1bd0910dd1e21 Mon Sep 17 00:00:00 2001
From: Arnaud Rebillout <[email protected]>
Date: Mon, 18 Aug 2025 10:28:39 +0700
Subject: [PATCH 1/2] Include 'Debian' in the OSNAME variable

Thanks to this change, it's easier for a derivative to replace "Debian
GNU/Linux" with eg. "Kali GNU/Linux". It only takes a change in
debian/rules, instead of having to patch multiple files.

Note that this change leads to a FTBFS, which is addressed in the next
commit.
---
 debian/rules   | 6 +++---
 etc/issue      | 2 +-
 etc/issue.net  | 2 +-
 etc/os-release | 4 ++--
 share/info.dir | 2 +-
 share/motd     | 4 ++--
 6 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/debian/rules b/debian/rules
index cd0157f..745bae6 100755
--- a/debian/rules
+++ b/debian/rules
@@ -2,12 +2,12 @@
 
 include /usr/share/dpkg/architecture.mk
 
-OSNAME = "GNU/`uname | sed -e 's/GNU\///'`"
+OSNAME = "Debian GNU/`uname | sed -e 's/GNU\///'`"
 ifeq ($(DEB_HOST_GNU_SYSTEM),linux)
-  OSNAME=GNU/Linux
+  OSNAME = Debian GNU/Linux
 endif
 ifeq ($(DEB_HOST_GNU_SYSTEM),gnu)
-  OSNAME=GNU/Hurd
+  OSNAME = Debian GNU/Hurd
 endif
 
 VENDORFILE = debian
diff --git a/etc/issue b/etc/issue
index 9ed4526..e1d4fc0 100644
--- a/etc/issue
+++ b/etc/issue
@@ -1,2 +1,2 @@
-Debian #OSNAME# forky/sid \n \l
+#OSNAME# forky/sid \n \l
 
diff --git a/etc/issue.net b/etc/issue.net
index 15ce5f7..0376583 100644
--- a/etc/issue.net
+++ b/etc/issue.net
@@ -1 +1 @@
-Debian #OSNAME# forky/sid
+#OSNAME# forky/sid
diff --git a/etc/os-release b/etc/os-release
index 3887df6..3e15849 100644
--- a/etc/os-release
+++ b/etc/os-release
@@ -1,5 +1,5 @@
-PRETTY_NAME="Debian #OSNAME# forky/sid"
-NAME="Debian #OSNAME#"
+PRETTY_NAME="#OSNAME# forky/sid"
+NAME="#OSNAME#"
 VERSION_CODENAME=forky
 ID=debian
 HOME_URL="https://www.debian.org/";
diff --git a/share/info.dir b/share/info.dir
index 550533d..0b2cfe3 100644
--- a/share/info.dir
+++ b/share/info.dir
@@ -11,7 +11,7 @@ File: dir	Node: Top	This is the top of the INFO tree
   it.
   --- PLEASE ADD DOCUMENTATION TO THIS TREE. (See INFO topic first.) ---
 
-In Debian #OSNAME#, Info `dir' entries are added with the command
+In #OSNAME#, Info `dir' entries are added with the command
 `install-info'.  Please refer to install-info(8) for usage details.
 
 * Menu: The list of major topics begins on the next line.
diff --git a/share/motd b/share/motd
index 0120913..6f48a66 100644
--- a/share/motd
+++ b/share/motd
@@ -1,7 +1,7 @@
 
-The programs included with the Debian #OSNAME# system are free software;
+The programs included with the #OSNAME# system are free software;
 the exact distribution terms for each program are described in the
 individual files in /usr/share/doc/*/copyright.
 
-Debian #OSNAME# comes with ABSOLUTELY NO WARRANTY, to the extent
+#OSNAME# comes with ABSOLUTELY NO WARRANTY, to the extent
 permitted by applicable law.
-- 
2.50.1

From 5a018833d7be9c5c5afc9af952c4b7530aa0d516 Mon Sep 17 00:00:00 2001
From: Arnaud Rebillout <[email protected]>
Date: Thu, 21 Aug 2025 09:58:31 +0700
Subject: [PATCH 2/2] Evaluate uname during variable definition

Before this commit, the OSNAME variable was a static string, and in
particular the uname command wasn't executed when the variable was
defined. Instead it was executed during the target
`override_dh_auto_install`.

Which means that the line:

    sed -e "s&#OSNAME#&$(OSNAME)&g" share/motd

Was turned into:

    sed -e "s&#OSNAME#&"GNU/`uname | sed -e 's/GNU\///'`"&g" share/motd

Which works, as long as there is no space in the string:

    "GNU/`uname | sed -e 's/GNU\///'`"

However that changed in previous commit, a space was added when OSNAME
became:

    "Debian GNU/`uname | sed -e 's/GNU\///'`"

Which lead to a FTBFS:

    sed -e "s&#OSNAME#&"Debian GNU/`uname | sed -e 's/GNU\///'`"&g" share/motd     > debian/base-files/usr/share/base-files/motd
    sed: -e expression #1, char 17: unterminated `s' command
    make[1]: *** [debian/rules:49: override_dh_auto_install] Error 1

There are different ways to fix it.

For example, we can adjust the sed commands in order to deal with a
space in the OSNAME variable expansion.

Or simply drop the double-quotes from the OSNAME variable definition, so
the sed command becomes:

    sed -e "s&#OSNAME#&GNU/`uname | sed -e 's/GNU\///'`&g" share/motd

Or another approach is to execute uname once and for all when the OSNAME
variable is defined. I find it easier, so that's the approach I took in
this commit.
---
 debian/rules | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/debian/rules b/debian/rules
index 745bae6..93a05d2 100755
--- a/debian/rules
+++ b/debian/rules
@@ -2,7 +2,7 @@
 
 include /usr/share/dpkg/architecture.mk
 
-OSNAME = "Debian GNU/`uname | sed -e 's/GNU\///'`"
+OSNAME = Debian GNU/$(shell uname | sed -e 's/GNU\///')
 ifeq ($(DEB_HOST_GNU_SYSTEM),linux)
   OSNAME = Debian GNU/Linux
 endif
-- 
2.50.1

Reply via email to