From 14a93b2e436ed19c814653c3b2b61605fd5ca156 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 13 Aug 2009 21:01:40 -0500 Subject: Make fetch timeout actually 10 seconds We had 10000 as our timeout value, assuming it was expressed in ms. This is false after looking at the current code, so reset it back to 10 seconds. Addresses FS#15369. Signed-off-by: Dan McGee --- lib/libalpm/dload.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index 57c21b8e..fb778ee0 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -147,8 +147,8 @@ static int download_internal(const char *url, const char *localpath, /* libfetch does not reset the error code */ fetchLastErrCode = 0; - /* 10s timeout - TODO make a config option */ - fetchTimeout = 10000; + /* 10s timeout */ + fetchTimeout = 10; /* ignore any SIGPIPE signals- these may occur if our FTP socket dies or * something along those lines. Store the old signal handler first. */ -- cgit v1.2.3-54-g00ecf From 600782853ad5317ee51423a03487abcf34efd166 Mon Sep 17 00:00:00 2001 From: Xavier Chantry Date: Tue, 18 Aug 2009 17:23:47 +0200 Subject: Quiet ShowSize with -Ss and -Qs This fixes FS#15923 PS : duplicated code ftw Signed-off-by: Xavier Chantry Signed-off-by: Dan McGee --- src/pacman/query.c | 2 +- src/pacman/sync.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pacman/query.c b/src/pacman/query.c index 32752ffb..292cddfb 100644 --- a/src/pacman/query.c +++ b/src/pacman/query.c @@ -172,7 +172,7 @@ static int query_search(alpm_list_t *targets) } /* print the package size with the output if ShowSize option set */ - if(config->showsize) { + if(!config->quiet && config->showsize) { /* Convert byte size to MB */ double mbsize = (double)alpm_pkg_get_size(pkg) / (1024.0 * 1024.0); diff --git a/src/pacman/sync.c b/src/pacman/sync.c index 7bfe454b..dc936219 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -308,7 +308,7 @@ static int sync_search(alpm_list_t *syncs, alpm_list_t *targets) } /* print the package size with the output if ShowSize option set */ - if(config->showsize) { + if(!config->quiet && config->showsize) { /* Convert byte size to MB */ double mbsize = alpm_pkg_get_size(pkg) / (1024.0 * 1024.0); -- cgit v1.2.3-54-g00ecf From bba234a92ed9560bab1f1846870faa8303f98064 Mon Sep 17 00:00:00 2001 From: Xavier Chantry Date: Tue, 18 Aug 2009 16:56:19 +0200 Subject: query.c : return 1 when no package match For example, if no package is outdated, -Qu will return 1. This implements FS#15938 Signed-off-by: Xavier Chantry Signed-off-by: Dan McGee --- src/pacman/query.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/pacman/query.c b/src/pacman/query.c index 292cddfb..a9717074 100644 --- a/src/pacman/query.c +++ b/src/pacman/query.c @@ -394,6 +394,7 @@ static int display(pmpkg_t *pkg) int pacman_query(alpm_list_t *targets) { int ret = 0; + int match = 0; alpm_list_t *i; pmpkg_t *pkg = NULL; @@ -436,8 +437,12 @@ int pacman_query(alpm_list_t *targets) if(value != 0) { ret = 1; } + match = 1; } } + if(!match) { + ret = 1; + } return(ret); } @@ -471,6 +476,7 @@ int pacman_query(alpm_list_t *targets) if(value != 0) { ret = 1; } + match = 1; } if(config->op_q_isfile) { @@ -479,6 +485,10 @@ int pacman_query(alpm_list_t *targets) } } + if(!match) { + ret = 1; + } + return(ret); } -- cgit v1.2.3-54-g00ecf From 8a55b793631f37dbe7f906cd55d0997f920d36e8 Mon Sep 17 00:00:00 2001 From: Xavier Chantry Date: Mon, 10 Aug 2009 16:29:37 +0200 Subject: re-add -g CFLAGS with --enable-debug after commit 8feccaed7861010caefa4f7b9824a6, -g was no longer added with --enable-debug. So if CFLAGS was set (if unset, it defaults to -g -O2) and didn't contain -g, we ended with no debug symbols.. Signed-off-by: Xavier Chantry Signed-off-by: Dan McGee --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 90be362e..b2164b9e 100644 --- a/configure.ac +++ b/configure.ac @@ -284,7 +284,7 @@ if test "x$debug" = "xyes" ; then # Check for -fstack-protector availability GCC_STACK_PROTECT_LIB GCC_STACK_PROTECT_CC - CFLAGS="$CFLAGS -Wall -Werror" + CFLAGS="$CFLAGS -g -Wall -Werror" else AC_MSG_RESULT(no) CFLAGS="$CFLAGS -Wall" -- cgit v1.2.3-54-g00ecf From 6f97842ab22eb50fdc689e8aa2e95688d015fa74 Mon Sep 17 00:00:00 2001 From: Xavier Chantry Date: Fri, 7 Aug 2009 16:58:01 +0200 Subject: dload.c : change the way to check for mtimes libfetch supports checking mtime so we do not need to do it manually. when the databases are already up-to-date, initiating a connection with fetchXGet and closing it right after with fetchIO_close took a very long time (up to 10min!) on some network. Signed-off-by: Xavier Chantry Signed-off-by: Dan McGee (cherry picked from commit d7675e393ff3cecb5408c243898ebaae80c5988d) --- lib/libalpm/dload.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index fb778ee0..4695731a 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -124,6 +124,10 @@ static int download_internal(const char *url, const char *localpath, destfile = get_destfile(localpath, filename); tempfile = get_tempfile(localpath, filename); + if(mtimeold) { + fileurl->last_modified = mtimeold; + } + /* pass the raw filename for passing to the callback function */ _alpm_log(PM_LOG_DEBUG, "using '%s' for download progress\n", filename); @@ -157,7 +161,13 @@ static int download_internal(const char *url, const char *localpath, sigaction(SIGPIPE, NULL, &old_action); sigaction(SIGPIPE, &new_action, NULL); - dlf = fetchXGet(fileurl, &ust, (handle->nopassiveftp ? "" : "p")); + dlf = fetchXGet(fileurl, &ust, (handle->nopassiveftp ? "i" : "pi")); + + if(fetchLastErrCode == FETCH_UNCHANGED) { + _alpm_log(PM_LOG_DEBUG, "mtimes are identical, skipping %s\n", filename); + ret = 1; + goto cleanup; + } if(fetchLastErrCode != 0 || dlf == NULL) { const char *host = _("disk"); @@ -173,12 +183,6 @@ static int download_internal(const char *url, const char *localpath, _alpm_log(PM_LOG_DEBUG, "connected to %s successfully\n", fileurl->host); } - if(ust.mtime && mtimeold && ust.mtime == mtimeold) { - _alpm_log(PM_LOG_DEBUG, "mtimes are identical, skipping %s\n", filename); - ret = 1; - goto cleanup; - } - if(ust.mtime && mtimenew) { *mtimenew = ust.mtime; } -- cgit v1.2.3-54-g00ecf From bdd8e92ff601aab44941e7572f6c48d7e32a3f24 Mon Sep 17 00:00:00 2001 From: Xavier Chantry Date: Fri, 7 Aug 2009 15:40:21 +0200 Subject: testdb : less verbose http://bbs.archlinux.org/viewtopic.php?id=77396 Signed-off-by: Xavier Chantry Signed-off-by: Dan McGee --- src/util/testdb.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/util/testdb.c b/src/util/testdb.c index abbc62f1..e521e6b3 100644 --- a/src/util/testdb.c +++ b/src/util/testdb.c @@ -183,9 +183,9 @@ int check_syncdbs(char *dbpath, alpm_list_t *dbnames) { void usage() { fprintf(stderr, "usage:\n"); - fprintf(stderr, + fprintf(stderr, "\t%s [-b ] : check the local database\n", BASENAME); - fprintf(stderr, + fprintf(stderr, "\t%s [-b ] core extra ... : check the listed sync databases\n", BASENAME); exit(1); } @@ -224,10 +224,8 @@ int main(int argc, char **argv) alpm_option_set_dbpath(dbpath); if(!dbnames) { - printf("Checking the integrity of the local database in %s\n",dbpath); ret = check_localdb(dbpath); } else { - printf("Checking the integrity of the sync databases in %s\n",dbpath); ret = check_syncdbs(dbpath,dbnames); } -- cgit v1.2.3-54-g00ecf