lkml.org 
[lkml]   [2004]   [Apr]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectStrip whitespace from EXTRAVERSION?
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[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 14:02    [W:0.053 / U:0.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site