mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] setlocalversion: use /bin/bash explicitly
@ 2011-12-13 23:06 Andreas Bießmann
  2011-12-14 10:51 ` Michael Olbrich
  2011-12-16 18:18 ` [ptxdist] [PATCH v2] setlocalversion: replace echo -n with printf Andreas Bießmann
  0 siblings, 2 replies; 5+ messages in thread
From: Andreas Bießmann @ 2011-12-13 23:06 UTC (permalink / raw)
  To: PTXdist ML; +Cc: Andreas Bießmann

Using /bin/sh in setlocalversion lead to corrupted $PTXDIST_VERSION_FULL
cause the 'echo -n "$v"' will use the builtin echo which does not know
about -n switch.

Before this patch my version looks like this:

---8<---
$ ptxdist --version
-n 2011.12.0-00047-g9849e20
--->8---

Signed-off-by: Andreas Bießmann <andreas@biessmann.de>
---
 scripts/kernel/setlocalversion |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scripts/kernel/setlocalversion b/scripts/kernel/setlocalversion
index 3e14135..bf467ea 100755
--- a/scripts/kernel/setlocalversion
+++ b/scripts/kernel/setlocalversion
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # This scripts adds local version information from the version
 # control systems git, mercurial (hg) and subversion (svn).
-- 
1.7.8


-- 
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] [PATCH] setlocalversion: use /bin/bash explicitly
  2011-12-13 23:06 [ptxdist] [PATCH] setlocalversion: use /bin/bash explicitly Andreas Bießmann
@ 2011-12-14 10:51 ` Michael Olbrich
  2011-12-14 11:08   ` Marc Kleine-Budde
  2011-12-16 18:18 ` [ptxdist] [PATCH v2] setlocalversion: replace echo -n with printf Andreas Bießmann
  1 sibling, 1 reply; 5+ messages in thread
From: Michael Olbrich @ 2011-12-14 10:51 UTC (permalink / raw)
  To: ptxdist; +Cc: Marc Kleine-Budde

On Wed, Dec 14, 2011 at 12:06:59AM +0100, Andreas Bießmann wrote:
> Using /bin/sh in setlocalversion lead to corrupted $PTXDIST_VERSION_FULL
> cause the 'echo -n "$v"' will use the builtin echo which does not know
> about -n switch.

Hmmm, I think we could just drop the '-n'.

Marc: this is your code, what do you think.

Michael

> Before this patch my version looks like this:
> 
> ---8<---
> $ ptxdist --version
> -n 2011.12.0-00047-g9849e20
> --->8---
> 
> Signed-off-by: Andreas Bießmann <andreas@biessmann.de>
> ---
>  scripts/kernel/setlocalversion |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/scripts/kernel/setlocalversion b/scripts/kernel/setlocalversion
> index 3e14135..bf467ea 100755
> --- a/scripts/kernel/setlocalversion
> +++ b/scripts/kernel/setlocalversion
> @@ -1,4 +1,4 @@
> -#!/bin/sh
> +#!/bin/bash
>  #
>  # This scripts adds local version information from the version
>  # control systems git, mercurial (hg) and subversion (svn).
> -- 
> 1.7.8
> 
> 
> -- 
> ptxdist mailing list
> ptxdist@pengutronix.de

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] [PATCH] setlocalversion: use /bin/bash explicitly
  2011-12-14 10:51 ` Michael Olbrich
@ 2011-12-14 11:08   ` Marc Kleine-Budde
  2011-12-14 11:20     ` Michael Olbrich
  0 siblings, 1 reply; 5+ messages in thread
From: Marc Kleine-Budde @ 2011-12-14 11:08 UTC (permalink / raw)
  To: ptxdist


