linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Juergen Salk <juergen.salk@gmx.de>
To: linux-kernel@vger.kernel.org
Subject: Strip whitespace from EXTRAVERSION?
Date: Tue, 6 Apr 2004 16:47:09 +0200	[thread overview]
Message-ID: <20040406144709.GC16564@oest181.str.klinik.uni-ulm.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 2035 bytes --]

Hi,

I am wondering if it makes sense to strip whitespace
characters from $(EXTRAVERSION) if they exist.

Especially trailing whitespace can easily be introduced
(and overlooked) by mistake by someone who edits
this value in the Makefile.

This is not only a show stopper when it comes to
»make modules_install« but it may also cause data
loss under certain circumstances. E.g. if you
maintain an - admittedly non-standard - directory
tree named /kernel on your system, this tree will be
deleted when you invoke »make modules_install« with
trailing whitespace in $(EXTRAVERSION) (and thus
in $(MODLIB) as well):

.PHONY: modules_install
modules_install: _modinst_ $(patsubst %, _modinst_%, $(SUBDIRS))
_modinst_post

.PHONY: _modinst_
_modinst_:
    @rm -rf $(MODLIB)/kernel
    @rm -f $(MODLIB)/build
    @mkdir -p $(MODLIB)/kernel
    @ln -s $(TOPDIR) $(MODLIB)/build

Similar arguments may hold true for other macros
as well (like $(VERSION), $(PATCHLEVEL) etc.), but
these are much less likely touched by an ordinary
user who just wants to recompile his kernel.

After all, this is not a big issue, but I would like to
know what others think about it.

Just in case, there is a trivial one-liner against
2.4.25 below to remove whitespace from $(EXTRAVERSION) before it
is used elsewhere. Note that there is a space and a tab
inside the sed braces.

(One could also think about proper quoting to allow whitespace
in $(EXTRAVERSION), but I'm not so sure if whitespace makes
much sense in it, anyway.)

Regards - Juergen Salk


--- Makefile-orig       Tue Apr  6 14:13:06 2004
+++ Makefile    Tue Apr  6 14:45:29 2004
@@ -3,6 +3,7 @@
 SUBLEVEL = 25
 EXTRAVERSION =

+EXTRAVERSION:=$(shell echo $(EXTRAVERSION) | sed -e 's/[ 	]//g')
 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)

 ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)

-- 
GPG A997BA7A | 87FC DA31 5F00 C885 0DC3  E28F BD0D 4B33 A997 BA7A

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

             reply	other threads:[~2004-04-06 14:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-06 14:47 Juergen Salk [this message]
2004-04-06 15:56 ` Strip whitespace from EXTRAVERSION? Andreas Schwab
2004-04-06 16:32   ` Juergen Salk
2004-04-06 18:23 ` Måns Rullgård
2004-04-07  8:00   ` Juergen Salk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040406144709.GC16564@oest181.str.klinik.uni-ulm.de \
    --to=juergen.salk@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).