Patchwork base-files: do_install_basefilesissue error

login
register
mail settings
Submitter Giuseppe CONDORELLI
Date Oct. 22, 2012, 3:32 p.m.
Message ID <1350919952-14859-1-git-send-email-giuseppe.condorelli@st.com>
Download mbox | patch
Permalink /patch/38431/
State New
Headers show

Comments

Giuseppe CONDORELLI - Oct. 22, 2012, 3:32 p.m.
Fixed error in do_install_basefilesissue, printf is now replaced by echo.

Signed-off-by: Giuseppe Condorelli <giuseppe.condorelli@st.com>
---
 meta/recipes-core/base-files/base-files_3.0.14.bb |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
Chris Larson - Oct. 23, 2012, 1:40 a.m.
On Mon, Oct 22, 2012 at 8:32 AM, Giuseppe CONDORELLI
<giuseppe.condorelli@st.com> wrote:
> Fixed error in do_install_basefilesissue, printf is now replaced by echo.
>
> Signed-off-by: Giuseppe Condorelli <giuseppe.condorelli@st.com>

What error? Also, this changes the behavior. printf doesn't print a
newline, echo does (unless you use echo -n). printf's behavior is much
more reliable and portable than echos is.
Martin Jansa - Oct. 23, 2012, 7:54 a.m.
On Mon, Oct 22, 2012 at 05:32:32PM +0200, Giuseppe CONDORELLI wrote:
> Fixed error in do_install_basefilesissue, printf is now replaced by echo.

Looks like partial revert of

