[PATCH] ecompress: fix "Argument list too long" for sed (bug 727522)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] ecompress: fix "Argument list too long" for sed (bug 727522)

Zac Medico-2
From: Patrick McLean <[hidden email]>

Use sed -f to feed commands to sed via stdin, in order to avoid
the "Argument list too long" error reported in bug 727522.

Fixes: 5508bf7a6db5 ("ecompress: ignore docompress -x files in precompressed QA check (bug 721516)")
Bug: https://bugs.gentoo.org/727522
Signed-off-by: Zac Medico <[hidden email]>
---
 bin/ecompress | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/bin/ecompress b/bin/ecompress
index 7aabc8e4c..1ab07ccd7 100755
--- a/bin/ecompress
+++ b/bin/ecompress
@@ -38,9 +38,10 @@ while [[ $# -gt 0 ]] ; do
  if [[ ${#skip_files[@]} -gt 0 && -s ${T}/.ecompress_had_precompressed ]]; then
  sed_args=()
  for f in "${skip_files[@]}"; do
- sed_args+=(-e "s|^${f}\$||")
+ sed_args+=("s|^${f}\$||;")
  done
- sed "${sed_args[@]}" -e '/^$/d' -i "${T}/.ecompress_had_precompressed" || die
+ sed_args+=('/^$/d')
+ sed -f - -i "${T}/.ecompress_had_precompressed" <<< "${sed_args[@]}" || die
  fi
 
  exit 0
--
2.25.3


Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] ecompress: fix "Argument list too long" for sed (bug 727522)

Robin H. Johnson-2
On Tue, Jun 23, 2020 at 05:36:14PM -0700, Zac Medico wrote:
> From: Patrick McLean <[hidden email]>
>
> Use sed -f to feed commands to sed via stdin, in order to avoid
> the "Argument list too long" error reported in bug 727522.
Will this need to move to a tempfile in the near future, for the size of
sed_args? Maybe do that work now?

--
Robin Hugh Johnson
Gentoo Linux: Dev, Infra Lead, Foundation Treasurer
E-Mail   : [hidden email]
GnuPG FP : 11ACBA4F 4778E3F6 E4EDF38E B27B944E 34884E85
GnuPG FP : 7D0B3CEB E9B85B1F 825BCECF EE05E6F6 A48F6136

signature.asc (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] ecompress: fix "Argument list too long" for sed (bug 727522)

Zac Medico-2
On 6/24/20 10:57 AM, Robin H. Johnson wrote:
> On Tue, Jun 23, 2020 at 05:36:14PM -0700, Zac Medico wrote:
>> From: Patrick McLean <[hidden email]>
>>
>> Use sed -f to feed commands to sed via stdin, in order to avoid
>> the "Argument list too long" error reported in bug 727522.
> Will this need to move to a tempfile in the near future, for the size of
> sed_args? Maybe do that work now?

Yeah sure. I'm thinking that sort + comm are ideal for this type of
operation in shell code.
--
Thanks,
Zac


signature.asc (1000 bytes) Download Attachment