linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scripts/patch-kernel fix
       [not found] <cf445a75-137c-4689-aa34-6c89cbd92b7b@mail.eladian.com>
@ 2012-07-19 21:49 ` Daniel Wisehart
  2012-07-26 10:10   ` Michal Marek
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Wisehart @ 2012-07-19 21:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: alan

Takes care of errors when running something like:

$ ./scripts/patch-kernel . .. 3.5
Current kernel version is 3.5.0-rc7 ( Saber-toothed Squirrel)
./scripts/patch-kernel: line 229: [: -lt: unary operator expected
./scripts/patch-kernel: line 252: [: -gt: unary operator expected


diff --git a/scripts/patch-kernel b/scripts/patch-kernel
index d000ea3..a7672eb 100755
--- a/scripts/patch-kernel
+++ b/scripts/patch-kernel
@@ -226,7 +226,7 @@ fi
 
 # This all assumes a 2.6.x[.y] kernel tree.
 # Don't allow backwards/reverse patching.
-if [ $STOPSUBLEVEL -lt $SUBLEVEL ]; then
+if [ "$STOPSUBLEVEL"0 -lt "$SUBLEVEL"0 ]; then
        backwards
 fi
 
@@ -249,7 +249,7 @@ fi
 # If not ending sublevel is specified, it is incremented until
 # no further sublevels are found.
 
-if [ $STOPSUBLEVEL -gt $SUBLEVEL ]; then
+if [ "$STOPSUBLEVEL"0 -gt "$SUBLEVEL"0 ]; then
 while :                                # incrementing SUBLEVEL (s in v.p.s)
 do
     CURRENTFULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL"



This communication is restricted - please see http://www.eladian.com for further information.

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

* Re: [PATCH] scripts/patch-kernel fix
  2012-07-19 21:49 ` [PATCH] scripts/patch-kernel fix Daniel Wisehart
@ 2012-07-26 10:10   ` Michal Marek
  2012-08-17 21:26     ` Jan Engelhardt
  0 siblings, 1 reply; 3+ messages in thread
From: Michal Marek @ 2012-07-26 10:10 UTC (permalink / raw)
  To: Daniel Wisehart; +Cc: linux-kernel

On 19.7.2012 23:49, Daniel Wisehart wrote:
> diff --git a/scripts/patch-kernel b/scripts/patch-kernel
> index d000ea3..a7672eb 100755
> --- a/scripts/patch-kernel
> +++ b/scripts/patch-kernel
> @@ -226,7 +226,7 @@ fi
>  
>  # This all assumes a 2.6.x[.y] kernel tree.
>  # Don't allow backwards/reverse patching.
> -if [ $STOPSUBLEVEL -lt $SUBLEVEL ]; then
> +if [ "$STOPSUBLEVEL"0 -lt "$SUBLEVEL"0 ]; then

Hi Daniel,

While this is correct, it is not obvious at first sight why you need to
multiply the numbers by 10. Or at least it was not obvious to me :).
Could you use the more common idiom 0$NUMBER? The shell interprets the
numbers as decimal, so it's works fine.

Michal

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

* Re: [PATCH] scripts/patch-kernel fix
  2012-07-26 10:10   ` Michal Marek
@ 2012-08-17 21:26     ` Jan Engelhardt
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Engelhardt @ 2012-08-17 21:26 UTC (permalink / raw)
  To: Michal Marek; +Cc: Daniel Wisehart, linux-kernel


On Thursday 2012-07-26 12:10, Michal Marek wrote:
>On 19.7.2012 23:49, Daniel Wisehart wrote:
>> diff --git a/scripts/patch-kernel b/scripts/patch-kernel
>> index d000ea3..a7672eb 100755
>> --- a/scripts/patch-kernel
>> +++ b/scripts/patch-kernel
>> @@ -226,7 +226,7 @@ fi
>>  
>>  # This all assumes a 2.6.x[.y] kernel tree.
>>  # Don't allow backwards/reverse patching.
>> -if [ $STOPSUBLEVEL -lt $SUBLEVEL ]; then
>> +if [ "$STOPSUBLEVEL"0 -lt "$SUBLEVEL"0 ]; then
>
>Hi Daniel,
>
>While this is correct, it is not obvious at first sight why you need to
>multiply the numbers by 10. Or at least it was not obvious to me :).

Word has it some really old shells nobody would use to compile Linux on
interpret "" not as an empty argument, but as a non-existing argument,
turning if [ "" != "" ] into essentially if [ != ].

Doing x10 avoids the uncertainity whether shells might attempt to
interpret it as octal or not.
So far the interpretation..

>Could you use the more common idiom 0$NUMBER? The shell interprets the
>numbers as decimal, so it's works fine.

Wonder what POSIX says about that.

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

end of thread, other threads:[~2012-08-17 21:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <cf445a75-137c-4689-aa34-6c89cbd92b7b@mail.eladian.com>
2012-07-19 21:49 ` [PATCH] scripts/patch-kernel fix Daniel Wisehart
2012-07-26 10:10   ` Michal Marek
2012-08-17 21:26     ` Jan Engelhardt

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