From 47fed9b61b994c10bfdb9c5dd74576429e42f15b Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Tue, 4 Mar 2025 01:03:10 +0100 Subject: [PATCH 1/3] apk: backport patch fixing broken apk update with wget fetch APK update is currently broken if wget is used as a tool. This wasn't correctly tested and cause seg fault. Backport the patch fixing this to restore original functionality. Signed-off-by: Christian Marangi --- package/system/apk/Makefile | 2 +- ...ectly-init-wget_out-on-apk_io_url_in.patch | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 package/system/apk/patches/0002-io_url_wget-correctly-init-wget_out-on-apk_io_url_in.patch diff --git a/package/system/apk/Makefile b/package/system/apk/Makefile index b1b1fd3a40..f753b41f85 100644 --- a/package/system/apk/Makefile +++ b/package/system/apk/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=apk -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_URL=https://gitlab.alpinelinux.org/alpine/apk-tools.git PKG_SOURCE_PROTO:=git diff --git a/package/system/apk/patches/0002-io_url_wget-correctly-init-wget_out-on-apk_io_url_in.patch b/package/system/apk/patches/0002-io_url_wget-correctly-init-wget_out-on-apk_io_url_in.patch new file mode 100644 index 0000000000..305e367727 --- /dev/null +++ b/package/system/apk/patches/0002-io_url_wget-correctly-init-wget_out-on-apk_io_url_in.patch @@ -0,0 +1,27 @@ +From a50f7ea2dd023ef124c5209b487608b37dbeea7c Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Sat, 1 Mar 2025 19:33:18 +0100 +Subject: [PATCH] io_url_wget: correctly init wget_out on apk_io_url_init call + +Commit fc7768c09497 ("io_url_wget: log wget output using apk_process +api") reworked the implementation but forgot to init the static wget_out +on calling apk_io_url_init. This cause APK to SIGFAULT on apk update or +apk add when actually using the WGET method to download remote packages. + +Fix this by setting wget_out with the passed out from apk_io_url_init. + +Reported-by: John Crispin +Fixes: fc7768c09497 ("io_url_wget: log wget output using apk_process api") +Signed-off-by: Christian Marangi +--- + src/io_url_wget.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/src/io_url_wget.c ++++ b/src/io_url_wget.c +@@ -48,4 +48,5 @@ void apk_io_url_set_redirect_callback(vo + + void apk_io_url_init(struct apk_out *out) + { ++ wget_out = out; + } From 32d0a57dc10811a24816e51f10e55963f40fe462 Mon Sep 17 00:00:00 2001 From: Cedric CHEDALEUX Date: Mon, 17 Feb 2025 10:41:32 +0100 Subject: [PATCH 2/3] scripts/feeds: shallow clone for specific commit update When a feed is referenced with a specific commit (i.e. ^), a full clone was performed and a branch was created from the sha1 and named with the sha1. Other git clones operations are shallowed. As Git does not support clone at a specific commit, let's first perform a shallow clone to latest commit, then fetch the relevant commit and finally checkout it (no more 'pseudo' branch). It saves bandwith and significantly speeds up the feed update process. Signed-off-by: Cedric CHEDALEUX Link: https://github.com/openwrt/openwrt/pull/18003 Signed-off-by: Robert Marko --- scripts/feeds | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/feeds b/scripts/feeds index d07c28bc50..0ff6765814 100755 --- a/scripts/feeds +++ b/scripts/feeds @@ -157,7 +157,7 @@ my %update_method = ( 'src-git' => { 'init' => "git clone --depth 1 '%s' '%s'", 'init_branch' => "git clone --depth 1 --branch '%s' '%s' '%s'", - 'init_commit' => "git clone '%s' '%s' && cd '%s' && git checkout -b '%s' '%s' && cd -", + 'init_commit' => "git clone --depth 1 '%s' '%s' && cd '%s' && git fetch --depth=1 origin '%s' && git -c advice.detachedHead=false checkout '%s' && cd -", 'update' => "git pull --ff-only", 'update_rebase' => "git pull --rebase=merges", 'update_stash' => "git pull --rebase=merges --autostash", From 9ec32cfb2733856a2ab4caee07d9b3297568381d Mon Sep 17 00:00:00 2001 From: Cedric CHEDALEUX Date: Mon, 17 Feb 2025 10:44:36 +0100 Subject: [PATCH 3/3] scripts/feeds: shallow clone submodules When a feed has submodules, all its submodules are fully cloned whereas the feed itself is shallowed. Let's be consistent and perform shallow clones as well for the submodules. Signed-off-by: Cedric CHEDALEUX Link: https://github.com/openwrt/openwrt/pull/18003 Signed-off-by: Robert Marko --- scripts/feeds | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/feeds b/scripts/feeds index 0ff6765814..959995c7af 100755 --- a/scripts/feeds +++ b/scripts/feeds @@ -162,7 +162,7 @@ my %update_method = ( 'update_rebase' => "git pull --rebase=merges", 'update_stash' => "git pull --rebase=merges --autostash", 'update_force' => "git pull --ff-only || (git reset --hard HEAD; git pull --ff-only; exit 1)", - 'post_update' => "git submodule update --init --recursive", + 'post_update' => "git submodule update --init --recursive --depth 1", 'controldir' => ".git", 'revision' => "git rev-parse HEAD | tr -d '\n'"}, 'src-git-full' => {