* [PATCH] update-rc.d.bbclass: Fix host/target test in postinst
@ 2013-10-26 22:36 Jacob Kroon
2013-10-27 7:18 ` Hans Beckerus
2013-10-27 15:08 ` Martin Jansa
0 siblings, 2 replies; 6+ messages in thread
From: Jacob Kroon @ 2013-10-26 22:36 UTC (permalink / raw)
To: openembedded-core
When running the postinst script I get a shell warning:
sh: argument expected
and the service is never stopped. This patch fixes the warning
message and stops the service.
Signed-off-by: Jacob Kroon <jacob.kroon@gmail.com>
---
meta/classes/update-rc.d.bbclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta/classes/update-rc.d.bbclass b/meta/classes/update-rc.d.bbclass
index e14659d..835b717 100644
--- a/meta/classes/update-rc.d.bbclass
+++ b/meta/classes/update-rc.d.bbclass
@@ -16,7 +16,7 @@ updatercd_postinst() {
# test if there is a previous init script there, ie, we are updating the package
# if so, we stop the service and remove it before we install from the new package
if type update-rc.d >/dev/null 2>/dev/null; then
- if [ -z "$D" -a `test -f "${INIT_D_DIR}/${INITSCRIPT_NAME}"` ]; then
+ if [ -z "$D" -a "test -f ${INIT_D_DIR}/${INITSCRIPT_NAME}" ]; then
${INIT_D_DIR}/${INITSCRIPT_NAME} stop
fi
if [ -n "$D" ]; then
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] update-rc.d.bbclass: Fix host/target test in postinst
2013-10-26 22:36 [PATCH] update-rc.d.bbclass: Fix host/target test in postinst Jacob Kroon
@ 2013-10-27 7:18 ` Hans Beckerus
2013-10-27 7:25 ` Jacob Kroon
2013-10-27 15:08 ` Martin Jansa
1 sibling, 1 reply; 6+ messages in thread
From: Hans Beckerus @ 2013-10-27 7:18 UTC (permalink / raw)
To: openembedded-core
On 2013-10-27 12:36, Jacob Kroon wrote:
> When running the postinst script I get a shell warning:
>
> sh: argument expected
>
> and the service is never stopped. This patch fixes the warning
> message and stops the service.
This patch does not look right to me?
If length of $(D) is zero the condition will *always* be true. Instead of actually testing the existence of "${INIT_D_DIR}/${INITSCRIPT_NAME}" it is now simply converted to a string. What did I miss ;)
Thanks.
Hans
> Signed-off-by: Jacob Kroon <jacob.kroon@gmail.com>
> ---
> meta/classes/update-rc.d.bbclass | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/classes/update-rc.d.bbclass b/meta/classes/update-rc.d.bbclass
> index e14659d..835b717 100644
> --- a/meta/classes/update-rc.d.bbclass
> +++ b/meta/classes/update-rc.d.bbclass
> @@ -16,7 +16,7 @@ updatercd_postinst() {
> # test if there is a previous init script there, ie, we are updating the package
> # if so, we stop the service and remove it before we install from the new package
> if type update-rc.d >/dev/null 2>/dev/null; then
> - if [ -z "$D" -a `test -f "${INIT_D_DIR}/${INITSCRIPT_NAME}"` ]; then
> + if [ -z "$D" -a "test -f ${INIT_D_DIR}/${INITSCRIPT_NAME}" ]; then
> ${INIT_D_DIR}/${INITSCRIPT_NAME} stop
> fi
> if [ -n "$D" ]; then
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] update-rc.d.bbclass: Fix host/target test in postinst
2013-10-27 7:18 ` Hans Beckerus
@ 2013-10-27 7:25 ` Jacob Kroon
2013-10-27 7:51 ` Hans Beckerus
0 siblings, 1 reply; 6+ messages in thread
From: Jacob Kroon @ 2013-10-27 7:25 UTC (permalink / raw)
To: Hans Beckerus; +Cc: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 2145 bytes --]
Hi Hans,
I'm far from being a scripting-expert, so I just did what I could in order
to get rid of the warning and stop the service.
Sending this patch was just a way to raise some attention to the bug and
get some discussion going :-)
If there are other ways one should proceed instead of sending "broken"
patches to the mailing list I will do so in the future.
Regards
Jacob
On Sun, Oct 27, 2013 at 8:18 AM, Hans Beckerus <hans.beckerus@gmail.com>wrote:
> On 2013-10-27 12:36, Jacob Kroon wrote:
> > When running the postinst script I get a shell warning:
> >
> > sh: argument expected
> >
> > and the service is never stopped. This patch fixes the warning
> > message and stops the service.
> This patch does not look right to me?
> If length of $(D) is zero the condition will *always* be true. Instead of
> actually testing the existence of "${INIT_D_DIR}/${INITSCRIPT_NAME}" it is
> now simply converted to a string. What did I miss ;)
>
> Thanks.
> Hans
>
> > Signed-off-by: Jacob Kroon <jacob.kroon@gmail.com>
> > ---
> > meta/classes/update-rc.d.bbclass | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/meta/classes/update-rc.d.bbclass
> b/meta/classes/update-rc.d.bbclass
> > index e14659d..835b717 100644
> > --- a/meta/classes/update-rc.d.bbclass
> > +++ b/meta/classes/update-rc.d.bbclass
> > @@ -16,7 +16,7 @@ updatercd_postinst() {
> > # test if there is a previous init script there, ie, we are updating
> the package
> > # if so, we stop the service and remove it before we install from the
> new package
> > if type update-rc.d >/dev/null 2>/dev/null; then
> > - if [ -z "$D" -a `test -f "${INIT_D_DIR}/${INITSCRIPT_NAME}"` ];
> then
> > + if [ -z "$D" -a "test -f ${INIT_D_DIR}/${INITSCRIPT_NAME}" ]; then
> > ${INIT_D_DIR}/${INITSCRIPT_NAME} stop
> > fi
> > if [ -n "$D" ]; then
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
--
-- Jacob
[-- Attachment #2: Type: text/html, Size: 2997 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] update-rc.d.bbclass: Fix host/target test in postinst
2013-10-27 7:25 ` Jacob Kroon
@ 2013-10-27 7:51 ` Hans Beckerus
2013-10-27 8:17 ` Hans Beckérus
0 siblings, 1 reply; 6+ messages in thread
From: Hans Beckerus @ 2013-10-27 7:51 UTC (permalink / raw)
To: Jacob Kroon; +Cc: openembedded-core
On 2013-10-27 8:25, Jacob Kroon wrote:
> Hi Hans,
> I'm far from being a scripting-expert, so I just did what I could in order to
> get rid of the warning and stop the service.
> Sending this patch was just a way to raise some attention to the bug and get
> some discussion going :-)
No problem ;)
Try this instead
if [ -z "$D" -a -f "${INIT_D_DIR}/${INITSCRIPT_NAME}" ]; then
echo stop
fi
Thanks.
Hans
> If there are other ways one should proceed instead of sending "broken" patches
> to the mailing list I will do so in the future.
> Regards
> Jacob
>
>
> On Sun, Oct 27, 2013 at 8:18 AM, Hans Beckerus <hans.beckerus@gmail.com
> <mailto:hans.beckerus@gmail.com>> wrote:
>
> On 2013-10-27 12:36, Jacob Kroon wrote:
> > When running the postinst script I get a shell warning:
> >
> > sh: argument expected
> >
> > and the service is never stopped. This patch fixes the warning
> > message and stops the service.
> This patch does not look right to me?
> If length of $(D) is zero the condition will *always* be true. Instead of
> actually testing the existence of "${INIT_D_DIR}/${INITSCRIPT_NAME}" it is
> now simply converted to a string. What did I miss ;)
>
> Thanks.
> Hans
>
> > Signed-off-by: Jacob Kroon <jacob.kroon@gmail.com
> <mailto:jacob.kroon@gmail.com>>
> > ---
> > meta/classes/update-rc.d.bbclass | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/meta/classes/update-rc.d.bbclass
> b/meta/classes/update-rc.d.bbclass
> > index e14659d..835b717 100644
> > --- a/meta/classes/update-rc.d.bbclass
> > +++ b/meta/classes/update-rc.d.bbclass
> > @@ -16,7 +16,7 @@ updatercd_postinst() {
> > # test if there is a previous init script there, ie, we are updating the
> package
> > # if so, we stop the service and remove it before we install from the
> new package
> > if type update-rc.d >/dev/null 2>/dev/null; then
> > - if [ -z "$D" -a `test -f "${INIT_D_DIR}/${INITSCRIPT_NAME}"` ]; then
> > + if [ -z "$D" -a "test -f ${INIT_D_DIR}/${INITSCRIPT_NAME}" ]; then
> > ${INIT_D_DIR}/${INITSCRIPT_NAME} stop
> > fi
> > if [ -n "$D" ]; then
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> <mailto:Openembedded-core@lists.openembedded.org>
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
>
>
>
> --
> -- Jacob
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] update-rc.d.bbclass: Fix host/target test in postinst
2013-10-27 7:51 ` Hans Beckerus
@ 2013-10-27 8:17 ` Hans Beckérus
0 siblings, 0 replies; 6+ messages in thread
From: Hans Beckérus @ 2013-10-27 8:17 UTC (permalink / raw)
To: Jacob Kroon; +Cc: openembedded-core@lists.openembedded.org
> 27 okt 2013 kl. 08:51 skrev Hans Beckerus <hans.beckerus@gmail.com>:
>
>> On 2013-10-27 8:25, Jacob Kroon wrote:
>> Hi Hans,
>> I'm far from being a scripting-expert, so I just did what I could in order to
>> get rid of the warning and stop the service.
>> Sending this patch was just a way to raise some attention to the bug and get
>> some discussion going :-)
> No problem ;)
> Try this instead
>
> if [ -z "$D" -a -f "${INIT_D_DIR}/${INITSCRIPT_NAME}" ]; then
> echo stop
> fi
>
...and of course replace the 'echo stop' with the previous real call to the init script. This was only to test the syntax.
> Thanks.
> Hans
>
>> If there are other ways one should proceed instead of sending "broken" patches
>> to the mailing list I will do so in the future.
>> Regards
>> Jacob
>>
>>
>> On Sun, Oct 27, 2013 at 8:18 AM, Hans Beckerus <hans.beckerus@gmail.com
>> <mailto:hans.beckerus@gmail.com>> wrote:
>>
>>> On 2013-10-27 12:36, Jacob Kroon wrote:
>>> When running the postinst script I get a shell warning:
>>>
>>> sh: argument expected
>>>
>>> and the service is never stopped. This patch fixes the warning
>>> message and stops the service.
>> This patch does not look right to me?
>> If length of $(D) is zero the condition will *always* be true. Instead of
>> actually testing the existence of "${INIT_D_DIR}/${INITSCRIPT_NAME}" it is
>> now simply converted to a string. What did I miss ;)
>>
>> Thanks.
>> Hans
>>
>>> Signed-off-by: Jacob Kroon <jacob.kroon@gmail.com
>> <mailto:jacob.kroon@gmail.com>>
>>> ---
>>> meta/classes/update-rc.d.bbclass | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/meta/classes/update-rc.d.bbclass
>> b/meta/classes/update-rc.d.bbclass
>>> index e14659d..835b717 100644
>>> --- a/meta/classes/update-rc.d.bbclass
>>> +++ b/meta/classes/update-rc.d.bbclass
>>> @@ -16,7 +16,7 @@ updatercd_postinst() {
>>> # test if there is a previous init script there, ie, we are updating the
>> package
>>> # if so, we stop the service and remove it before we install from the
>> new package
>>> if type update-rc.d >/dev/null 2>/dev/null; then
>>> - if [ -z "$D" -a `test -f "${INIT_D_DIR}/${INITSCRIPT_NAME}"` ]; then
>>> + if [ -z "$D" -a "test -f ${INIT_D_DIR}/${INITSCRIPT_NAME}" ]; then
>>> ${INIT_D_DIR}/${INITSCRIPT_NAME} stop
>>> fi
>>> if [ -n "$D" ]; then
>>
>> _______________________________________________
>> Openembedded-core mailing list
>> Openembedded-core@lists.openembedded.org
>> <mailto:Openembedded-core@lists.openembedded.org>
>> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>>
>>
>>
>>
>> --
>> -- Jacob
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] update-rc.d.bbclass: Fix host/target test in postinst
2013-10-26 22:36 [PATCH] update-rc.d.bbclass: Fix host/target test in postinst Jacob Kroon
2013-10-27 7:18 ` Hans Beckerus
@ 2013-10-27 15:08 ` Martin Jansa
1 sibling, 0 replies; 6+ messages in thread
From: Martin Jansa @ 2013-10-27 15:08 UTC (permalink / raw)
To: Jacob Kroon; +Cc: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 1489 bytes --]
On Sun, Oct 27, 2013 at 12:36:57AM +0200, Jacob Kroon wrote:
> When running the postinst script I get a shell warning:
>
> sh: argument expected
>
> and the service is never stopped. This patch fixes the warning
> message and stops the service.
>
> Signed-off-by: Jacob Kroon <jacob.kroon@gmail.com>
> ---
> meta/classes/update-rc.d.bbclass | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/classes/update-rc.d.bbclass b/meta/classes/update-rc.d.bbclass
> index e14659d..835b717 100644
> --- a/meta/classes/update-rc.d.bbclass
> +++ b/meta/classes/update-rc.d.bbclass
> @@ -16,7 +16,7 @@ updatercd_postinst() {
> # test if there is a previous init script there, ie, we are updating the package
> # if so, we stop the service and remove it before we install from the new package
> if type update-rc.d >/dev/null 2>/dev/null; then
> - if [ -z "$D" -a `test -f "${INIT_D_DIR}/${INITSCRIPT_NAME}"` ]; then
> + if [ -z "$D" -a "test -f ${INIT_D_DIR}/${INITSCRIPT_NAME}" ]; then
I guess you want
+ if [ -z "$D" -a -f "${INIT_D_DIR}/${INITSCRIPT_NAME}" ]; then
here
> ${INIT_D_DIR}/${INITSCRIPT_NAME} stop
> fi
> if [ -n "$D" ]; then
> --
> 1.8.3.1
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
--
Martin 'JaMa' Jansa jabber: Martin.Jansa@gmail.com
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 205 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-10-27 15:08 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-26 22:36 [PATCH] update-rc.d.bbclass: Fix host/target test in postinst Jacob Kroon
2013-10-27 7:18 ` Hans Beckerus
2013-10-27 7:25 ` Jacob Kroon
2013-10-27 7:51 ` Hans Beckerus
2013-10-27 8:17 ` Hans Beckérus
2013-10-27 15:08 ` Martin Jansa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox