linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Strip whitespace from EXTRAVERSION?
@ 2004-04-06 14:47 Juergen Salk
  2004-04-06 15:56 ` Andreas Schwab
  2004-04-06 18:23 ` Måns Rullgård
  0 siblings, 2 replies; 5+ messages in thread
From: Juergen Salk @ 2004-04-06 14:47 UTC (permalink / raw)
  To: linux-kernel

[-- 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 --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Strip whitespace from EXTRAVERSION?
  2004-04-06 14:47 Strip whitespace from EXTRAVERSION? Juergen Salk
@ 2004-04-06 15:56 ` Andreas Schwab
  2004-04-06 16:32   ` Juergen Salk
  2004-04-06 18:23 ` Måns Rullgård
  1 sibling, 1 reply; 5+ messages in thread
From: Andreas Schwab @ 2004-04-06 15:56 UTC (permalink / raw)
  To: Juergen Salk; +Cc: linux-kernel

Juergen Salk <juergen.salk@gmx.de> writes:

> --- 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')

EXTRAVERSION := $(strip $(EXTRAVERSION))

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Strip whitespace from EXTRAVERSION?
  2004-04-06 15:56 ` Andreas Schwab
@ 2004-04-06 16:32   ` Juergen Salk
  0 siblings, 0 replies; 5+ messages in thread
From: Juergen Salk @ 2004-04-06 16:32 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: linux-kernel

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

* Andreas Schwab <schwab@suse.de> [040406 17:56]:

> > +EXTRAVERSION := $(shell echo $(EXTRAVERSION) | sed -e 's/[ 	]//g')
                 ^  ^

> EXTRAVERSION := $(strip $(EXTRAVERSION))

Ok. I think this still leaves embedded whitespace (which may also
cause some trouble), but this is much harder to to overlook, if
not introduced intentionally, anyway. ;-)

Regards - Juergen

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

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Strip whitespace from EXTRAVERSION?
  2004-04-06 14:47 Strip whitespace from EXTRAVERSION? Juergen Salk
  2004-04-06 15:56 ` Andreas Schwab
@ 2004-04-06 18:23 ` Måns Rullgård
  2004-04-07  8:00   ` Juergen Salk
  1 sibling, 1 reply; 5+ messages in thread
From: Måns Rullgård @ 2004-04-06 18:23 UTC (permalink / raw)
  To: linux-kernel

Juergen Salk <juergen.salk@gmx.de> writes:

> (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.)

Quoting could be a good idea in case the EXTRAVERSION should contain
shell meta-characters.  Why anyone would do such a thing is beyond my
imagination, but who knows?

-- 
Måns Rullgård
mru@kth.se


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Strip whitespace from EXTRAVERSION?
  2004-04-06 18:23 ` Måns Rullgård
@ 2004-04-07  8:00   ` Juergen Salk
  0 siblings, 0 replies; 5+ messages in thread
From: Juergen Salk @ 2004-04-07  8:00 UTC (permalink / raw)
  To: Måns Rullgård; +Cc: linux-kernel

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

* Måns Rullgård <mru@kth.se> [040406 20:23]:

> good idea in case the EXTRAVERSION should contain shell
> meta-characters.  Why anyone would do such a thing is beyond my
> imagination, ... 

I concur. But you don't even need meta-characters to mess up the
whole system with a badly or just carelessly formatted
EXTRAVERSION. 

Imagine what may happen with something like:

EXTRAVERSION = -foo / # my homebrew -foo kernel

Maybe somewhat far-fetched ...

> ... but who knows?

True.

Best regards - Juergen

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-04-07  8:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-06 14:47 Strip whitespace from EXTRAVERSION? Juergen Salk
2004-04-06 15:56 ` 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

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).