commit a19880ad10ccb5d7d909dcf9de5c3dc58a0ebcd3
Author: Andrei Gherzan <andrei@gherzan.ro>
Date:   Thu Sep 20 12:56:59 2012 +0300

    Replace "echo -e" with "printf" to have the same behavior in dash or bash

    oe-core removed the prerequisite to have sh as bash. POSIX doesn't define
    any options and furthermore allows 'echo -e' to be the default behavior.
    This means that in dash 'echo -e' will actually print '-e' and interpret
    backslashes by default. We use instead 'printf' builtin command with or
    without '\n' to simulate 'echo -e' or 'echo -n'.
    'printf' needs format while 'echo' can be used without any arguments. So
    'echo >' was replaced by 'printf "" >'.
    'echo' without '-n' flag adds a new line by default so to keep the same
    behavior of two new lines while using 'echo "\n"', 'printf "\n\n"' is
    used.

    [YOCTO #3138]

with very weak explanation why..

> 
> Signed-off-by: Giuseppe Condorelli <giuseppe.condorelli@st.com>
> ---
>  meta/recipes-core/base-files/base-files_3.0.14.bb |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/meta/recipes-core/base-files/base-files_3.0.14.bb b/meta/recipes-core/base-files/base-files_3.0.14.bb
> index ba355ee..766b0e5 100644
> --- a/meta/recipes-core/base-files/base-files_3.0.14.bb
> +++ b/meta/recipes-core/base-files/base-files_3.0.14.bb
> @@ -117,11 +117,11 @@ do_install_basefilesissue () {
>  
>  	install -m 644 ${WORKDIR}/issue*  ${D}${sysconfdir}  
>          if [ -n "${DISTRO_NAME}" ]; then
> -		printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue
> -		printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue.net
> +		echo "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue
> +		echo "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue.net
>  		if [ -n "${DISTRO_VERSION}" ]; then
> -			printf "${DISTRO_VERSION} " >> ${D}${sysconfdir}/issue
> -			printf "${DISTRO_VERSION} " >> ${D}${sysconfdir}/issue.net
> +			echo "${DISTRO_VERSION} " >> ${D}${sysconfdir}/issue
> +			echo "${DISTRO_VERSION} " >> ${D}${sysconfdir}/issue.net
>  		fi
>  		echo "\n \l" >> ${D}${sysconfdir}/issue
>  		echo >> ${D}${sysconfdir}/issue
> -- 
> 1.7.4.4
> 
> 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Giuseppe Condorelli - Oct. 23, 2012, 7:56 a.m.
Yes, you are right.
The mistake was in local setting because DISTRO_VERSION was set to
"-${DATE}" and the minus created
the install error.
Locally solved, please discard the patch.
Thanks,
Giuseppe

2012/10/23 Martin Jansa <martin.jansa@gmail.com>

> On Mon, Oct 22, 2012 at 05:32:32PM +0200, Giuseppe CONDORELLI wrote:
> > Fixed error in do_install_basefilesissue, printf is now replaced by echo.
>
> Looks like partial revert of
>
> commit a19880ad10ccb5d7d909dcf9de5c3dc58a0ebcd3
> Author: Andrei Gherzan <andrei@gherzan.ro>
> Date:   Thu Sep 20 12:56:59 2012 +0300
>
>     Replace "echo -e" with "printf" to have the same behavior in dash or
> bash
>
>     oe-core removed the prerequisite to have sh as bash. POSIX doesn't
> define
>     any options and furthermore allows 'echo -e' to be the default
> behavior.
>     This means that in dash 'echo -e' will actually print '-e' and
> interpret
>     backslashes by default. We use instead 'printf' builtin command with or
>     without '\n' to simulate 'echo -e' or 'echo -n'.
>     'printf' needs format while 'echo' can be used without any arguments.
> So
>     'echo >' was replaced by 'printf "" >'.
>     'echo' without '-n' flag adds a new line by default so to keep the same
>     behavior of two new lines while using 'echo "\n"', 'printf "\n\n"' is
>     used.
>
>     [YOCTO #3138]
>
> with very weak explanation why..
>
> >
> > Signed-off-by: Giuseppe Condorelli <giuseppe.condorelli@st.com>
> > ---
> >  meta/recipes-core/base-files/base-files_3.0.14.bb |    8 ++++----
> >  1 files changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/meta/recipes-core/base-files/base-files_3.0.14.bbb/meta/recipes-core/base-files/
> base-files_3.0.14.bb
> > index ba355ee..766b0e5 100644
> > --- a/meta/recipes-core/base-files/base-files_3.0.14.bb
> > +++ b/meta/recipes-core/base-files/base-files_3.0.14.bb
> > @@ -117,11 +117,11 @@ do_install_basefilesissue () {
> >
> >       install -m 644 ${WORKDIR}/issue*  ${D}${sysconfdir}
> >          if [ -n "${DISTRO_NAME}" ]; then
> > -             printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue
> > -             printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue.net
> > +             echo "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue
> > +             echo "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue.net
> >               if [ -n "${DISTRO_VERSION}" ]; then
> > -                     printf "${DISTRO_VERSION} " >>
> ${D}${sysconfdir}/issue
> > -                     printf "${DISTRO_VERSION} " >> ${D}${sysconfdir}/
> issue.net
> > +                     echo "${DISTRO_VERSION} " >>
> ${D}${sysconfdir}/issue
> > +                     echo "${DISTRO_VERSION} " >> ${D}${sysconfdir}/
> issue.net
> >               fi
> >               echo "\n \l" >> ${D}${sysconfdir}/issue
> >               echo >> ${D}${sysconfdir}/issue
> > --
> > 1.7.4.4
> >
> >
> > _______________________________________________
> > Openembedded-core mailing list
> > Openembedded-core@lists.openembedded.org
> > http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>
> --
> Martin 'JaMa' Jansa     jabber: Martin.Jansa@gmail.com
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>
>

Patch

diff --git a/meta/recipes-core/base-files/base-files_3.0.14.bb b/meta/recipes-core/base-files/base-files_3.0.14.bb
index ba355ee..766b0e5 100644
--- a/meta/recipes-core/base-files/base-files_3.0.14.bb
+++ b/meta/recipes-core/base-files/base-files_3.0.14.bb
@@ -117,11 +117,11 @@  do_install_basefilesissue () {
 
 	install -m 644 ${WORKDIR}/issue*  ${D}${sysconfdir}  
         if [ -n "${DISTRO_NAME}" ]; then
-		printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue
-		printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue.net
+		echo "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue
+		echo "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue.net
 		if [ -n "${DISTRO_VERSION}" ]; then
-			printf "${DISTRO_VERSION} " >> ${D}${sysconfdir}/issue
-			printf "${DISTRO_VERSION} " >> ${D}${sysconfdir}/issue.net
+			echo "${DISTRO_VERSION} " >> ${D}${sysconfdir}/issue
+			echo "${DISTRO_VERSION} " >> ${D}${sysconfdir}/issue.net
 		fi
 		echo "\n \l" >> ${D}${sysconfdir}/issue
 		echo >> ${D}${sysconfdir}/issue