diff options
author | Tobias Geerinckx-Rice <me@tobias.gr> | 2023-07-23 02:00:00 +0200 |
---|---|---|
committer | Tobias Geerinckx-Rice <me@tobias.gr> | 2023-07-23 02:00:00 +0200 |
commit | 8244aea1829eec8aa68289d9832e3b77a26fbed9 (patch) | |
tree | 3fcf9b2f8aa149c557c2079b6f5fc9fa6ecfee1f /gnu/packages/patches/curlftpfs-fix-file-names.patch | |
parent | affea88cf5e44b969cf599d310323e5855dadc13 (diff) | |
download | guix-8244aea1829eec8aa68289d9832e3b77a26fbed9.tar.gz guix-8244aea1829eec8aa68289d9832e3b77a26fbed9.zip |
gnu: curlftpfs: Add patches to fix bugs.
* gnu/packages/file-systems.scm (curlftpfs)[source]: Add patches.
* gnu/packages/patches/curlftpfs-fix-error-closing-file.patch,
gnu/packages/patches/curlftpfs-fix-file-names.patch,
gnu/packages/patches/curlftpfs-fix-memory-leak.patch,
gnu/packages/patches/curlftpfs-fix-no_verify_hostname.patch: New files.
* gnu/local.mk (dist_patch_DATA): Add them.
Diffstat (limited to 'gnu/packages/patches/curlftpfs-fix-file-names.patch')
-rw-r--r-- | gnu/packages/patches/curlftpfs-fix-file-names.patch | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/gnu/packages/patches/curlftpfs-fix-file-names.patch b/gnu/packages/patches/curlftpfs-fix-file-names.patch new file mode 100644 index 0000000000..04979a3b0c --- /dev/null +++ b/gnu/packages/patches/curlftpfs-fix-file-names.patch @@ -0,0 +1,76 @@ +From bc3fb45db30741a60d4e8904cbd4d6118fb85741 Mon Sep 17 00:00:00 2001 +From: Joseph Lansdowne <j49137@gmail.com> +Date: Sun, 31 Mar 2019 19:25:26 +0100 +Subject: [PATCH] fix filenames with url-reserved characters + +--- + ChangeLog | 2 +- + path_utils.c | 28 +++++++++++++++++----------- + 2 files changed, 18 insertions(+), 12 deletions(-) + +diff --git a/path_utils.c b/path_utils.c +index db3d7e4..4f747bb 100644 +--- a/path_utils.c ++++ b/path_utils.c +@@ -39,9 +39,11 @@ char* get_full_path(const char* path) { + path = converted_path; + } + +- ret = g_strdup_printf("%s%s", ftpfs.host, path); ++ const char *const escaped_path = g_uri_escape_string(path, "/", FALSE); ++ ret = g_strdup_printf("%s%s", ftpfs.host, escaped_path); + + free(converted_path); ++ free((char *) escaped_path); + + return ret; + } +@@ -58,9 +60,12 @@ char* get_fulldir_path(const char* path) { + path = converted_path; + } + +- ret = g_strdup_printf("%s%s%s", ftpfs.host, path, strlen(path) ? "/" : ""); ++ const char *const escaped_path = g_uri_escape_string(path, "/", FALSE); ++ ret = g_strdup_printf( ++ "%s%s%s", ftpfs.host, escaped_path, strlen(escaped_path) ? "/" : ""); + + free(converted_path); ++ free((char *) escaped_path); + + return ret; + } +@@ -71,24 +76,25 @@ char* get_dir_path(const char* path) { + const char *lastdir; + + ++path; +- +- lastdir = strrchr(path, '/'); +- if (lastdir == NULL) lastdir = path; + +- if (ftpfs.codepage && (lastdir - path > 0)) { +- converted_path = g_strndup(path, lastdir - path); ++ if (ftpfs.codepage) { ++ converted_path = g_strdup(path); + convert_charsets(ftpfs.iocharset, ftpfs.codepage, &converted_path); + path = converted_path; +- lastdir = path + strlen(path); + } + ++ const char *const escaped_path = g_uri_escape_string(path, "/", FALSE); ++ lastdir = strrchr(escaped_path, '/'); ++ if (lastdir == NULL) lastdir = escaped_path; ++ + ret = g_strdup_printf("%s%.*s%s", + ftpfs.host, +- lastdir - path, +- path, +- lastdir - path ? "/" : ""); ++ lastdir - escaped_path, ++ escaped_path, ++ lastdir - escaped_path ? "/" : ""); + + free(converted_path); ++ free((char *) escaped_path); + + return ret; + } |