From 005eab0a080925d0d6f780d751f9019dafbafc64 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Sun, 24 Jul 2011 13:52:05 +0200 Subject: libalpm: Set ret correctly in download_internal() Immediately jump to the cleanup code after setting the return code to -1 in case rename() fails. Otherwise, it will be reset to 0 right after we leave the if branch. Signed-off-by: Lukas Fleischer Signed-off-by: Dan McGee --- lib/libalpm/dload.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index a98d84ac..e3d30f23 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -308,6 +308,7 @@ static int download_internal(const char *url, const char *localpath, _alpm_log(PM_LOG_ERROR, _("could not rename %s to %s (%s)\n"), tempfile, destfile, strerror(errno)); ret = -1; + goto cleanup; } ret = 0; -- cgit v1.2.3-70-g09d2 From 88644e181db49f3f94e6891166823fd5f46acbcc Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 25 Jul 2011 10:05:36 -0500 Subject: Fix group selection entry for large inputs Hardcoding anything always ends up burning you, and the arbitrary length of 64 here did just that. Add the ability to reallocate the readline buffer for longer inputs if necessary, and add other error checking as approprate. This also plugs one small memory leak of the group processing code selection array. Addresses FS#24253. Signed-off-by: Dan McGee --- src/pacman/sync.c | 11 ++++++++++- src/pacman/util.c | 38 +++++++++++++++++++++++++++++++++++--- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/src/pacman/sync.c b/src/pacman/sync.c index c56934b6..6962306a 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -644,7 +644,15 @@ static int process_group(alpm_list_t *dbs, char *group) group); select_display(pkgs); char *array = malloc(count); - multiselect_question(array, count); + if(!array) { + ret = 1; + goto cleanup; + } + if(multiselect_question(array, count)) { + ret = 1; + free(array); + goto cleanup; + } int n = 0; for(i = pkgs; i; i = alpm_list_next(i)) { if(array[n++] == 0) @@ -657,6 +665,7 @@ static int process_group(alpm_list_t *dbs, char *group) goto cleanup; } } + free(array); } else { for(i = pkgs; i; i = alpm_list_next(i)) { pmpkg_t *pkg = alpm_list_getdata(i); diff --git a/src/pacman/util.c b/src/pacman/util.c index f695ffba..53dbd637 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -796,8 +796,9 @@ static int multiselect_parse(char *array, int count, char *response) int multiselect_question(char *array, int count) { - char response[64]; + char *response, *lastchar; FILE *stream; + size_t response_len = 64; if(config->noconfirm) { stream = stdout; @@ -806,19 +807,45 @@ int multiselect_question(char *array, int count) stream = stderr; } + response = malloc(response_len); + if(!response) { + return -1; + } + lastchar = response + response_len - 1; + /* sentinel byte to later see if we filled up the entire string */ + *lastchar = 1; + while(1) { memset(array, 1, count); fprintf(stream, "\n"); fprintf(stream, _("Enter a selection (default=all)")); fprintf(stream, ": "); + fflush(stream); if(config->noconfirm) { fprintf(stream, "\n"); break; } - if(fgets(response, sizeof(response), stdin)) { + if(fgets(response, response_len, stdin)) { + const size_t response_incr = 64; + /* handle buffer not being large enough to read full line case */ + while(*lastchar == '\0' && lastchar[-1] != '\n') { + response_len += response_incr; + response = realloc(response, response_len); + if(!response) { + return -1; + } + lastchar = response + response_len - 1; + /* sentinel byte */ + *lastchar = 1; + if(fgets(response + response_len - response_incr - 1, + response_incr + 1, stdin) == 0) { + free(response); + return -1; + } + } strtrim(response); if(strlen(response) > 0) { if(multiselect_parse(array, count, response) == -1) { @@ -826,9 +853,14 @@ int multiselect_question(char *array, int count) continue; } } + break; + } else { + free(response); + return -1; } - break; } + + free(response); return(0); } -- cgit v1.2.3-70-g09d2 From 4c37d74ae50fc7c0f067aca07164fe75516d055b Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Fri, 5 Aug 2011 22:44:00 +0200 Subject: doc/PKGBUILD: fix pkgver for -git packages Signed-off-by: Florian Pritz Signed-off-by: Dan McGee --- doc/PKGBUILD.5.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/PKGBUILD.5.txt b/doc/PKGBUILD.5.txt index c0fa5948..ab49f7b7 100644 --- a/doc/PKGBUILD.5.txt +++ b/doc/PKGBUILD.5.txt @@ -384,8 +384,7 @@ from. The SVN module to fetch. *Git*:: - The generated pkgver will be one formatted by the 'git-describe' - command, with '-' characters converted to '_' characters. + The generated pkgver will be the date the package is built. *_gitroot*;; The URL (all protocols supported) to the GIT repository. -- cgit v1.2.3-70-g09d2 From 67445334e71eaf6138561eee8e5561733a59fc69 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 8 Aug 2011 16:38:59 -0500 Subject: Update translations from transifex Signed-off-by: Dan McGee --- lib/libalpm/po/fi.po | 17 +++++++++++------ lib/libalpm/po/libalpm.pot | 4 ++-- po/de.po | 18 +++++++++++------- po/fi.po | 13 ++++++++----- po/pacman.pot | 4 ++-- 5 files changed, 34 insertions(+), 22 deletions(-) diff --git a/lib/libalpm/po/fi.po b/lib/libalpm/po/fi.po index 4e662b1f..09909f56 100644 --- a/lib/libalpm/po/fi.po +++ b/lib/libalpm/po/fi.po @@ -1,16 +1,21 @@ # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR Pacman Development Team # This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. # +# , 2011. +# Larso , 2011. +# Jesse Jaara , 2011. +# apuasi , 2011. +# Dan McGee , 2011. msgid "" msgstr "" "Project-Id-Version: Arch Linux Pacman package manager\n" "Report-Msgid-Bugs-To: http://bugs.archlinux.org/index.php?project=3\n" -"POT-Creation-Date: 2011-04-18 11:23-0500\n" -"PO-Revision-Date: 2011-04-18 11:10+0000\n" -"Last-Translator: apuasi \n" -"Language-Team: Finnish \n" +"POT-Creation-Date: 2011-08-08 16:37-0500\n" +"PO-Revision-Date: 2011-07-28 22:14+0000\n" +"Last-Translator: Larso \n" +"Language-Team: Finnish (http://www.transifex.net/projects/p/archlinux-pacman/" +"team/fi/)\n" "Language: fi\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -327,7 +332,7 @@ msgstr "toimenpidettä ei ole alustettu" #, c-format msgid "duplicate target" -msgstr "" +msgstr "kohde on useampaan kertaan" #, c-format msgid "transaction not prepared" diff --git a/lib/libalpm/po/libalpm.pot b/lib/libalpm/po/libalpm.pot index 4c69f8cb..768ea204 100644 --- a/lib/libalpm/po/libalpm.pot +++ b/lib/libalpm/po/libalpm.pot @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: pacman 3.5.2\n" +"Project-Id-Version: pacman 3.5.3\n" "Report-Msgid-Bugs-To: http://bugs.archlinux.org/index.php?project=3\n" -"POT-Creation-Date: 2011-04-18 11:23-0500\n" +"POT-Creation-Date: 2011-08-08 16:37-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/po/de.po b/po/de.po index bc00b7b4..8aa6aef3 100644 --- a/po/de.po +++ b/po/de.po @@ -1,16 +1,20 @@ # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR Pacman Development Team # This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. # +# Mineo , 2011. +# Simon Schneider , 2011. +# Matthias Gorissen , 2011. +# Dan McGee , 2011. msgid "" msgstr "" "Project-Id-Version: Arch Linux Pacman package manager\n" "Report-Msgid-Bugs-To: http://bugs.archlinux.org/index.php?project=3\n" -"POT-Creation-Date: 2011-04-18 11:23-0500\n" -"PO-Revision-Date: 2011-04-28 09:05+0000\n" -"Last-Translator: Mineo \n" -"Language-Team: German \n" +"POT-Creation-Date: 2011-08-08 16:32-0500\n" +"PO-Revision-Date: 2011-06-30 08:35+0000\n" +"Last-Translator: jakob \n" +"Language-Team: German (http://www.transifex.net/projects/p/archlinux-pacman/" +"team/de/)\n" "Language: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -179,7 +183,7 @@ msgstr "" #, c-format msgid "%s: install reason has been set to 'explicitly installed'\n" msgstr "" -"%s: Installations-Grund wurde auf \"Ausdrücklich installiert\" gesetzt?\n" +"%s: Installations-Grund wurde auf \"Ausdrücklich installiert\" gesetzt\n" #, c-format msgid "Explicitly installed" @@ -1448,7 +1452,7 @@ msgid "" " --holdver Prevent automatic version bumping for development %ss" msgstr "" " --holdver Verhindert die automatische Erhöhung der Versionsnummer " -"für die Entwickler-Vesrion %ss" +"für die Entwickler-Version %ss" msgid " --nocheck Do not run the check() function in the %s" msgstr " --nocheck Unterdrückt die check()-Funktion in %s" diff --git a/po/fi.po b/po/fi.po index 5881f51e..c606289c 100644 --- a/po/fi.po +++ b/po/fi.po @@ -1,15 +1,18 @@ # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR Pacman Development Team # This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. # +# Larso , 2011. +# Jesse Jaara , 2011. +# apuasi , 2011. +# Dan McGee , 2011. msgid "" msgstr "" "Project-Id-Version: Arch Linux Pacman package manager\n" "Report-Msgid-Bugs-To: http://bugs.archlinux.org/index.php?project=3\n" -"POT-Creation-Date: 2011-04-18 11:23-0500\n" -"PO-Revision-Date: 2011-05-11 14:51+0000\n" -"Last-Translator: Larso \n" +"POT-Creation-Date: 2011-08-08 16:32-0500\n" +"PO-Revision-Date: 2011-06-14 11:10+0000\n" +"Last-Translator: Huulivoide \n" "Language-Team: Finnish (http://www.transifex.net/projects/p/archlinux-pacman/" "team/fi/)\n" "Language: fi\n" @@ -839,7 +842,7 @@ msgstr "Säilytettävät paketit:\n" #, c-format msgid " All locally installed packages\n" -msgstr " Kaikki paikalliset paketit\n" +msgstr " Kaikki asennetut paketit\n" #, c-format msgid " All current sync database packages\n" diff --git a/po/pacman.pot b/po/pacman.pot index c7451c1c..a3fcc78d 100644 --- a/po/pacman.pot +++ b/po/pacman.pot @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: pacman 3.5.2\n" +"Project-Id-Version: pacman 3.5.3\n" "Report-Msgid-Bugs-To: http://bugs.archlinux.org/index.php?project=3\n" -"POT-Creation-Date: 2011-04-18 11:23-0500\n" +"POT-Creation-Date: 2011-08-08 16:32-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" -- cgit v1.2.3-70-g09d2