Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] support/download/post-process-helpers: adjust for older coreutils versions
@ 2022-02-10 23:23 Clayton Shotwell
  2022-02-11 17:12 ` Yann E. MORIN
  0 siblings, 1 reply; 2+ messages in thread
From: Clayton Shotwell @ 2022-02-10 23:23 UTC (permalink / raw)
  To: buildroot; +Cc: Clayton Shotwell, Yann E . MORIN, Thomas Petazzoni, Matt Weber

From: Clayton Shotwell <clayton.shotwell@collins.com>

Ran into an issue with the post_process_unpack function using "head -z"
on a RHEL box which is using an older version or coreutils. The "-z"
flag was added in coreutils v8.25 but my IT managed RHEL box is only
using v8.22. The fix I have implemented relies on the null terminated
list and sed to remove the first null character and everthing
afterwards.

Signed-off-by: Clayton Shotwell <clayton.shotwell@collins.com>
---
 support/download/helpers | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/support/download/helpers b/support/download/helpers
index ab31e27..90a7d6c 100755
--- a/support/download/helpers
+++ b/support/download/helpers
@@ -79,7 +79,7 @@ post_process_unpack() {
 
     mkdir "${dest}"
     tar -C "${dest}" --strip-components=1 -xzf "${tarball}"
-    one_file="$(find "${dest}" -type f -print0 |LC_ALL=C sort -z |head -z -n1 |tr -d "\0")"
+    one_file="$(find "${dest}" -type f -print0 |LC_ALL=C sort -z |sed 's/\x0.*//')"
     touch -r "${one_file}" "${dest}.timestamp"
 }
 
-- 
1.8.3.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH] support/download/post-process-helpers: adjust for older coreutils versions
  2022-02-10 23:23 [Buildroot] [PATCH] support/download/post-process-helpers: adjust for older coreutils versions Clayton Shotwell
@ 2022-02-11 17:12 ` Yann E. MORIN
  0 siblings, 0 replies; 2+ messages in thread
From: Yann E. MORIN @ 2022-02-11 17:12 UTC (permalink / raw)
  To: Clayton Shotwell
  Cc: Clayton Shotwell, Matt Weber, Thomas Petazzoni, buildroot

Clayton, All,

On 2022-02-10 17:23 -0600, Clayton Shotwell spake thusly:
> From: Clayton Shotwell <clayton.shotwell@collins.com>
> 
> Ran into an issue with the post_process_unpack function using "head -z"
> on a RHEL box which is using an older version or coreutils. The "-z"
> flag was added in coreutils v8.25 but my IT managed RHEL box is only
> using v8.22. The fix I have implemented relies on the null terminated
> list and sed to remove the first null character and everthing
> afterwards.

coreutils v8.25 were released 2016-01-20, more than 6 years ago now, and
v8.22 were released 2013-12-13, more than eight years ago.

That is sad that you have to use an up-to-date Buildroot (even one that
is not even yet released!) with such an old system... :-/

> Signed-off-by: Clayton Shotwell <clayton.shotwell@collins.com>
> ---
>  support/download/helpers | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/support/download/helpers b/support/download/helpers
> index ab31e27..90a7d6c 100755
> --- a/support/download/helpers
> +++ b/support/download/helpers
> @@ -79,7 +79,7 @@ post_process_unpack() {
>  
>      mkdir "${dest}"
>      tar -C "${dest}" --strip-components=1 -xzf "${tarball}"
> -    one_file="$(find "${dest}" -type f -print0 |LC_ALL=C sort -z |head -z -n1 |tr -d "\0")"
> +    one_file="$(find "${dest}" -type f -print0 |LC_ALL=C sort -z |sed 's/\x0.*//')"

As far as I know, hexa needs two digits to represent a byte, so \x00

    http://sed.sourceforge.net/grabbag/tutorials/sedfaq.txt

    4.2. How do I represent control-codes or nonprintable characters?

    Several versions of sed support the notation \xHH, where "HH" are
    two hex digits, 00-FF [...]

So I fixed that, and applied to master,  with a rewokred commit log,
thanks.

Regards,
Yann E. MORIN.

>      touch -r "${one_file}" "${dest}.timestamp"
>  }
>  
> -- 
> 1.8.3.1
> 

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2022-02-11 17:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-10 23:23 [Buildroot] [PATCH] support/download/post-process-helpers: adjust for older coreutils versions Clayton Shotwell
2022-02-11 17:12 ` Yann E. MORIN

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