Skip to contentSkip to conversation

signrom.sh: portability fix

PATCH Christoph Egger 2 participants 2 messages Jul 20, 2009

lore
Share & tools
lore
#0 lore raw
Quoted 8 lines · On Friday 17 July 2009 16:37:38 Alexander Graf wrote:
Quoted 5 lines · Christoph Egger

Hi!

Attached patch makes signrom.sh working on NetBSD. The output of the 'od' command leads to a syntax error which breaks the build.

So why replace the $(( ... )) calculation with expr then?

because $i contains some whitespaces and leading zeros.
This lets the bourne shell think, $i is a string and doing math with strings results in syntax error.
Passing it down into expr trims them.

Quoted 1 line

A few lines below there's another $(( )) that apparently works.

$sum is not a string there.

Quoted 1 line

Btw: Inlined patches are very much appreciated :-)

Not for me because kmail malforms those with tabs, so that they don't apply cleanly.

Christoph

Signature · 16 lines
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Karl-Hammerschmidt-Str. 34, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Thomas M. McCoy, Giuliano Meroni
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632

-------------------------------------------------------

-- 
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Karl-Hammerschmidt-Str. 34, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Thomas M. McCoy, Giuliano Meroni
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632
#1 lore raw
Quoted 10 lines · Christoph Egger
Quoted 8 lines · On Friday 17 July 2009 16:37:38 Alexander Graf wrote:
Quoted 5 lines · Christoph Egger

Hi!

Attached patch makes signrom.sh working on NetBSD. The output of the 'od' command leads to a syntax error which breaks the build.

So why replace the $(( ... )) calculation with expr then?

Quoted 8 lines

because $i contains some whitespaces and leading zeros.
This lets the bourne shell think, $i is a string and doing math with strings results in syntax error.
Passing it down into expr trims them.

Quoted 1 line

A few lines below there's another $(( )) that apparently works.

$sum is not a string there.

Ok, patch looks fine then.

Quoted 4 lines
Quoted 1 line

Btw: Inlined patches are very much appreciated :-)

Not for me because kmail malforms those with tabs, so that they don't apply cleanly.

Use git-send-email then. It's really no fun to review attached patches.

Alex