public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/wget2] rawhide: Backport fix for using -P with absolute paths
@ 2026-10-23 13:10 Artur Frenszek-Iwicki
0 siblings, 0 replies; only message in thread
From: Artur Frenszek-Iwicki @ 2026-10-23 13:10 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/wget2
Branch : rawhide
Commit : caadc402d05af870eb2ab68dc4d9e9ceb22f220f
Author : Artur Frenszek-Iwicki <fedora@svgames.pl>
Date : 2026-10-23T13:07:20+02:00
Stats : +95/-1 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/wget2/c/caadc402d05af870eb2ab68dc4d9e9ceb22f220f?branch=rawhide
Log:
Backport fix for using -P with absolute paths
Solves rhbz#2558146.
---
diff --git a/0000-fix-absolute-paths-with-P-option.patch b/0000-fix-absolute-paths-with-P-option.patch
new file mode 100644
index 0000000..934b4a1
--- /dev/null
+++ b/0000-fix-absolute-paths-with-P-option.patch
@@ -0,0 +1,87 @@
+From acf7f4ecd35e9d353bfb5d3ad216dd5368f1b3d4 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Tim=20R=C3=BChsen?= <tim.ruehsen@gmx.de>
+Date: Fri, 25 Sep 2026 10:04:47 +0200
+Subject: [PATCH] Fix -P/--directory-prefix for absolute paths
+
+* src/options.c (init): Use absolute directory prefix as-is.
+* tests/test-directory-prefix.c: Add test using an absolute directory prefix.
+
+Fixes https://gitlab.com/gnuwget/wget2/-/work_items/723
+---
+ src/options.c | 24 ++++++++++++++++--------
+ tests/test-directory-prefix.c | 21 +++++++++++++++++++++
+ 2 files changed, 37 insertions(+), 8 deletions(-)
+
+diff --git a/src/options.c b/src/options.c
+index dc001f795..8eb85a7e0 100644
+--- a/src/options.c
++++ b/src/options.c
+@@ -3569,14 +3569,22 @@ int init(int argc, const char **argv)
+ debug_printf("Input URI encoding = '%s'\n", config.input_encoding);
+
+ if (config.directory_prefix) {
+- char *cwd = getcwd(NULL, 0);
+- if (!cwd) {
+- error_printf_exit(_("Failed to get current directory\n"));
+- }
+- char *unresolved_path = wget_aprintf("%s/%s", cwd, config.directory_prefix);
+- xfree(cwd);
+- char *resolved_path = wget_path_sanitize(unresolved_path);
+- xfree(unresolved_path);
++ char *resolved_path = NULL;
++
++ // If directory_prefix is an absolute path, don't prepend cwd
++ if (config.directory_prefix[0] == '/') {
++ resolved_path = wget_path_sanitize(config.directory_prefix);
++ } else {
++ char *cwd = getcwd(NULL, 0);
++ if (!cwd) {
++ error_printf_exit(_("Failed to get current directory\n"));
++ }
++ char *unresolved_path = wget_aprintf("%s/%s", cwd, config.directory_prefix);
++ xfree(cwd);
++ resolved_path = wget_path_sanitize(unresolved_path);
++ xfree(unresolved_path);
++ }
++
+ if (resolved_path) {
+ xfree(config.directory_prefix);
+ config.directory_prefix = resolved_path;
+diff --git a/tests/test-directory-prefix.c b/tests/test-directory-prefix.c
+index b1b271736..57c52cbb5 100644
+--- a/tests/test-directory-prefix.c
++++ b/tests/test-directory-prefix.c
+@@ -23,6 +23,7 @@
+ #include <config.h>
+
+ #include <stdlib.h> // exit()
++#include <unistd.h> // getcwd()
+ #include "libtest.h"
+
+ #define PREFIX "prefix"
+@@ -98,5 +99,25 @@ int main(void)
+ { NULL } },
+ 0);
+
++ // Test absolute directory-prefix path
++ {
++ char cwd[4096];
++ if (!getcwd(cwd, sizeof(cwd))) {
++ wget_error_printf_exit("Failed to get cwd\n");
++ }
++
++ char abs_opt[4096];
++ wget_snprintf(abs_opt, sizeof(abs_opt), "--directory-prefix=%s/abs_prefix -nH", cwd);
++
++ wget_test(
++ WGET_TEST_OPTIONS, abs_opt,
++ WGET_TEST_REQUEST_URL, "index.html",
++ WGET_TEST_EXPECTED_ERROR_CODE, 0,
++ WGET_TEST_EXPECTED_FILES, &(wget_test_file_t []) {
++ { "abs_prefix/index.html", urls[0].body },
++ { NULL } },
++ 0);
++ }
++
+ exit(EXIT_SUCCESS);
+ }
diff --git a/wget2.spec b/wget2.spec
index 32e3ab8..64dbf3c 100644
--- a/wget2.spec
+++ b/wget2.spec
@@ -8,7 +8,7 @@
Name: wget2
Version: 2.3.0
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: An advanced file and recursive website downloader
# Documentation is GFDL
@@ -19,6 +19,10 @@ Source1: https://ftp.gnu.org/gnu/wget/%{name}-%{version}.tar.gz.sig
# key 08302DB6A2670428
Source2: tim.ruehsen-keyring.asc
+# Fix using absolute paths with -P option (rhbz#2558146)
+# Backport from upstream: https://github.com/rockdaboot/wget2/commit/acf7f4ecd35e9d353bfb5d3ad216dd5368f1b3d4
+Patch0: 0000-fix-absolute-paths-with-P-option.patch
+
# Buildsystem build requirements
BuildRequires: autoconf
BuildRequires: automake
@@ -179,6 +183,9 @@ echo ".so man1/%{name}.1" > %{buildroot}%{_mandir}/man1/wget.1
%changelog
+* Fri Oct 23 2026 Artur Frenszek-Iwicki <fedora@svgames.pl> - 2.3.0-2
+- Backport fix for using -P with absolute paths (rhbz#2558146)
+
* Mon Oct 05 2026 Artur Frenszek-Iwicki <fedora@svgames.pl> - 2.3.0-1
- Update to v2.3.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-23 13:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-23 13:10 [rpms/wget2] rawhide: Backport fix for using -P with absolute paths Artur Frenszek-Iwicki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox