Re: [pacman-dev] [PATCH rebased 1/1] Introduce a 'stupid-proxy' option
Martin Kühneon Fri, 2016/11/11 22:26: > Without intending to come across as overly sensitive, but does it have > to be called stupidproxy? > > cheers! > mar77i That originates from Allan's comment [0] about his intention to accept a "--stupid-proxy" flag. I am happy with what ever name Allan decides to choose. ;) [0] https://bugs.archlinux.org/task/50368#comment149944 -- main(a){char*c=/*Schoene Gruesse */"B?IJj;MEH" "CX:;",b;for(a/*Best regards my address:*/=0;b=c[a++];) putchar(b-1/(/*Chriscc -ox -xc - && ./x*/b/42*2-3)*42);} pgpcyUXXJVvi3.pgp Description: OpenPGP digital signature
Re: [pacman-dev] [PATCH rebased 1/1] Introduce a 'stupid-proxy' option
Without intending to come across as overly sensitive, but does it have to be called stupidproxy? cheers! mar77i
[pacman-dev] [PATCH rebased 1/1] Introduce a 'stupid-proxy' option
From: Christian HesseAdd command line option ('--stupid-proxy') and config file option ('StupidProxy') to disable defaults for low speed limit and timeout on downloads. Use this if you have issues downloading files with proxy and/or security gateway. Signed-off-by: Christian Hesse --- doc/pacman.8.txt | 4 doc/pacman.conf.5.txt | 4 lib/libalpm/alpm.h| 2 ++ lib/libalpm/dload.c | 6 -- lib/libalpm/handle.c | 10 ++ lib/libalpm/handle.h | 1 + src/pacman/conf.c | 4 src/pacman/conf.h | 4 +++- src/pacman/pacman.c | 5 + 9 files changed, 37 insertions(+), 3 deletions(-) diff --git a/doc/pacman.8.txt b/doc/pacman.8.txt index 0fa727e..bb05fc6 100644 --- a/doc/pacman.8.txt +++ b/doc/pacman.8.txt @@ -193,6 +193,10 @@ Options *\--confirm*:: Cancels the effects of a previous '\--noconfirm'. +*\--stupid-proxy*:: + Disable defaults for low speed limit and timeout on downloads. Use this + if you have issues downloading files with proxy and/or security gateway. + Transaction Options (apply to '-S', '-R' and '-U') -- diff --git a/doc/pacman.conf.5.txt b/doc/pacman.conf.5.txt index c665870..3d2ce31 100644 --- a/doc/pacman.conf.5.txt +++ b/doc/pacman.conf.5.txt @@ -209,6 +209,10 @@ Options Displays name, version and size of target packages formatted as a table for upgrade, sync and remove operations. +*StupidProxy*:: + Disable defaults for low speed limit and timeout on downloads. Use this + if you have issues downloading files with proxy and/or security gateway. + Repository Sections --- diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 2d2491d..4aff800 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -926,6 +926,8 @@ int alpm_option_set_local_file_siglevel(alpm_handle_t *handle, int level); int alpm_option_get_remote_file_siglevel(alpm_handle_t *handle); int alpm_option_set_remote_file_siglevel(alpm_handle_t *handle, int level); +int alpm_option_set_stupidproxy(alpm_handle_t *handle, unsigned short stupidproxy); + /** @} */ /** @addtogroup alpm_api_databases Database Functions diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index 9d80358..f3f0f68 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -305,8 +305,10 @@ static void curl_set_handle_opts(struct dload_payload *payload, curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, dload_progress_cb); curl_easy_setopt(curl, CURLOPT_XFERINFODATA, (void *)payload); - curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 1L); - curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, 10L); + if(!handle->stupidproxy) { + curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 1L); + curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, 10L); + } curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, dload_parseheader_cb); curl_easy_setopt(curl, CURLOPT_WRITEHEADER, (void *)payload); curl_easy_setopt(curl, CURLOPT_NETRC, CURL_NETRC_OPTIONAL); diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c index 28e8148..a387ee6 100644 --- a/lib/libalpm/handle.c +++ b/lib/libalpm/handle.c @@ -844,4 +844,14 @@ int SYMEXPORT alpm_option_get_remote_file_siglevel(alpm_handle_t *handle) } } +int SYMEXPORT alpm_option_set_stupidproxy(alpm_handle_t *handle, + unsigned short stupidproxy) +{ + CHECK_HANDLE(handle, return -1); +#ifdef HAVE_LIBCURL + handle->stupidproxy = stupidproxy; +#endif + return 0; +} + /* vim: set noet: */ diff --git a/lib/libalpm/handle.h b/lib/libalpm/handle.h index 652f17d..be7ff78 100644 --- a/lib/libalpm/handle.h +++ b/lib/libalpm/handle.h @@ -60,6 +60,7 @@ struct __alpm_handle_t { #ifdef HAVE_LIBCURL /* libcurl handle */ CURL *curl; /* reusable curl_easy handle */ + unsigned short stupidproxy; #endif #ifdef HAVE_LIBGPGME diff --git a/src/pacman/conf.c b/src/pacman/conf.c index d8d64fb..0fb7e7a 100644 --- a/src/pacman/conf.c +++ b/src/pacman/conf.c @@ -498,6 +498,8 @@ static int _parse_options(const char *key, char *value, config->color = isatty(fileno(stdout)) ? PM_COLOR_ON : PM_COLOR_OFF; enable_colors(config->color); } + } else if(strcmp(key, "StupidProxy") == 0) { + config->stupidproxy = 1; } else { pm_printf(ALPM_LOG_WARNING, _("config file %s, line %d: directive '%s' in section '%s' not recognized.\n"), @@ -815,6 +817,8 @@ static int setup_libalpm(void) alpm_option_set_noupgrades(handle, config->noupgrade); alpm_option_set_noextracts(handle, config->noextract); +
[pacman-dev] [PATCH rebased v6 1/2] Add configuration options for libcurl's "low speed" timeout
From: Christian HesseAdd LowSpeedLimit and LowSpeedTime configuration options to correspond to libcurl's CURLOPT_LOW_SPEED_LIMIT and CURLOPT_LOW_SPEED_TIME options. This allows, e.g., transfers behind corporate virus-scanning firewalls to survive the delays. Increasing the timeout may not be desirable in all situations; similarly, disabling the check prevents detection of disappearing networks. Adds a utility function, parse_positive_long(), which yields a positive (but not unsigned) long integer from a null-terminated string using strtol(). A string containing anything but a base-10 number will cause the function to return -1. Original-Patch-by: Andrew Hills Signed-off-by: Christian Hesse --- doc/pacman.conf.5.txt | 12 etc/pacman.conf.in| 4 lib/libalpm/alpm.h| 10 ++ lib/libalpm/dload.c | 4 ++-- lib/libalpm/handle.c | 32 lib/libalpm/handle.h | 9 + src/pacman/conf.c | 24 src/pacman/conf.h | 4 src/pacman/util.c | 19 +++ src/pacman/util.h | 1 + 10 files changed, 117 insertions(+), 2 deletions(-) diff --git a/doc/pacman.conf.5.txt b/doc/pacman.conf.5.txt index c665870..2346331 100644 --- a/doc/pacman.conf.5.txt +++ b/doc/pacman.conf.5.txt @@ -209,6 +209,18 @@ Options Displays name, version and size of target packages formatted as a table for upgrade, sync and remove operations. +*LowSpeedLimit* = speed:: +Sets the speed in bytes per second that a download should be below during +`LowSpeedTime` seconds to abort the transfer for being too slow. Setting +'speed' to 0 will disable the speed check. Defaults to 1 byte per second. +Note that this option will not affect external programs specified by +`XferCommand`. + +*LowSpeedTime* = time:: +Sets the time in seconds that a download should be below the `LowSpeedLimit` +transfer speed to abort the transfer for being too slow. Setting 'time' to +0 will disable the speed check. Defaults to 10 seconds. Note that this +option will not affect external programs specified by `XferCommand`. Repository Sections --- diff --git a/etc/pacman.conf.in b/etc/pacman.conf.in index 53071e5..ddc7397 100644 --- a/etc/pacman.conf.in +++ b/etc/pacman.conf.in @@ -29,6 +29,10 @@ Architecture = auto #NoUpgrade = #NoExtract = +# Downloader options +#LowSpeedLimit = 1 +#LowSpeedTime = 10 + # Misc options #UseSyslog #Color diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 2d2491d..bea79da 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -812,6 +812,16 @@ const char *alpm_option_get_dbpath(alpm_handle_t *handle); /** Get the name of the database lock file. Read-only. */ const char *alpm_option_get_lockfile(alpm_handle_t *handle); +/** Returns the libcurl low speed limit in bytes per second. */ +long alpm_option_get_download_lowspeedlimit(alpm_handle_t *handle); +/** Sets the libcurl low speed limit in bytes per second. */ +int alpm_option_set_download_lowspeedlimit(alpm_handle_t *handle, long lowspeedlimit); + +/** Returns the libcurl low speed time in seconds. */ +long alpm_option_get_download_lowspeedtime(alpm_handle_t *handle); +/** Sets the libcurl low speed time in seconds. */ +int alpm_option_set_download_lowspeedtime(alpm_handle_t *handle, long lowspeedtime); + /** @name Accessors to the list of package cache directories. * @{ */ diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index 9d80358..c3bb200 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -305,8 +305,8 @@ static void curl_set_handle_opts(struct dload_payload *payload, curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, dload_progress_cb); curl_easy_setopt(curl, CURLOPT_XFERINFODATA, (void *)payload); - curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 1L); - curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, 10L); + curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, handle->download.lowspeedlimit); + curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, handle->download.lowspeedtime); curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, dload_parseheader_cb); curl_easy_setopt(curl, CURLOPT_WRITEHEADER, (void *)payload); curl_easy_setopt(curl, CURLOPT_NETRC, CURL_NETRC_OPTIONAL); diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c index 28e8148..6479798 100644 --- a/lib/libalpm/handle.c +++ b/lib/libalpm/handle.c @@ -247,6 +247,18 @@ const char SYMEXPORT *alpm_option_get_lockfile(alpm_handle_t *handle) return handle->lockfile; } +long SYMEXPORT alpm_option_get_download_lowspeedlimit(alpm_handle_t *handle) +{ + CHECK_HANDLE(handle, return -1); + return handle->download.lowspeedlimit; +} + +long SYMEXPORT alpm_option_get_download_lowspeedtime(alpm_handle_t
[pacman-dev] [PATCH rebased v6 2/2] add command line options for libcurl's "low speed" timeout
From: Christian HesseSigned-off-by: Christian Hesse --- doc/pacman.8.txt| 13 + src/pacman/conf.h | 4 +++- src/pacman/pacman.c | 14 ++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/doc/pacman.8.txt b/doc/pacman.8.txt index 0fa727e..0eda4fb 100644 --- a/doc/pacman.8.txt +++ b/doc/pacman.8.txt @@ -266,6 +266,19 @@ Upgrade Options (apply to '-S' and '-U')[[UO]] *\--needed*:: Do not reinstall the targets that are already up-to-date. +*\--lowspeedlimit* :: +Sets the speed in bytes per second that a download should be below during +`LowSpeedTime` seconds to abort the transfer for being too slow. Setting +'speed' to 0 will disable the speed check. Defaults to 1 byte per second. +Note that this option will not affect external programs specified by +`XferCommand`. + +*\--lowspeedlimit* :: +Sets the time in seconds that a download should be below the `LowSpeedLimit` +transfer speed to abort the transfer for being too slow. Setting 'time' to +0 will disable the speed check. Defaults to 10 seconds. Note that this +option will not affect external programs specified by `XferCommand`. + Query Options (apply to '-Q')[[QO]] --- diff --git a/src/pacman/conf.h b/src/pacman/conf.h index 17e5f27..9b77238 100644 --- a/src/pacman/conf.h +++ b/src/pacman/conf.h @@ -207,7 +207,9 @@ enum { OP_VERBOSE, OP_DOWNLOADONLY, OP_REFRESH, - OP_ASSUMEINSTALLED + OP_ASSUMEINSTALLED, + OP_LOWSPEEDLIMIT, + OP_LOWSPEEDTIME }; /* clean method */ diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index be52d1b..f6a5f33 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -194,6 +194,12 @@ static void usage(int op, const char * const myname) addlist(_(" --ignoreignore a package upgrade (can be used more than once)\n")); addlist(_(" --ignoregroup \n" " ignore a group upgrade (can be used more than once)\n")); +#ifdef HAVE_LIBCURL + addlist(_(" --lowspeedlimit \n" + " bytes per second that a download should be below\n")); + addlist(_(" --lowspeedtime \n" + " time in seconds that a download should be below lowspeedlimit\n")); +#endif /* pass through */ case PM_OP_REMOVE: addlist(_(" -d, --nodeps skip dependency version checks (-dd to skip all checks)\n")); @@ -713,6 +719,12 @@ static int parsearg_upgrade(int opt) case OP_IGNOREGROUP: parsearg_util_addlist(&(config->ignoregrp)); break; + case OP_LOWSPEEDLIMIT: + config->lowspeedlimit = parse_positive_long(optarg); + break; + case OP_LOWSPEEDTIME: + config->lowspeedtime = parse_positive_long(optarg); + break; default: return 1; } return 0; @@ -928,6 +940,8 @@ static int parseargs(int argc, char *argv[]) {"logfile",required_argument, 0, OP_LOGFILE}, {"ignoregroup", required_argument, 0, OP_IGNOREGROUP}, {"needed", no_argument, 0, OP_NEEDED}, + {"lowspeedlimit", required_argument, 0, OP_LOWSPEEDLIMIT}, + {"lowspeedtime", required_argument, 0, OP_LOWSPEEDTIME}, {"asexplicit", no_argument, 0, OP_ASEXPLICIT}, {"arch", required_argument, 0, OP_ARCH}, {"print-format", required_argument, 0, OP_PRINTFORMAT}, -- 2.10.2
Re: [pacman-dev] [PATCH 1/1] always accept untranslated answers 'Y' and 'N'
Christian Hesseon Fri, 2016/11/11 21:34: > Lukas Fleischer on Fri, 2016/11/11 21:23: > > On Fri, 11 Nov 2016 at 21:15:48, Christian Hesse wrote: > > > From: Christian Hesse > > > > > > 'YES' translates to 'JA' in German, thus answer 'J' is expected for > > > positive answer. This changes the behaviour to always accept 'Y' > > > and 'N', in addition to the translated values. > > > > Not sure whether it is a problem in practice but what happens if "N" is > > translated to "Y" in some language? Do we really want to accept if the > > user enters "Y" in that case? > > A valid point... > Does such a language exist? Answering myself... Yes! So we definitely do *not* want this. Nevertheless... Learned some interesting facts about languages. :D -- main(a){char*c=/*Schoene Gruesse */"B?IJj;MEH" "CX:;",b;for(a/*Best regards my address:*/=0;b=c[a++];) putchar(b-1/(/*Chriscc -ox -xc - && ./x*/b/42*2-3)*42);} pgpsZnEGKdJvM.pgp Description: OpenPGP digital signature
Re: [pacman-dev] [PATCH 1/1] always accept untranslated answers 'Y' and 'N'
"Yes" in Swahili it is "Ndiyo", in Arabic it's "Na'am", Greek is "Nai", ... apt on Ubuntu allows to answer with "J" for "Yes" on a German locale. But I am not sure if apt unconditionally allows to answer with "Y/N". In general I think it's a bad idea. Either allow localized input only, or Y/N only. On 11/11/16 21:34, Christian Hesse wrote: > Lukas Fleischeron Fri, 2016/11/11 21:23: >> On Fri, 11 Nov 2016 at 21:15:48, Christian Hesse wrote: >>> From: Christian Hesse >>> >>> 'YES' translates to 'JA' in German, thus answer 'J' is expected for >>> positive answer. This changes the behaviour to always accept 'Y' >>> and 'N', in addition to the translated values. >> >> Not sure whether it is a problem in practice but what happens if "N" is >> translated to "Y" in some language? Do we really want to accept if the >> user enters "Y" in that case? > > A valid point... > Does such a language exist? > > All my systems are configured with English locale, except my wife's and my > mother's one. My blind typing for pacman commands breaks there. :-p > > Well, possibly I should just set the root account to English locale... :D > signature.asc Description: OpenPGP digital signature
Re: [pacman-dev] [PATCH 1/1] always accept untranslated answers 'Y' and 'N'
On Fri, Nov 11, 2016 at 09:34:05PM +0100, Christian Hesse wrote: > Lukas Fleischeron Fri, 2016/11/11 21:23: > > On Fri, 11 Nov 2016 at 21:15:48, Christian Hesse wrote: > > > From: Christian Hesse > > > > > > 'YES' translates to 'JA' in German, thus answer 'J' is expected for > > > positive answer. This changes the behaviour to always accept 'Y' > > > and 'N', in addition to the translated values. > > > > Not sure whether it is a problem in practice but what happens if "N" is > > translated to "Y" in some language? Do we really want to accept if the > > user enters "Y" in that case? > > A valid point... > Does such a language exist? It does! Looks like Uzbek would break if we did this: src/pacman/po/uz.po:msgid "No" src/pacman/po/uz.po-msgstr "Yo'q" > All my systems are configured with English locale, except my wife's and my > mother's one. My blind typing for pacman commands breaks there. :-p > > Well, possibly I should just set the root account to English locale... :D > -- > main(a){char*c=/*Schoene Gruesse */"B?IJj;MEH" > "CX:;",b;for(a/*Best regards my address:*/=0;b=c[a++];) > putchar(b-1/(/*Chriscc -ox -xc - && ./x*/b/42*2-3)*42);}
Re: [pacman-dev] [PATCH 1/1] always accept untranslated answers 'Y' and 'N'
Lukas Fleischeron Fri, 2016/11/11 21:23: > On Fri, 11 Nov 2016 at 21:15:48, Christian Hesse wrote: > > From: Christian Hesse > > > > 'YES' translates to 'JA' in German, thus answer 'J' is expected for > > positive answer. This changes the behaviour to always accept 'Y' > > and 'N', in addition to the translated values. > > Not sure whether it is a problem in practice but what happens if "N" is > translated to "Y" in some language? Do we really want to accept if the > user enters "Y" in that case? A valid point... Does such a language exist? All my systems are configured with English locale, except my wife's and my mother's one. My blind typing for pacman commands breaks there. :-p Well, possibly I should just set the root account to English locale... :D -- main(a){char*c=/*Schoene Gruesse */"B?IJj;MEH" "CX:;",b;for(a/*Best regards my address:*/=0;b=c[a++];) putchar(b-1/(/*Chriscc -ox -xc - && ./x*/b/42*2-3)*42);} pgpLZwupj5OVz.pgp Description: OpenPGP digital signature
Re: [pacman-dev] [PATCH 1/1] always accept untranslated answers 'Y' and 'N'
On Fri, 11 Nov 2016 at 21:15:48, Christian Hesse wrote: > From: Christian Hesse> > 'YES' translates to 'JA' in German, thus answer 'J' is expected for > positive answer. This changes the behaviour to always accept 'Y' > and 'N', in addition to the translated values. > > Signed-off-by: Christian Hesse > --- > src/pacman/util.c | 8 ++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/src/pacman/util.c b/src/pacman/util.c > index fd7438b..e878cb3 100644 > --- a/src/pacman/util.c > +++ b/src/pacman/util.c > @@ -1587,9 +1587,13 @@ static int question(short preset, const char *format, > va_list args) > fprintf(stream, "%s\n", response); > } > > - if(mbscasecmp(response, _("Y")) == 0 || mbscasecmp(response, > _("YES")) == 0) { > + if(mbscasecmp(response, "Y") == 0 /* always accept > untranslated */ > + || mbscasecmp(response, _("Y")) == 0 > + || mbscasecmp(response, _("YES")) == 0) { > return 1; > - } else if(mbscasecmp(response, _("N")) == 0 || > mbscasecmp(response, _("NO")) == 0) { > + } else if(mbscasecmp(response, "N") == 0 /* always accept > untranslated */ > + || mbscasecmp(response, _("N")) == 0 > + || mbscasecmp(response, _("NO")) == 0) { Not sure whether it is a problem in practice but what happens if "N" is translated to "Y" in some language? Do we really want to accept if the user enters "Y" in that case? > return 0; > } > } > -- > 2.10.2
[pacman-dev] [PATCH 1/1] libalpm/signing: support EDDSA from gpgme 1.7.0
From: Christian HesseSigned-off-by: Christian Hesse --- lib/libalpm/signing.c | 4 1 file changed, 4 insertions(+) diff --git a/lib/libalpm/signing.c b/lib/libalpm/signing.c index 527e763..1feacff 100644 --- a/lib/libalpm/signing.c +++ b/lib/libalpm/signing.c @@ -356,6 +356,10 @@ static int key_search(alpm_handle_t *handle, const char *fpr, #if GPGME_VERSION_NUMBER >= 0x010500 case GPGME_PK_ECC: #endif +/* value added in gpgme 1.7.0 */ +#if GPGME_VERSION_NUMBER >= 0x010700 + case GPGME_PK_EDDSA: +#endif pgpkey->pubkey_algo = 'E'; break; } -- 2.10.2
[pacman-dev] [PATCH 1/1] always accept untranslated answers 'Y' and 'N'
From: Christian Hesse'YES' translates to 'JA' in German, thus answer 'J' is expected for positive answer. This changes the behaviour to always accept 'Y' and 'N', in addition to the translated values. Signed-off-by: Christian Hesse --- src/pacman/util.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pacman/util.c b/src/pacman/util.c index fd7438b..e878cb3 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -1587,9 +1587,13 @@ static int question(short preset, const char *format, va_list args) fprintf(stream, "%s\n", response); } - if(mbscasecmp(response, _("Y")) == 0 || mbscasecmp(response, _("YES")) == 0) { + if(mbscasecmp(response, "Y") == 0 /* always accept untranslated */ + || mbscasecmp(response, _("Y")) == 0 + || mbscasecmp(response, _("YES")) == 0) { return 1; - } else if(mbscasecmp(response, _("N")) == 0 || mbscasecmp(response, _("NO")) == 0) { + } else if(mbscasecmp(response, "N") == 0 /* always accept untranslated */ + || mbscasecmp(response, _("N")) == 0 + || mbscasecmp(response, _("NO")) == 0) { return 0; } } -- 2.10.2