[-- Attachment #1.1: Type: text/plain, Size: 794 bytes --]

On 12/14/2011 11:51 AM, Michael Olbrich wrote:
> On Wed, Dec 14, 2011 at 12:06:59AM +0100, Andreas Bießmann wrote:
>> Using /bin/sh in setlocalversion lead to corrupted $PTXDIST_VERSION_FULL
>> cause the 'echo -n "$v"' will use the builtin echo which does not know
>> about -n switch.
> 
> Hmmm, I think we could just drop the '-n'.
> 
> Marc: this is your code, what do you think.

We could use printf instead. I'm not sure what happens, when we have a
trailing newline in the version information.

Marc
-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

[-- Attachment #2: Type: text/plain, Size: 48 bytes --]

-- 
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] [PATCH] setlocalversion: use /bin/bash explicitly
  2011-12-14 11:08   ` Marc Kleine-Budde
@ 2011-12-14 11:20     ` Michael Olbrich
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Olbrich @ 2011-12-14 11:20 UTC (permalink / raw)
  To: ptxdist

On Wed, Dec 14, 2011 at 12:08:28PM +0100, Marc Kleine-Budde wrote:
> On 12/14/2011 11:51 AM, Michael Olbrich wrote:
> > On Wed, Dec 14, 2011 at 12:06:59AM +0100, Andreas Bießmann wrote:
> >> Using /bin/sh in setlocalversion lead to corrupted $PTXDIST_VERSION_FULL
> >> cause the 'echo -n "$v"' will use the builtin echo which does not know
> >> about -n switch.
> > 
> > Hmmm, I think we could just drop the '-n'.
> > 
> > Marc: this is your code, what do you think.
> 
> We could use printf instead. I'm not sure what happens, when we have a
> trailing newline in the version information.

It's used in '$()' which should remove the newline.

Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
ptxdist mailing list
ptxdist@pengutronix.de

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

* [ptxdist] [PATCH v2] setlocalversion: replace echo -n with printf
  2011-12-13 23:06 [ptxdist] [PATCH] setlocalversion: use /bin/bash explicitly Andreas Bießmann
  2011-12-14 10:51 ` Michael Olbrich
@ 2011-12-16 18:18 ` Andreas Bießmann
  1 sibling, 0 replies; 5+ messages in thread
From: Andreas Bießmann @ 2011-12-16 18:18 UTC (permalink / raw)
  To: PTXdist ML; +Cc: Michael Olbrich, Andreas Bießmann, Marc Kleine-Budde

On some systems the 'echo -n "$v"' lead to corrupted
$PTXDIST_VERSION_FULL cause the builtin echo is used which does not know
about -n switch. Instead of just removing the -n switch use printf as
the rest of this script do.

Before this patch my version looks like this:

---8<---
$ ptxdist --version
-n 2011.12.0-00047-g9849e20
--->8---

Signed-off-by: Andreas Bießmann <andreas@biessmann.de>
cc: Michael Olbrich <m.olbrich@pengutronix.de>
cc: Marc Kleine-Budde <mkl@pengutronix.de>
---
changes since v1:
 - stay at /bin/sh
 - replace echo -n by printf as suggested by Marc Kleine-Budde

I tested a .tarball-version with trailing newline and it worked at least for my
/bin/sh (OS X Lion)

 scripts/kernel/setlocalversion |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scripts/kernel/setlocalversion b/scripts/kernel/setlocalversion
index 3e14135..0ece321 100755
--- a/scripts/kernel/setlocalversion
+++ b/scripts/kernel/setlocalversion
@@ -39,7 +39,7 @@ then
     test -z "$v" \
 	&& echo "$0: WARNING: $tarball_version_file seems to be damaged" 1>&2
 
-    echo -n "$v"
+    printf '%s' $v
     exit
 fi
 
-- 
1.7.8


-- 
ptxdist mailing list
ptxdist@pengutronix.de

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

end of thread, other threads:[~2011-12-16 18:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-13 23:06 [ptxdist] [PATCH] setlocalversion: use /bin/bash explicitly Andreas Bießmann
2011-12-14 10:51 ` Michael Olbrich
2011-12-14 11:08   ` Marc Kleine-Budde
2011-12-14 11:20     ` Michael Olbrich
2011-12-16 18:18 ` [ptxdist] [PATCH v2] setlocalversion: replace echo -n with printf Andreas Bießmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox