All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lsb: Remove bashisms from the rc.d functions
@ 2017-04-07 21:55 Marek Vasut
  2017-04-07 22:02 ` ✗ patchtest: failure for lsb: Remove bashisms from the rc.d functions (rev2) Patchwork
  2017-04-07 22:31 ` [PATCH] lsb: Remove bashisms from the rc.d functions Richard Purdie
  0 siblings, 2 replies; 4+ messages in thread
From: Marek Vasut @ 2017-04-07 21:55 UTC (permalink / raw)
  To: openembedded-core; +Cc: Marek Vasut

This bashism prevents functions from working on systems without bash,
ie. on systems with busybox shell or debian dash. Replace them with
bourne-compatible command instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Ross Burton <ross.burton@intel.com>
Cc: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 .../0002-rc.d-Remove-bashism-from-functions.patch  | 48 ++++++++++++++++++++++
 meta/recipes-extended/lsb/lsbinitscripts_9.68.bb   |  1 +
 2 files changed, 49 insertions(+)
 create mode 100644 meta/recipes-extended/lsb/lsbinitscripts/0002-rc.d-Remove-bashism-from-functions.patch

diff --git a/meta/recipes-extended/lsb/lsbinitscripts/0002-rc.d-Remove-bashism-from-functions.patch b/meta/recipes-extended/lsb/lsbinitscripts/0002-rc.d-Remove-bashism-from-functions.patch
new file mode 100644
index 0000000000..44eed1cc18
--- /dev/null
+++ b/meta/recipes-extended/lsb/lsbinitscripts/0002-rc.d-Remove-bashism-from-functions.patch
@@ -0,0 +1,48 @@
+From b7601dcd4663a9cb936a6d2d224665bea69fcc50 Mon Sep 17 00:00:00 2001
+From: Marek Vasut <marex@denx.de>
+Date: Thu, 6 Apr 2017 19:15:56 +0200
+Subject: [PATCH] rc.d: Remove bashism from functions
+
+This bashism prevents functions from working on systems without bash,
+ie. on systems with busybox shell or debian dash. Replace them with
+bourne-compatible command instead.
+
+Signed-off-by: Marek Vasut <marex@denx.de>
+---
+ rc.d/init.d/functions | 9 ++-------
+ 1 file changed, 2 insertions(+), 7 deletions(-)
+
+diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions
+index 746b37d..3ba21ef 100644
+--- a/rc.d/init.d/functions
++++ b/rc.d/init.d/functions
+@@ -115,15 +115,11 @@ __kill_pids_term_kill_checkpids() {
+     local pid=
+     local pids=$*
+     local remaining=
+-    local stat=
+     local stime=
+ 
+     for pid in $pids ; do
+         [ ! -e  "/proc/$pid" ] && continue
+-        read -r line < "/proc/$pid/stat" 2> /dev/null
+-
+-        stat=($line)
+-        stime=${stat[21]}
++        stime=`cut -d " " -f 22 < /proc/self/stat`
+ 
+         [ -n "$stime" ] && [ "$base_stime" -lt "$stime" ] && continue
+         remaining+="$pid "
+@@ -139,8 +135,7 @@ __kill_pids_term_kill() {
+     local try=0
+     local delay=3;
+     local pid=
+-    local stat=($(< /proc/self/stat))
+-    local base_stime=${stat[21]}
++    local base_stime=`cut -d " " -f 22 < /proc/self/stat`
+ 
+     if [ "$1" = "-d" ]; then
+         delay=$2
+-- 
+2.11.0
+
diff --git a/meta/recipes-extended/lsb/lsbinitscripts_9.68.bb b/meta/recipes-extended/lsb/lsbinitscripts_9.68.bb
index 0c08fffcef..9ba0e01776 100644
--- a/meta/recipes-extended/lsb/lsbinitscripts_9.68.bb
+++ b/meta/recipes-extended/lsb/lsbinitscripts_9.68.bb
@@ -11,6 +11,7 @@ S="${WORKDIR}/initscripts-${PV}"
 SRC_URI = "http://pkgs.fedoraproject.org/repo/pkgs/initscripts/initscripts-${PV}.tar.bz2/6a51a5af38e01445f53989ed0727c3e1/initscripts-${PV}.tar.bz2 \
            file://functions.patch \
            file://0001-functions-avoid-exit-1-which-causes-init-scripts-to-.patch \
+	   file://0002-rc.d-Remove-bashism-from-functions.patch \
           " 
 
 SRC_URI[md5sum] = "6a51a5af38e01445f53989ed0727c3e1"
-- 
2.11.0



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

* ✗ patchtest: failure for lsb: Remove bashisms from the rc.d functions (rev2)
  2017-04-07 21:55 [PATCH] lsb: Remove bashisms from the rc.d functions Marek Vasut
@ 2017-04-07 22:02 ` Patchwork
  2017-04-07 22:31 ` [PATCH] lsb: Remove bashisms from the rc.d functions Richard Purdie
  1 sibling, 0 replies; 4+ messages in thread
From: Patchwork @ 2017-04-07 22:02 UTC (permalink / raw)
  To: Marek Vasut; +Cc: openembedded-core

== Series Details ==

Series: lsb: Remove bashisms from the rc.d functions (rev2)
Revision: 2
URL   : https://patchwork.openembedded.org/series/6209/
State : failure

== Summary ==


Thank you for submitting this patch series to OpenEmbedded Core. This is
an automated response. Several tests have been executed on the proposed
series by patchtest resulting in the following failures:



* Issue             Added patch file is missing Upstream-Status in the header [test_upstream_status_presence] 
  Suggested fix    Add Upstream-Status: <status> to the header of meta/recipes-extended/lsb/lsbinitscripts/0002-rc.d-Remove-bashism-from-functions.patch (possible values: Pending, Submitted, Accepted, Backport, Denied, Inappropriate)



If you believe any of these test results are incorrect, please reply to the
mailing list (openembedded-core@lists.openembedded.org) raising your concerns.
Otherwise we would appreciate you correcting the issues and submitting a new
version of the patchset if applicable. Please ensure you add/increment the
version number when sending the new version (i.e. [PATCH] -> [PATCH v2] ->
[PATCH v3] -> ...).

---
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe



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

* Re: [PATCH] lsb: Remove bashisms from the rc.d functions
  2017-04-07 21:55 [PATCH] lsb: Remove bashisms from the rc.d functions Marek Vasut
  2017-04-07 22:02 ` ✗ patchtest: failure for lsb: Remove bashisms from the rc.d functions (rev2) Patchwork
@ 2017-04-07 22:31 ` Richard Purdie
  2017-04-07 22:41   ` Marek Vasut
  1 sibling, 1 reply; 4+ messages in thread
From: Richard Purdie @ 2017-04-07 22:31 UTC (permalink / raw)
  To: Marek Vasut, openembedded-core

On Fri, 2017-04-07 at 23:55 +0200, Marek Vasut wrote:
> This bashism prevents functions from working on systems without bash,
> ie. on systems with busybox shell or debian dash. Replace them with
> bourne-compatible command instead.

Note that you'd code adds in a couple of forks for code which currently
doesn't need separate process execution. Its therefore not a clear cut
win. Is there no way to do it without the forks in dash?

Cheers,

Richard

> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Ross Burton <ross.burton@intel.com>
> Cc: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
>  .../0002-rc.d-Remove-bashism-from-functions.patch  | 48
> ++++++++++++++++++++++
>  meta/recipes-extended/lsb/lsbinitscripts_9.68.bb   |  1 +
>  2 files changed, 49 insertions(+)
>  create mode 100644 meta/recipes-extended/lsb/lsbinitscripts/0002-
> rc.d-Remove-bashism-from-functions.patch
> 
> diff --git a/meta/recipes-extended/lsb/lsbinitscripts/0002-rc.d-
> Remove-bashism-from-functions.patch b/meta/recipes-
> extended/lsb/lsbinitscripts/0002-rc.d-Remove-bashism-from-
> functions.patch
> new file mode 100644
> index 0000000000..44eed1cc18
> --- /dev/null
> +++ b/meta/recipes-extended/lsb/lsbinitscripts/0002-rc.d-Remove-
> bashism-from-functions.patch
> @@ -0,0 +1,48 @@
> +From b7601dcd4663a9cb936a6d2d224665bea69fcc50 Mon Sep 17 00:00:00
> 2001
> +From: Marek Vasut <marex@denx.de>
> +Date: Thu, 6 Apr 2017 19:15:56 +0200
> +Subject: [PATCH] rc.d: Remove bashism from functions
> +
> +This bashism prevents functions from working on systems without
> bash,
> +ie. on systems with busybox shell or debian dash. Replace them with
> +bourne-compatible command instead.
> +
> +Signed-off-by: Marek Vasut <marex@denx.de>
> +---
> + rc.d/init.d/functions | 9 ++-------
> + 1 file changed, 2 insertions(+), 7 deletions(-)
> +
> +diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions
> +index 746b37d..3ba21ef 100644
> +--- a/rc.d/init.d/functions
> ++++ b/rc.d/init.d/functions
> +@@ -115,15 +115,11 @@ __kill_pids_term_kill_checkpids() {
> +     local pid=
> +     local pids=$*
> +     local remaining=
> +-    local stat=
> +     local stime=
> + 
> +     for pid in $pids ; do
> +         [ ! -e  "/proc/$pid" ] && continue
> +-        read -r line < "/proc/$pid/stat" 2> /dev/null
> +-
> +-        stat=($line)
> +-        stime=${stat[21]}
> ++        stime=`cut -d " " -f 22 < /proc/self/stat`
> + 
> +         [ -n "$stime" ] && [ "$base_stime" -lt "$stime" ] &&
> continue
> +         remaining+="$pid "
> +@@ -139,8 +135,7 @@ __kill_pids_term_kill() {
> +     local try=0
> +     local delay=3;
> +     local pid=
> +-    local stat=($(< /proc/self/stat))
> +-    local base_stime=${stat[21]}
> ++    local base_stime=`cut -d " " -f 22 < /proc/self/stat`
> + 
> +     if [ "$1" = "-d" ]; then
> +         delay=$2
> +-- 
> +2.11.0
> +
> diff --git a/meta/recipes-extended/lsb/lsbinitscripts_9.68.bb
> b/meta/recipes-extended/lsb/lsbinitscripts_9.68.bb
> index 0c08fffcef..9ba0e01776 100644
> --- a/meta/recipes-extended/lsb/lsbinitscripts_9.68.bb
> +++ b/meta/recipes-extended/lsb/lsbinitscripts_9.68.bb
> @@ -11,6 +11,7 @@ S="${WORKDIR}/initscripts-${PV}"
>  SRC_URI = "http://pkgs.fedoraproject.org/repo/pkgs/initscripts/inits
> cripts-${PV}.tar.bz2/6a51a5af38e01445f53989ed0727c3e1/initscripts-
> ${PV}.tar.bz2 \
>             file://functions.patch \
>             file://0001-functions-avoid-exit-1-which-causes-init-
> scripts-to-.patch \
> +	   file://0002-rc.d-Remove-bashism-from-functions.patch \
>            " 
>  
>  SRC_URI[md5sum] = "6a51a5af38e01445f53989ed0727c3e1"


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

* Re: [PATCH] lsb: Remove bashisms from the rc.d functions
  2017-04-07 22:31 ` [PATCH] lsb: Remove bashisms from the rc.d functions Richard Purdie
@ 2017-04-07 22:41   ` Marek Vasut
  0 siblings, 0 replies; 4+ messages in thread
From: Marek Vasut @ 2017-04-07 22:41 UTC (permalink / raw)
  To: Richard Purdie, openembedded-core

On 04/08/2017 12:31 AM, Richard Purdie wrote:
> On Fri, 2017-04-07 at 23:55 +0200, Marek Vasut wrote:
>> This bashism prevents functions from working on systems without bash,
>> ie. on systems with busybox shell or debian dash. Replace them with
>> bourne-compatible command instead.
> 
> Note that you'd code adds in a couple of forks for code which currently
> doesn't need separate process execution. Its therefore not a clear cut
> win. Is there no way to do it without the forks in dash?

Well do you know of any bourne-compatible way ? I'll be happy to learn
something new ...

> Cheers,
> 
> Richard
> 
>> Signed-off-by: Marek Vasut <marex@denx.de>
>> Cc: Ross Burton <ross.burton@intel.com>
>> Cc: Richard Purdie <richard.purdie@linuxfoundation.org>
>> ---
>>  .../0002-rc.d-Remove-bashism-from-functions.patch  | 48
>> ++++++++++++++++++++++
>>  meta/recipes-extended/lsb/lsbinitscripts_9.68.bb   |  1 +
>>  2 files changed, 49 insertions(+)
>>  create mode 100644 meta/recipes-extended/lsb/lsbinitscripts/0002-
>> rc.d-Remove-bashism-from-functions.patch
>>
>> diff --git a/meta/recipes-extended/lsb/lsbinitscripts/0002-rc.d-
>> Remove-bashism-from-functions.patch b/meta/recipes-
>> extended/lsb/lsbinitscripts/0002-rc.d-Remove-bashism-from-
>> functions.patch
>> new file mode 100644
>> index 0000000000..44eed1cc18
>> --- /dev/null
>> +++ b/meta/recipes-extended/lsb/lsbinitscripts/0002-rc.d-Remove-
>> bashism-from-functions.patch
>> @@ -0,0 +1,48 @@
>> +From b7601dcd4663a9cb936a6d2d224665bea69fcc50 Mon Sep 17 00:00:00
>> 2001
>> +From: Marek Vasut <marex@denx.de>
>> +Date: Thu, 6 Apr 2017 19:15:56 +0200
>> +Subject: [PATCH] rc.d: Remove bashism from functions
>> +
>> +This bashism prevents functions from working on systems without
>> bash,
>> +ie. on systems with busybox shell or debian dash. Replace them with
>> +bourne-compatible command instead.
>> +
>> +Signed-off-by: Marek Vasut <marex@denx.de>
>> +---
>> + rc.d/init.d/functions | 9 ++-------
>> + 1 file changed, 2 insertions(+), 7 deletions(-)
>> +
>> +diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions
>> +index 746b37d..3ba21ef 100644
>> +--- a/rc.d/init.d/functions
>> ++++ b/rc.d/init.d/functions
>> +@@ -115,15 +115,11 @@ __kill_pids_term_kill_checkpids() {
>> +     local pid=
>> +     local pids=$*
>> +     local remaining=
>> +-    local stat=
>> +     local stime=
>> + 
>> +     for pid in $pids ; do
>> +         [ ! -e  "/proc/$pid" ] && continue
>> +-        read -r line < "/proc/$pid/stat" 2> /dev/null
>> +-
>> +-        stat=($line)
>> +-        stime=${stat[21]}
>> ++        stime=`cut -d " " -f 22 < /proc/self/stat`
>> + 
>> +         [ -n "$stime" ] && [ "$base_stime" -lt "$stime" ] &&
>> continue
>> +         remaining+="$pid "
>> +@@ -139,8 +135,7 @@ __kill_pids_term_kill() {
>> +     local try=0
>> +     local delay=3;
>> +     local pid=
>> +-    local stat=($(< /proc/self/stat))
>> +-    local base_stime=${stat[21]}
>> ++    local base_stime=`cut -d " " -f 22 < /proc/self/stat`
>> + 
>> +     if [ "$1" = "-d" ]; then
>> +         delay=$2
>> +-- 
>> +2.11.0
>> +
>> diff --git a/meta/recipes-extended/lsb/lsbinitscripts_9.68.bb
>> b/meta/recipes-extended/lsb/lsbinitscripts_9.68.bb
>> index 0c08fffcef..9ba0e01776 100644
>> --- a/meta/recipes-extended/lsb/lsbinitscripts_9.68.bb
>> +++ b/meta/recipes-extended/lsb/lsbinitscripts_9.68.bb
>> @@ -11,6 +11,7 @@ S="${WORKDIR}/initscripts-${PV}"
>>  SRC_URI = "http://pkgs.fedoraproject.org/repo/pkgs/initscripts/inits
>> cripts-${PV}.tar.bz2/6a51a5af38e01445f53989ed0727c3e1/initscripts-
>> ${PV}.tar.bz2 \
>>             file://functions.patch \
>>             file://0001-functions-avoid-exit-1-which-causes-init-
>> scripts-to-.patch \
>> +	   file://0002-rc.d-Remove-bashism-from-functions.patch \
>>            " 
>>  
>>  SRC_URI[md5sum] = "6a51a5af38e01445f53989ed0727c3e1"


-- 
Best regards,
Marek Vasut


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

end of thread, other threads:[~2017-04-07 22:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-07 21:55 [PATCH] lsb: Remove bashisms from the rc.d functions Marek Vasut
2017-04-07 22:02 ` ✗ patchtest: failure for lsb: Remove bashisms from the rc.d functions (rev2) Patchwork
2017-04-07 22:31 ` [PATCH] lsb: Remove bashisms from the rc.d functions Richard Purdie
2017-04-07 22:41   ` Marek Vasut

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.