Files
haikuports/net-misc/wget/patches/wget-1.20.1.patchset
2019-03-30 15:31:40 +01:00

670 lines
17 KiB
Plaintext

From d0412fae5979853cdfb405ff8dfd278f2f5eb2d0 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Mon, 19 May 2014 15:38:37 +0000
Subject: apply wget-1.14.patch
diff --git a/configure.ac b/configure.ac
index 167882f..12e362d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -254,6 +254,7 @@ AC_HEADER_STDBOOL
AC_CHECK_HEADERS(unistd.h sys/time.h)
AC_CHECK_HEADERS(termios.h sys/ioctl.h sys/select.h utime.h sys/utime.h)
AC_CHECK_HEADERS(stdint.h inttypes.h pwd.h wchar.h dlfcn.h)
+AC_CHECK_HEADERS(arpa/inet.h)
AC_CHECK_DECLS(h_errno,,,[#include <netdb.h>])
@@ -321,6 +322,9 @@ dnl
PKG_PROG_PKG_CONFIG
+AC_CHECK_LIB(network, gethostbyname)
+AC_CHECK_LIB(network, socket)
+
AS_IF([test "x$with_libpsl" != xno], [
PKG_CHECK_MODULES([LIBPSL], libpsl, [
with_libpsl=yes
diff --git a/src/config.h.in b/src/config.h.in
index b4673c9..fdd6d63 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -920,6 +920,9 @@
/* Define if libcares is available. */
#undef HAVE_LIBCARES
+/* Define to 1 if you have the `bind' library (-lbind). */
+#undef HAVE_LIBBIND
+
/* Define to 1 if you have the `dl' library (-ldl). */
#undef HAVE_LIBDL
@@ -932,6 +935,9 @@
/* Define to 1 if you have the <libintl.h> header file. */
#undef HAVE_LIBINTL_H
+/* Define to 1 if you have the `network' library (-lnetwork). */
+#undef HAVE_LIBNETWORK
+
/* Define if libpcre is available. */
#undef HAVE_LIBPCRE
diff --git a/src/connect.c b/src/connect.c
index 37dae21..460260d 100644
--- a/src/connect.c
+++ b/src/connect.c
@@ -45,7 +45,7 @@ as that of the covered work. */
# include <netdb.h>
# endif /* def __VMS [else] */
# include <netinet/in.h>
-# ifndef __BEOS__
+# ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
# endif
#endif /* not WINDOWS */
diff --git a/src/host.h b/src/host.h
index 042d44d..e33b651 100644
--- a/src/host.h
+++ b/src/host.h
@@ -40,9 +40,9 @@ as that of the covered work. */
# endif /* def __VMS [else] */
# include <sys/socket.h>
# include <netinet/in.h>
-#ifndef __BEOS__
-# include <arpa/inet.h>
-#endif
+# ifdef HAVE_ARPA_INET_H
+# include <arpa/inet.h>
+# endif
#endif
struct url;
--
2.19.1
From c441738ed448186b57c2309c8c59b2fb0716f5a6 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Mon, 19 May 2014 15:47:24 +0000
Subject: apply and augment wget-1.14-build-fixes.patch
diff --git a/src/utils.c b/src/utils.c
index 2289a47..7f7e294 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -59,7 +59,9 @@ as that of the covered work. */
/* For TIOCGWINSZ and friends: */
#ifndef WINDOWS
+#ifndef __HAIKU__
# include <sys/ioctl.h>
+#endif
# include <termios.h>
#endif
--
2.19.1
From 2f23d2f6f5489397355807aa21b23a8456643a0d Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sun, 14 Feb 2016 11:05:10 +0100
Subject: Move wget-hsts out of home directory.
diff --git a/src/main.c b/src/main.c
index 4408ffb..5bb1910 100644
--- a/src/main.c
+++ b/src/main.c
@@ -87,6 +87,10 @@ as that of the covered work. */
# include "vms.h"
#endif /* __VMS */
+#ifdef __HAIKU__
+#include "FindDirectory.h"
+#endif
+
#ifndef PATH_SEPARATOR
# define PATH_SEPARATOR '/'
#endif
@@ -175,6 +179,16 @@ get_hsts_database (void)
if (opt.hsts_file)
return xstrdup (opt.hsts_file);
+#ifdef __HAIKU__
+ {
+ char buffer[256];
+ if (find_directory(B_USER_SETTINGS_DIRECTORY, 0, false, buffer, sizeof(buffer)) == B_OK) {
+ opt.homedir = aprintf("%s/wget-hsts", buffer);
+ return opt.homedir;
+ }
+ }
+#endif
+
if (opt.homedir)
{
char *dir = aprintf ("%s/.wget-hsts", opt.homedir);
--
2.19.1
From 9ecdcc7d352a5c6233de87634a55127a60b6fabf Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Mon, 22 May 2017 18:46:27 +0200
Subject: gcc2 patch
diff --git a/src/init.c b/src/init.c
index 51b6361..bb36a14 100644
--- a/src/init.c
+++ b/src/init.c
@@ -894,7 +894,7 @@ setval_internal (int comind, const char *com, const char *val)
assert (0 <= comind && ((size_t) comind) < countof (commands));
if ((unsigned) comind >= countof (commands))
- return NULL;
+ return false;
DEBUGP (("Setting %s (%s) to %s\n", com, commands[comind].name, val));
return commands[comind].action (com, val, commands[comind].place);
--
2.19.1
From 5960501f289248ff8479488980e50bab9ea85037 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Thu, 23 Nov 2017 09:09:48 +0100
Subject: Handle SSL_ERROR_WANT_READ.
According to OpenSSL docs this isn't supposed to happen, but it does
and I can't figure out where it would be intercepted in OpenSSL side.
So let's just handle it and retry reads when requestred to do so.
This allows EINTR detection to work, so no error happens when you
resize terminal anymore.
diff --git a/src/openssl.c b/src/openssl.c
index 73e7f0f..b4793cc 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -412,9 +412,11 @@ static void openssl_read_callback(void *arg)
int bufsize = args->bufsize;
int ret;
- do
+ do {
ret = SSL_read (conn, buf, bufsize);
- while (ret == -1 && SSL_get_error (conn, ret) == SSL_ERROR_SYSCALL
+ } while (ret == -1
+ && (SSL_get_error (conn, ret) == SSL_ERROR_SYSCALL
+ || SSL_get_error (conn, ret) == SSL_ERROR_WANT_READ)
&& errno == EINTR);
args->retval = ret;
}
--
2.19.1
From e109c014ad8ac5a54b4892c6223e3c79f43a3f48 Mon Sep 17 00:00:00 2001
From: Crestwave <crest.wave@yahoo.com>
Date: Sun, 25 Nov 2018 12:01:08 +0000
Subject: Also move wget-hsts out of the home directory in hsts.c.
diff --git a/src/hsts.c b/src/hsts.c
index 64149e4..697bb25 100644
--- a/src/hsts.c
+++ b/src/hsts.c
@@ -48,6 +48,10 @@ as that of the covered work. */
#include <stdio.h>
#include <sys/file.h>
+#ifdef __HAIKU__
+#include "FindDirectory.h"
+#endif
+
struct hsts_store {
struct hash_table *table;
time_t last_mtime;
@@ -627,6 +631,16 @@ get_hsts_store_filename (void)
char *filename = NULL;
FILE *fp = NULL;
+#ifdef __HAIKU__
+ {
+ char buffer[256];
+ if (find_directory(B_USER_SETTINGS_DIRECTORY, 0, false, buffer, sizeof(buffer)) == B_OK) {
+ opt.homedir = aprintf("%s/wget-hsts", buffer);
+ return opt.homedir;
+ }
+ }
+#endif
+
if (opt.homedir)
{
filename = aprintf ("%s/.wget-hsts-test", opt.homedir);
--
2.19.1
From a2ee5521e8cb02244dfdac1fd3eb54978c77d9d9 Mon Sep 17 00:00:00 2001
From: Crestwave <crest.wave@yahoo.com>
Date: Sun, 25 Nov 2018 11:15:19 +0000
Subject: Remove -ldl flag from ld.
diff --git a/fuzz/Makefile.am b/fuzz/Makefile.am
index a6d4b67..a937bb5 100644
--- a/fuzz/Makefile.am
+++ b/fuzz/Makefile.am
@@ -5,8 +5,7 @@ LDADD = ../lib/libgnu.a \
$(GETADDRINFO_LIB) $(HOSTENT_LIB) $(INET_NTOP_LIB) $(INET_PTON_LIB) \
$(LIBSOCKET) $(LIB_CLOCK_GETTIME) $(LIB_CRYPTO) $(LIB_GETLOGIN) $(LIB_NANOSLEEP) $(LIB_POLL) \
$(LIB_POSIX_SPAWN) $(LIB_PTHREAD_SIGMASK) $(LIB_SELECT) $(LIBICONV) $(LIBINTL) \
- $(LIBMULTITHREAD) $(LIBTHREAD) $(SERVENT_LIB) @INTL_MACOSX_LIBS@ \
- -ldl
+ $(LIBMULTITHREAD) $(LIBTHREAD) $(SERVENT_LIB) @INTL_MACOSX_LIBS@
WGET_TESTS = \
wget_css_fuzzer$(EXEEXT) \
diff --git a/fuzz/Makefile.in b/fuzz/Makefile.in
index 7ecc25b..ad7b1fd 100644
--- a/fuzz/Makefile.in
+++ b/fuzz/Makefile.in
@@ -1665,7 +1665,7 @@ LDADD = ../lib/libgnu.a $(GETADDRINFO_LIB) $(HOSTENT_LIB) \
$(LIB_NANOSLEEP) $(LIB_POLL) $(LIB_POSIX_SPAWN) \
$(LIB_PTHREAD_SIGMASK) $(LIB_SELECT) $(LIBICONV) $(LIBINTL) \
$(LIBMULTITHREAD) $(LIBTHREAD) $(SERVENT_LIB) \
- @INTL_MACOSX_LIBS@ -ldl $(am__append_1)
+ @INTL_MACOSX_LIBS@ $(am__append_1)
WGET_TESTS = \
wget_css_fuzzer$(EXEEXT) \
wget_cookie_fuzzer$(EXEEXT) \
--
2.19.1
From 0a506c368971850477120c71ab16a02d2ac38da1 Mon Sep 17 00:00:00 2001
From: Crestwave <crest.wave@yahoo.com>
Date: Mon, 26 Nov 2018 07:13:07 +0000
Subject: Fix segmentation violation when executing fuzzers.
diff --git a/fuzz/wget_cookie_fuzzer.c b/fuzz/wget_cookie_fuzzer.c
index 121e2e2..40882f6 100644
--- a/fuzz/wget_cookie_fuzzer.c
+++ b/fuzz/wget_cookie_fuzzer.c
@@ -56,6 +56,7 @@ FILE *fopen_wgetrc(const char *pathname, const char *mode)
return NULL;
}
+#ifndef __HAIKU__
#ifdef FUZZING
void exit_wget(int status)
{
@@ -65,6 +66,7 @@ void exit(int status)
{
}
#endif
+#endif
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
diff --git a/fuzz/wget_css_fuzzer.c b/fuzz/wget_css_fuzzer.c
index bcdeb5e..f7600d4 100644
--- a/fuzz/wget_css_fuzzer.c
+++ b/fuzz/wget_css_fuzzer.c
@@ -68,6 +68,7 @@ FILE *fopen_wgetrc(const char *pathname, const char *mode)
}
static jmp_buf jmpbuf;
+#ifndef __HAIKU__
#ifdef FUZZING
void exit_wget(int status)
{
@@ -79,6 +80,7 @@ void exit(int status)
longjmp(jmpbuf, 1);
}
#endif
+#endif
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
diff --git a/fuzz/wget_ftpls_fuzzer.c b/fuzz/wget_ftpls_fuzzer.c
index 138a549..2c04ed0 100644
--- a/fuzz/wget_ftpls_fuzzer.c
+++ b/fuzz/wget_ftpls_fuzzer.c
@@ -59,6 +59,7 @@ FILE *fopen_wgetrc(const char *pathname, const char *mode)
return NULL;
}
+#ifndef __HAIKU__
#ifdef FUZZING
void exit_wget(int status)
{
@@ -68,6 +69,7 @@ void exit(int status)
{
}
#endif
+#endif
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
diff --git a/fuzz/wget_html_fuzzer.c b/fuzz/wget_html_fuzzer.c
index a6c4fdc..dcb9929 100644
--- a/fuzz/wget_html_fuzzer.c
+++ b/fuzz/wget_html_fuzzer.c
@@ -68,6 +68,7 @@ FILE *fopen_wgetrc(const char *pathname, const char *mode)
#endif
}
+#ifndef __HAIKU__
#ifdef FUZZING
void exit_wget(int status)
{
@@ -77,6 +78,7 @@ void exit(int status)
{
}
#endif
+#endif
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
diff --git a/fuzz/wget_netrc_fuzzer.c b/fuzz/wget_netrc_fuzzer.c
index 97d472e..9f6abbe 100644
--- a/fuzz/wget_netrc_fuzzer.c
+++ b/fuzz/wget_netrc_fuzzer.c
@@ -56,6 +56,7 @@ FILE *fopen_wgetrc(const char *pathname, const char *mode)
return NULL;
}
+#ifndef __HAIKU__
#ifdef FUZZING
void exit_wget(int status)
{
@@ -65,6 +66,7 @@ void exit(int status)
{
}
#endif
+#endif
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
diff --git a/fuzz/wget_options_fuzzer.c b/fuzz/wget_options_fuzzer.c
index d3dcaff..c62a3e4 100644
--- a/fuzz/wget_options_fuzzer.c
+++ b/fuzz/wget_options_fuzzer.c
@@ -61,6 +61,7 @@ FILE *fopen_wgetrc(const char *pathname, const char *mode)
}
static jmp_buf jmpbuf;
+#ifndef __HAIKU__
#ifdef FUZZING
void exit_wget(int status)
{
@@ -72,6 +73,7 @@ void exit(int status)
longjmp(jmpbuf, 1);
}
#endif
+#endif
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
diff --git a/fuzz/wget_robots_fuzzer.c b/fuzz/wget_robots_fuzzer.c
index e6b3bd1..c284990 100644
--- a/fuzz/wget_robots_fuzzer.c
+++ b/fuzz/wget_robots_fuzzer.c
@@ -59,6 +59,7 @@ FILE *fopen_wgetrc(const char *pathname, const char *mode)
return NULL;
}
+#ifndef __HAIKU__
#ifdef FUZZING
void exit_wget(int status)
{
@@ -68,6 +69,7 @@ void exit(int status)
{
}
#endif
+#endif
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
diff --git a/fuzz/wget_url_fuzzer.c b/fuzz/wget_url_fuzzer.c
index ad05ff8..a0f002e 100644
--- a/fuzz/wget_url_fuzzer.c
+++ b/fuzz/wget_url_fuzzer.c
@@ -56,6 +56,7 @@ FILE *fopen_wgetrc(const char *pathname, const char *mode)
return NULL;
}
+#ifndef __HAIKU__
#ifdef FUZZING
void exit_wget(int status)
{
@@ -65,6 +66,7 @@ void exit(int status)
{
}
#endif
+#endif
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
--
2.19.1
From b9befb372eb213bd5f24ebe35d09ec672f5e7754 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sat, 30 Mar 2019 14:19:17 +0100
Subject: gcc2 patch for version 1.20.1
diff --git a/lib/md5.c b/lib/md5.c
index 554d421..7f693f6 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -144,19 +144,20 @@ md5_finish_ctx (struct md5_ctx *ctx, void *resbuf)
int
md5_stream (FILE *stream, void *resblock)
{
+ char *buffer;
+ struct md5_ctx ctx;
+ size_t sum;
switch (afalg_stream (stream, "md5", resblock, MD5_DIGEST_SIZE))
{
case 0: return 0;
case -EIO: return 1;
}
- char *buffer = malloc (BLOCKSIZE + 72);
+ buffer = malloc (BLOCKSIZE + 72);
if (!buffer)
return 1;
- struct md5_ctx ctx;
md5_init_ctx (&ctx);
- size_t sum;
/* Iterate over full file contents. */
while (1)
diff --git a/lib/mktime.c b/lib/mktime.c
index 557712f..5e5b097 100644
--- a/lib/mktime.c
+++ b/lib/mktime.c
@@ -528,8 +528,9 @@ mktime (struct tm *tp)
__tzset ();
# if defined _LIBC || NEED_MKTIME_WORKING
- static mktime_offset_t localtime_offset;
+{ static mktime_offset_t localtime_offset;
return __mktime_internal (tp, __localtime_r, &localtime_offset);
+}
# else
# undef mktime
return mktime (tp);
diff --git a/lib/regexec.c b/lib/regexec.c
index 8b82ea5..efabb42 100644
--- a/lib/regexec.c
+++ b/lib/regexec.c
@@ -3293,6 +3293,7 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state)
re_node_set follows, *dests_node;
bitset_t *dests_ch;
bitset_t acceptable;
+ size_t ndests_max;
struct dests_alloc
{
@@ -3343,7 +3344,7 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state)
goto out_free;
/* Avoid arithmetic overflow in size calculation. */
- size_t ndests_max
+ ndests_max
= ((SIZE_MAX - (sizeof (re_node_set) + sizeof (bitset_t)) * SBC_MAX)
/ (3 * sizeof (re_dfastate_t *)));
if (__glibc_unlikely (ndests_max < ndests))
diff --git a/lib/sha1.c b/lib/sha1.c
index cd79dfa..7ee2def 100644
--- a/lib/sha1.c
+++ b/lib/sha1.c
@@ -132,19 +132,20 @@ sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf)
int
sha1_stream (FILE *stream, void *resblock)
{
+ char *buffer;
+ struct sha1_ctx ctx;
+ size_t sum;
switch (afalg_stream (stream, "sha1", resblock, SHA1_DIGEST_SIZE))
{
case 0: return 0;
case -EIO: return 1;
}
- char *buffer = malloc (BLOCKSIZE + 72);
+ buffer = malloc (BLOCKSIZE + 72);
if (!buffer)
return 1;
- struct sha1_ctx ctx;
sha1_init_ctx (&ctx);
- size_t sum;
/* Iterate over full file contents. */
while (1)
diff --git a/lib/sha256.c b/lib/sha256.c
index c518517..9dcde43 100644
--- a/lib/sha256.c
+++ b/lib/sha256.c
@@ -182,19 +182,20 @@ shaxxx_stream (FILE *stream, char const *alg, void *resblock,
ssize_t hashlen, void (*init_ctx) (struct sha256_ctx *),
void *(*finish_ctx) (struct sha256_ctx *, void *))
{
+ char *buffer;
+ struct sha256_ctx ctx;
+ size_t sum;
switch (afalg_stream (stream, alg, resblock, hashlen))
{
case 0: return 0;
case -EIO: return 1;
}
- char *buffer = malloc (BLOCKSIZE + 72);
+ buffer = malloc (BLOCKSIZE + 72);
if (!buffer)
return 1;
- struct sha256_ctx ctx;
init_ctx (&ctx);
- size_t sum;
/* Iterate over full file contents. */
while (1)
diff --git a/lib/sha512.c b/lib/sha512.c
index e854951..609066d 100644
--- a/lib/sha512.c
+++ b/lib/sha512.c
@@ -183,19 +183,20 @@ shaxxx_stream (FILE *stream, char const *alg, void *resblock,
ssize_t hashlen, void (*init_ctx) (struct sha512_ctx *),
void *(*finish_ctx) (struct sha512_ctx *, void *))
{
+ char *buffer;
+ struct sha512_ctx ctx;
+ size_t sum;
switch (afalg_stream (stream, alg, resblock, hashlen))
{
case 0: return 0;
case -EIO: return 1;
}
- char *buffer = malloc (BLOCKSIZE + 72);
+ buffer = malloc (BLOCKSIZE + 72);
if (!buffer)
return 1;
- struct sha512_ctx ctx;
init_ctx (&ctx);
- size_t sum;
/* Iterate over full file contents. */
while (1)
diff --git a/src/ftp.c b/src/ftp.c
index 6b8bdf8..d27e407 100644
--- a/src/ftp.c
+++ b/src/ftp.c
@@ -2572,6 +2572,8 @@ ftp_retrieve_glob (struct url *u, struct url *original_url,
{
struct fileinfo *f, *start;
uerr_t res;
+ int (*matcher) (const char *, const char *, int);
+ int (*cmp) (const char *, const char *);
con->cmd |= LEAVE_PENDING;
@@ -2580,7 +2582,7 @@ ftp_retrieve_glob (struct url *u, struct url *original_url,
return res;
// Set the function used for glob matching.
- int (*matcher) (const char *, const char *, int)
+ matcher
= opt.ignore_case ? fnmatch_nocase : fnmatch;
// Set the function used to compare strings
@@ -2594,10 +2596,10 @@ ftp_retrieve_glob (struct url *u, struct url *original_url,
* the senseless type cast clears the complaint, and looks
* harmless.
*/
- int (*cmp) (const char *, const char *)
+ cmp
= opt.ignore_case ? strcasecmp : (int (*)())strcmp;
#else /* def __VMS */
- int (*cmp) (const char *, const char *)
+ cmp
= opt.ignore_case ? strcasecmp : strcmp;
#endif /* def __VMS [else] */
diff --git a/src/main.c b/src/main.c
index 5bb1910..d357e32 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1372,11 +1372,12 @@ main (int argc, char **argv)
bool use_userconfig = false;
bool noconfig = false;
bool append_to_log = false;
+ double start_time;
cleaned_up = 0; /* do cleanup later */
timer = ptimer_new ();
- double start_time = ptimer_measure (timer);
+ start_time = ptimer_measure (timer);
total_downloaded_bytes = 0;
program_name = argv[0];
--
2.19.1