[gentoo-commits] proj/portage-utils:master commit in: tests/qcheck/, /
commit: ede72d3cf08df8ffe7e59c4819d9a6c84ab1659f Author: Fabian Groffen gentoo org> AuthorDate: Sat Apr 9 11:17:39 2022 + Commit: Fabian Groffen gentoo org> CommitDate: Sat Apr 9 11:32:30 2022 + URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=ede72d3c qcheck: fix config-protect check, bug #837188 ensure we break out of the config-protect directories loop, instead of just skipping one directory, such that we don't produce bogus amounts of files, and also don't check despite we were told not to check (-P) Bug: https://bugs.gentoo.org/837188 Signed-off-by: Fabian Groffen gentoo.org> qcheck.c | 253 --- tests/qcheck/list05.good | 2 +- tests/qcheck/list07.good | 2 +- 3 files changed, 156 insertions(+), 101 deletions(-) diff --git a/qcheck.c b/qcheck.c index 9d9a86c..813c1f7 100644 --- a/qcheck.c +++ b/qcheck.c @@ -1,5 +1,5 @@ /* - * Copyright 2005-2020 Gentoo Foundation + * Copyright 2005-2022 Gentoo Foundation * Distributed under the terms of the GNU General Public License v2 * * Copyright 2005-2010 Ned Ludd- @@ -74,30 +74,30 @@ static int qcheck_cb(tree_pkg_ctx *pkg_ctx, void *priv) { struct qcheck_opt_state *state = priv; - FILE *fp_contents_update; - size_t num_files; - size_t num_files_ok; - size_t num_files_unknown; - size_t num_files_ignored; - struct stat st; - char *buffer; - char *line; - char *savep; - int cp_argc; - int cpm_argc; - char **cp_argv; - char **cpm_argv; - depend_atom *atom; - - fp_contents_update = NULL; - - /* Open contents */ + struct stat st; + depend_atom *atom; + FILE*fp_contents_update = NULL; + size_t num_files = 0; + size_t num_files_ok = 0; + size_t num_files_unknown = 0; + size_t num_files_ignored = 0; + char*buffer; + char*line; + char*savep; + char*eprefix= NULL; + size_t eprefix_len= 0; + int cp_argc; + int cpm_argc; + char **cp_argv; + char **cpm_argv; + + /* get CONTENTS from meta */ line = tree_pkg_meta_get(pkg_ctx, CONTENTS); if (line == NULL) return EXIT_FAILURE; atom = tree_get_atom(pkg_ctx, false); - num_files = num_files_ok = num_files_unknown = num_files_ignored = 0; + qcprintf("%sing %s ...\n", (state->qc_update ? "Updat" : "Check"), atom_format(state->fmt, atom)); @@ -124,6 +124,10 @@ qcheck_cb(tree_pkg_ctx *pkg_ctx, void *priv) if (!state->chk_config_protect) { makeargv(config_protect, &cp_argc, &cp_argv); makeargv(config_protect_mask, &cpm_argc, &cpm_argv); + + eprefix = tree_pkg_meta_get(pkg_ctx, EPREFIX); + if (eprefix != NULL) + eprefix_len = strlen(eprefix); } buffer = NULL; @@ -136,8 +140,9 @@ qcheck_cb(tree_pkg_ctx *pkg_ctx, void *priv) if (!entry) continue; - /* run initial checks */ - ++num_files; + num_files++; + + /* handle skips */ if (array_cnt(state->regex_arr)) { size_t n; regex_t *regex; @@ -145,15 +150,55 @@ qcheck_cb(tree_pkg_ctx *pkg_ctx, void *priv) if (!regexec(regex, entry->name, 0, NULL, 0)) break; if (n < array_cnt(state->regex_arr)) { - --num_files; - ++num_files_ignored; + num_files--; + num_files_ignored++; + if (verbose) + qcprintf(" %sSKIP%s %s: matches regex\n", +YELLOW, NORM, entry->name); + if (state->qc_update) + fprintf(fp_contents_update, "%s\n", buffer); continue; } } + + /* handle CONFIG_PROTECT-ed files */ + if (!state->chk_config_protect) { + inti; + char *p; + + /* compute path without EPREFIX */ + p = entry->name; + if (strlen(p) > eprefix_len) + p += eprefix_len;
[gentoo-commits] proj/portage-utils:master commit in: /, tests/qcheck/
commit: 6d6d693b3e0cd3aa6ea19ffe036e5f50c15aa7dd Author: Fabian Groffen gentoo org> AuthorDate: Thu Jan 2 15:22:52 2020 + Commit: Fabian Groffen gentoo org> CommitDate: Thu Jan 2 15:22:52 2020 + URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=6d6d693b qcheck: fix tests Signed-off-by: Fabian Groffen gentoo.org> qcheck.c | 5 +++-- tests/qcheck/list04.good | 2 +- tests/qcheck/list05.good | 2 +- tests/qcheck/list06.good | 2 +- tests/qcheck/list07.good | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/qcheck.c b/qcheck.c index e8db1b8..1217a8a 100644 --- a/qcheck.c +++ b/qcheck.c @@ -346,7 +346,7 @@ qcheck_cb(tree_pkg_ctx *pkg_ctx, void *priv) (num_files_ignored > 1 ? "s were" : " was")); qcprintf("\n"); - if (num_files_ok != num_files) + if (num_files_ok != num_files && !state->qc_update) return EXIT_FAILURE; else return EXIT_SUCCESS; @@ -410,6 +410,7 @@ int qcheck_main(int argc, char **argv) ret = -1; if (vdb != NULL) { if (array_cnt(atoms) != 0) { + ret = 0; array_for_each(atoms, i, atom) { ret |= tree_foreach_pkg_sorted(vdb, qcheck_cb, &state, atom); } @@ -427,5 +428,5 @@ int qcheck_main(int argc, char **argv) array_for_each(atoms, i, atom) atom_implode(atom); xarrayfree_int(atoms); - return ret; + return ret != 0; } diff --git a/tests/qcheck/list04.good b/tests/qcheck/list04.good index 604d20c..2f9f512 100644 --- a/tests/qcheck/list04.good +++ b/tests/qcheck/list04.good @@ -8,4 +8,4 @@ Checking a-b/pkg ... AFK: /missing-dir/missing-sym * 4 out of 11 files are good (2 files were ignored) Checking virtual/pkg ... - * 0 out of 0 file are good + * 0 out of 0 files are good diff --git a/tests/qcheck/list05.good b/tests/qcheck/list05.good index 35a0ff5..688c177 100644 --- a/tests/qcheck/list05.good +++ b/tests/qcheck/list05.good @@ -8,4 +8,4 @@ Checking a-b/pkg ... AFK: /missing-dir/missing-sym * 4 out of 11 files are good (2 files were ignored) Checking virtual/pkg ... - * 0 out of 0 file are good + * 0 out of 0 files are good diff --git a/tests/qcheck/list06.good b/tests/qcheck/list06.good index fb241db..6129032 100644 --- a/tests/qcheck/list06.good +++ b/tests/qcheck/list06.good @@ -5,4 +5,4 @@ Checking a-b/pkg ... MTIME: /bin/bad-mtime-sym * 4 out of 8 files are good (5 files were ignored) Checking virtual/pkg ... - * 0 out of 0 file are good + * 0 out of 0 files are good diff --git a/tests/qcheck/list07.good b/tests/qcheck/list07.good index ae80975..847b0b5 100644 --- a/tests/qcheck/list07.good +++ b/tests/qcheck/list07.good @@ -1,4 +1,4 @@ Checking a-b/pkg ... * 4 out of 4 files are good (9 files were ignored) Checking virtual/pkg ... - * 0 out of 0 file are good + * 0 out of 0 files are good
[gentoo-commits] proj/portage-utils:master commit in: /, tests/qcheck/
commit: 667a6170ad2536aa3800bf35b3ea38f227d739b7 Author: Fabian Groffen gentoo org> AuthorDate: Sat Jun 29 11:44:55 2019 + Commit: Fabian Groffen gentoo org> CommitDate: Sat Jun 29 11:44:55 2019 + URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=667a6170 qcheck: add -F argument Signed-off-by: Fabian Groffen gentoo.org> q.c | 2 +- qcheck.c | 38 ++ tests/qcheck/dotest | 2 +- tests/qcheck/list01.good | 2 +- tests/qcheck/list02.good | 2 +- tests/qcheck/list04.good | 4 ++-- tests/qcheck/list05.good | 4 ++-- tests/qcheck/list06.good | 4 ++-- tests/qcheck/list07.good | 4 ++-- tests/qcheck/list09.good | 4 ++-- 10 files changed, 36 insertions(+), 30 deletions(-) diff --git a/q.c b/q.c index 31427f3..3dd49f7 100644 --- a/q.c +++ b/q.c @@ -129,7 +129,7 @@ int q_main(int argc, char **argv) rret = readlink("/proc/self/exe", buf, sizeof(buf) - 1); #endif if (rret == -1) { - warnfp("haha no symlink love for you"); + warnfp("haha no symlink love for you ... :("); return 1; } buf[rret] = '\0'; diff --git a/qcheck.c b/qcheck.c index 97070f2..f77a501 100644 --- a/qcheck.c +++ b/qcheck.c @@ -24,8 +24,12 @@ #include "xasprintf.h" #include "xregex.h" -#define QCHECK_FLAGS "s:uABHTPp" COMMON_FLAGS +#define QCHECK_FORMAT "%[CATEGORY]%[PN]" +#define QCHECK_FORMAT_VERBOSE "%[CATEGORY]%[PF]" + +#define QCHECK_FLAGS "F:s:uABHTPp" COMMON_FLAGS static struct option const qcheck_long_opts[] = { + {"format", a_argument, NULL, 'F'}, {"skip",a_argument, NULL, 's'}, {"update", no_argument, NULL, 'u'}, {"noafk", no_argument, NULL, 'A'}, @@ -37,6 +41,7 @@ static struct option const qcheck_long_opts[] = { COMMON_LONG_OPTS }; static const char * const qcheck_opts_help[] = { + "Custom output format (default: " QCHECK_FORMAT ")", "Ignore files matching the regular expression ", "Update missing files, chksum and mtimes for packages", "Ignore missing files", @@ -61,6 +66,7 @@ struct qcheck_opt_state { bool chk_mtime; bool chk_config_protect; bool undo_prelink; + const char *fmt; }; static int @@ -97,7 +103,7 @@ qcheck_process_contents(tree_pkg_ctx *pkg_ctx, struct qcheck_opt_state *state) num_files = num_files_ok = num_files_unknown = num_files_ignored = 0; qcprintf("%sing %s ...\n", (state->qc_update ? "Updat" : "Check"), - atom_format("%[CATEGORY]%[PF]", atom)); + atom_format(state->fmt, atom)); if (state->qc_update) { fp_contents_update = tree_pkg_vdb_fopenat_rw(pkg_ctx, "CONTENTS~"); if (fp_contents_update == NULL) { @@ -328,13 +334,8 @@ qcheck_process_contents(tree_pkg_ctx *pkg_ctx, struct qcheck_opt_state *state) if (!verbose) return EXIT_SUCCESS; } - if (state->bad_only && num_files_ok != num_files) { - if (verbose) - printf("%s\n", atom_format("%[CATEGORY]%[PF]", atom)); - else { - printf("%s\n", atom_format("%[CATEGORY]%[PN]", atom)); - } - } + if (state->bad_only && num_files_ok != num_files) + printf("%s\n", atom_format(state->fmt, atom)); qcprintf(" %2$s*%1$s %3$s%4$zu%1$s out of %3$s%5$zu%1$s file%6$s are good", NORM, BOLD, BLUE, num_files_ok, num_files, (num_files > 1 ? "s" : "")); @@ -398,6 +399,7 @@ int qcheck_main(int argc, char **argv) .chk_mtime = true, .chk_config_protect = true, .undo_prelink = false, + .fmt = NULL, }; while ((ret = GETOPT_LONG(QCHECK, qcheck, "")) != -1) { @@ -409,16 +411,20 @@ int qcheck_main(int argc, char **argv) xarraypush(regex_arr, &preg, sizeof(preg)); break; } - case 'u': state.qc_update = true; break; - case 'A': state.chk_afk = false; break; - case 'B': state.bad_only = true; break; - case 'H': state.chk_hash = false; break; - case 'T': state.chk_mtime = false; break; - case 'P': state.chk_config_protect = false; break; - case 'p': state.undo_prelink = prelink_available(); break; + case 'u': state.qc_update = true;break; + case 'A': state.chk_afk = false; break; + case 'B': state.bad_only = true; break; + case 'H': state.chk_hash = false;break; + case 'T': state.chk_mtime = false;
[gentoo-commits] proj/portage-utils:master commit in: tests/qcheck/
commit: 8c2d770ba0fc714a20c937b3b9fb7e732665e86d Author: Fabian Groffen gentoo org> AuthorDate: Fri Mar 23 16:52:35 2018 + Commit: Fabian Groffen gentoo org> CommitDate: Fri Mar 23 16:52:35 2018 + URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=8c2d770b qcheck: don't require ownership to be preserved by cp ownership isn't really an issue here, so don't fail on it tests/qcheck/dotest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qcheck/dotest b/tests/qcheck/dotest index d7c337b..fa1feed 100755 --- a/tests/qcheck/dotest +++ b/tests/qcheck/dotest @@ -54,7 +54,7 @@ test 08 1 "qcheck -v a-b/pkg" # update check ( -cp -a "${ROOT}" mod +cp -PR --preserve=mode,timestamps "${ROOT}" mod ROOT=${PWD}/mod test 09 0 "qcheck -u a-b/pkg && qcheck a-b/pkg" )
[gentoo-commits] proj/portage-utils:master commit in: tests/qcheck/
commit: 359fe5097ca531291a2cbb878dc6940351a7a358 Author: Mike Frysinger gentoo org> AuthorDate: Thu Jun 11 09:51:22 2015 + Commit: Mike Frysinger gentoo org> CommitDate: Thu Jun 11 09:51:22 2015 + URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=359fe509 tests: qcheck: fix timezone handling Make sure the stamps are pinned to UTC rather than using the active TZ. URL: https://bugs.gentoo.org/551718 Reported-by: Jeroen Roovers gentoo.org> tests/qcheck/dotest | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/qcheck/dotest b/tests/qcheck/dotest index 965a5b5..9122321 100755 --- a/tests/qcheck/dotest +++ b/tests/qcheck/dotest @@ -10,8 +10,8 @@ export Q_VDB=/ # This is the "valid" mtime the test packages have hardcoded in the CONTENTS # files. The stamp is the CONTENTS while the touch date is the corresponding # unpacked date. -STAMP=1398954900 DATE=201405011035 -find "${ROOT}" -exec touch -h -t "${DATE}" {} + +STAMP=1398954900 DATE='2014-05-01T14:35:00Z' +find "${ROOT}" -exec touch -h -d "${DATE}" {} + mktmpdir
[gentoo-commits] proj/portage-utils:master commit in: /, tests/qcheck/
commit: 432dc6f0189116a0b3aece01ac013b1bee3ce778 Author: Mike Frysinger gentoo org> AuthorDate: Sat Jun 6 05:58:21 2015 + Commit: Mike Frysinger gentoo org> CommitDate: Sat Jun 6 05:58:21 2015 + URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=432dc6f0 Revert "tests: qcheck: tweak some tests output" This reverts commit 0c7050208c110faac5dd54a452ed60a7a40eae07. Trying to get stable output with multiple packages was getting to be too much of a pain, and sorting the output arbitrarily didn't feel correct either. Bite the bullet and have qcheck sort its walking of the vdb. URL: https://bugs.gentoo.org/549934 Reported-by: Patrick Lauer gentoo.org> qcheck.c | 2 +- tests/qcheck/dotest | 11 --- tests/qcheck/list04.good | 4 ++-- tests/qcheck/list05.good | 4 ++-- tests/qcheck/list06.good | 4 ++-- tests/qcheck/list07.good | 4 ++-- 6 files changed, 13 insertions(+), 16 deletions(-) diff --git a/qcheck.c b/qcheck.c index 75dbf6d..6ad5f85 100644 --- a/qcheck.c +++ b/qcheck.c @@ -399,7 +399,7 @@ int qcheck_main(int argc, char **argv) if ((argc == optind) && !state.search_all) qcheck_usage(EXIT_FAILURE); - ret = q_vdb_foreach_pkg(qcheck_cb, &state, NULL); + ret = q_vdb_foreach_pkg_sorted(qcheck_cb, &state); xarrayfree(regex_arr); return ret; } diff --git a/tests/qcheck/dotest b/tests/qcheck/dotest index 016fd10..965a5b5 100755 --- a/tests/qcheck/dotest +++ b/tests/qcheck/dotest @@ -28,9 +28,6 @@ test() { tend $? "$*" } -# have to avoid the -a flag and walk one package at a time as qcheck does not -# sort the vdb dirs before processing them. - # simple check test 01 1 "qcheck a-b/pkg" @@ -41,16 +38,16 @@ test 02 1 "qcheck a-b/pkg -s ^/missing-dir/.*" test 03 1 "qcheck -Ba" # hash mismatch ignore check -test 04 1 "qcheck -H cat/pkg && qcheck -H a-b/pkg" +test 04 1 "qcheck -Ha" # mtime mismatch ignore check -test 05 1 "qcheck -T cat/pkg && qcheck -T a-b/pkg" +test 05 1 "qcheck -Ta" # missing ignore check -test 06 1 "qcheck -A cat/pkg && qcheck -A a-b/pkg" +test 06 1 "qcheck -Aa" # hash+mtime+missing mismatch ignore check -test 07 0 "qcheck -AHT cat/pkg && qcheck -AHT a-b/pkg" +test 07 0 "qcheck -AHTa" # verbose check test 08 1 "qcheck -v a-b/pkg" diff --git a/tests/qcheck/list04.good b/tests/qcheck/list04.good index 943e0f5..930f896 100644 --- a/tests/qcheck/list04.good +++ b/tests/qcheck/list04.good @@ -1,5 +1,3 @@ -Checking cat/pkg-1 ... - * 0 out of 0 file are good Checking a-b/pkg-1.0 ... MTIME: /bin/bad-mtime-obj MTIME: /bin/bad-mtime-sym @@ -9,3 +7,5 @@ Checking a-b/pkg-1.0 ... AFK: /missing-dir/missing-file AFK: /missing-dir/missing-sym * 4 out of 11 files are good (2 files were ignored) +Checking cat/pkg-1 ... + * 0 out of 0 file are good diff --git a/tests/qcheck/list05.good b/tests/qcheck/list05.good index b1a8955..d4c4243 100644 --- a/tests/qcheck/list05.good +++ b/tests/qcheck/list05.good @@ -1,5 +1,3 @@ -Checking cat/pkg-1 ... - * 0 out of 0 file are good Checking a-b/pkg-1.0 ... MD5-DIGEST: /bin/bad-md5 SHA1-DIGEST: /bin/bad-sha1 @@ -9,3 +7,5 @@ Checking a-b/pkg-1.0 ... AFK: /missing-dir/missing-file AFK: /missing-dir/missing-sym * 4 out of 11 files are good (2 files were ignored) +Checking cat/pkg-1 ... + * 0 out of 0 file are good diff --git a/tests/qcheck/list06.good b/tests/qcheck/list06.good index 7b770a5..3cd48f7 100644 --- a/tests/qcheck/list06.good +++ b/tests/qcheck/list06.good @@ -1,8 +1,8 @@ -Checking cat/pkg-1 ... - * 0 out of 0 file are good Checking a-b/pkg-1.0 ... MD5-DIGEST: /bin/bad-md5 MTIME: /bin/bad-mtime-obj SHA1-DIGEST: /bin/bad-sha1 MTIME: /bin/bad-mtime-sym * 4 out of 8 files are good (5 files were ignored) +Checking cat/pkg-1 ... + * 0 out of 0 file are good diff --git a/tests/qcheck/list07.good b/tests/qcheck/list07.good index 4a86950..fb59689 100644 --- a/tests/qcheck/list07.good +++ b/tests/qcheck/list07.good @@ -1,4 +1,4 @@ -Checking cat/pkg-1 ... - * 0 out of 0 file are good Checking a-b/pkg-1.0 ... * 4 out of 4 files are good (9 files were ignored) +Checking cat/pkg-1 ... + * 0 out of 0 file are good
[gentoo-commits] proj/portage-utils:master commit in: tests/qcheck/
commit: 0c7050208c110faac5dd54a452ed60a7a40eae07 Author: Mike Frysinger gentoo org> AuthorDate: Tue May 19 17:33:28 2015 + Commit: Mike Frysinger gentoo org> CommitDate: Tue May 19 17:34:38 2015 + URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=0c705020 tests: qcheck: tweak some tests output Since qcheck doesn't sort its vdb walking, make sure our tests don't assume the package list is stable. We could change qcheck, but not sure that's needed. tests/qcheck/dotest | 11 +++ tests/qcheck/list04.good | 4 ++-- tests/qcheck/list05.good | 4 ++-- tests/qcheck/list06.good | 4 ++-- tests/qcheck/list07.good | 4 ++-- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/tests/qcheck/dotest b/tests/qcheck/dotest index 965a5b5..016fd10 100755 --- a/tests/qcheck/dotest +++ b/tests/qcheck/dotest @@ -28,6 +28,9 @@ test() { tend $? "$*" } +# have to avoid the -a flag and walk one package at a time as qcheck does not +# sort the vdb dirs before processing them. + # simple check test 01 1 "qcheck a-b/pkg" @@ -38,16 +41,16 @@ test 02 1 "qcheck a-b/pkg -s ^/missing-dir/.*" test 03 1 "qcheck -Ba" # hash mismatch ignore check -test 04 1 "qcheck -Ha" +test 04 1 "qcheck -H cat/pkg && qcheck -H a-b/pkg" # mtime mismatch ignore check -test 05 1 "qcheck -Ta" +test 05 1 "qcheck -T cat/pkg && qcheck -T a-b/pkg" # missing ignore check -test 06 1 "qcheck -Aa" +test 06 1 "qcheck -A cat/pkg && qcheck -A a-b/pkg" # hash+mtime+missing mismatch ignore check -test 07 0 "qcheck -AHTa" +test 07 0 "qcheck -AHT cat/pkg && qcheck -AHT a-b/pkg" # verbose check test 08 1 "qcheck -v a-b/pkg" diff --git a/tests/qcheck/list04.good b/tests/qcheck/list04.good index 930f896..943e0f5 100644 --- a/tests/qcheck/list04.good +++ b/tests/qcheck/list04.good @@ -1,3 +1,5 @@ +Checking cat/pkg-1 ... + * 0 out of 0 file are good Checking a-b/pkg-1.0 ... MTIME: /bin/bad-mtime-obj MTIME: /bin/bad-mtime-sym @@ -7,5 +9,3 @@ Checking a-b/pkg-1.0 ... AFK: /missing-dir/missing-file AFK: /missing-dir/missing-sym * 4 out of 11 files are good (2 files were ignored) -Checking cat/pkg-1 ... - * 0 out of 0 file are good diff --git a/tests/qcheck/list05.good b/tests/qcheck/list05.good index d4c4243..b1a8955 100644 --- a/tests/qcheck/list05.good +++ b/tests/qcheck/list05.good @@ -1,3 +1,5 @@ +Checking cat/pkg-1 ... + * 0 out of 0 file are good Checking a-b/pkg-1.0 ... MD5-DIGEST: /bin/bad-md5 SHA1-DIGEST: /bin/bad-sha1 @@ -7,5 +9,3 @@ Checking a-b/pkg-1.0 ... AFK: /missing-dir/missing-file AFK: /missing-dir/missing-sym * 4 out of 11 files are good (2 files were ignored) -Checking cat/pkg-1 ... - * 0 out of 0 file are good diff --git a/tests/qcheck/list06.good b/tests/qcheck/list06.good index 3cd48f7..7b770a5 100644 --- a/tests/qcheck/list06.good +++ b/tests/qcheck/list06.good @@ -1,8 +1,8 @@ +Checking cat/pkg-1 ... + * 0 out of 0 file are good Checking a-b/pkg-1.0 ... MD5-DIGEST: /bin/bad-md5 MTIME: /bin/bad-mtime-obj SHA1-DIGEST: /bin/bad-sha1 MTIME: /bin/bad-mtime-sym * 4 out of 8 files are good (5 files were ignored) -Checking cat/pkg-1 ... - * 0 out of 0 file are good diff --git a/tests/qcheck/list07.good b/tests/qcheck/list07.good index fb59689..4a86950 100644 --- a/tests/qcheck/list07.good +++ b/tests/qcheck/list07.good @@ -1,4 +1,4 @@ -Checking a-b/pkg-1.0 ... - * 4 out of 4 files are good (9 files were ignored) Checking cat/pkg-1 ... * 0 out of 0 file are good +Checking a-b/pkg-1.0 ... + * 4 out of 4 files are good (9 files were ignored)
[gentoo-commits] proj/portage-utils:master commit in: tests/qcheck/root/a-b/pkg-1.0/, tests/qcheck/root/cat/pkg-1/, tests/, /, ...
commit: 7eb77555f12823a7b5763122b6817fb66eb2a89f Author: Mike Frysinger gentoo org> AuthorDate: Mon May 4 10:12:55 2015 + Commit: Mike Frysinger gentoo org> CommitDate: Mon May 4 10:12:55 2015 + URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=7eb77555 qcheck/qlop/qmerge/qxpak: fix spurious trailing u The PRIu64 constant doesn't need its own "u" format as it's built in. For qcheck, this meant we generated invalid CONTENTS when updating. For the rest, it meant we had weird user facing output. Take this opportunity to add a qcheck testsuite. URL: https://bugs.gentoo.org/548262 Reported-by: Johnny Wezel wezel.name> qcheck.c | 10 ++--- qlop.c | 2 +- qmerge.c | 4 +- qxpak.c | 2 +- tests/Makefile | 2 +- tests/qcheck/Makefile| 11 ++ tests/qcheck/dotest | 64 tests/qcheck/list01.good | 11 ++ tests/qcheck/list02.good | 9 + tests/qcheck/list03.good | 1 + tests/qcheck/list04.good | 11 ++ tests/qcheck/list05.good | 11 ++ tests/qcheck/list06.good | 8 tests/qcheck/list07.good | 4 ++ tests/qcheck/list08.good | 11 ++ tests/qcheck/list09.good | 12 ++ tests/qcheck/root/a-b/pkg-1.0/CONTENTS | 13 +++ tests/qcheck/root/a-b/pkg-1.0/SLOT | 1 + tests/qcheck/root/a-b/pkg-1.0/repository | 1 + tests/qcheck/root/bin/bad-md5| 1 + tests/qcheck/root/bin/bad-mtime | 1 + tests/qcheck/root/bin/bad-mtime-obj | 1 + tests/qcheck/root/bin/bad-mtime-sym | 1 + tests/qcheck/root/bin/bad-sha1 | 1 + tests/qcheck/root/bin/good-md5 | 1 + tests/qcheck/root/bin/good-sha1 | 1 + tests/qcheck/root/bin/good-sym | 1 + tests/qcheck/root/cat/pkg-1/CONTENTS | 0 tests/qcheck/root/cat/pkg-1/SLOT | 1 + tests/qcheck/root/cat/pkg-1/repository | 1 + 30 files changed, 188 insertions(+), 10 deletions(-) diff --git a/qcheck.c b/qcheck.c index 86d7aa6..75dbf6d 100644 --- a/qcheck.c +++ b/qcheck.c @@ -186,7 +186,7 @@ static int qcheck_process_contents(q_vdb_pkg_ctx *pkg_ctx, struct qcheck_opt_sta if (state->chk_hash) { const char *digest_disp; if (state->qc_update) - fprintf(fpx, "obj %s %s %"PRIu64"u\n", e->name, hashed_file, (uint64_t)st.st_mtime); + fprintf(fpx, "obj %s %s %"PRIu64"\n", e->name, hashed_file, (uint64_t)st.st_mtime); switch (hash_algo) { case HASH_MD5: digest_disp = "MD5"; break; case HASH_SHA1: digest_disp = "SHA1"; break; @@ -208,12 +208,12 @@ static int qcheck_process_contents(q_vdb_pkg_ctx *pkg_ctx, struct qcheck_opt_sta if (state->chk_mtime) { qcprintf(" %sMTIME%s: %s", RED, NORM, e->name); if (verbose) - qcprintf(" (recorded '%"PRIu64"u' != actual '%"PRIu64"u')", (uint64_t)e->mtime, (uint64_t)st.st_mtime); + qcprintf(" (recorded '%"PRIu64"' != actual '%"PRIu64"')", (uint64_t)e->mtime, (uint64_t)st.st_mtime); qcprintf("\n"); /* This can only be an obj, dir and sym have no digest */ if (state->qc_update) - fprintf(fpx, "obj %s %s %"PRIu64"u\n", e->name, e->digest, (uint64_t)st.st_mtime); + fprintf(fpx, "obj %s %s %"PRIu64"\n", e->name, e->digest, (uint64_t)st.st_mtime); } else { --num_files; ++num_files_ignored; @@ -231,13 +231,13 @@ static int qcheck_process_contents(q_vdb_pkg_ctx *pkg_ctx, struct qcheck_opt_sta if (state->chk_mtime) { qcprintf(" %sMTIME%s: %s", RED, NORM, e->name); if (verbose) - qcprintf(" (recorded '%"PRIu64"u' != actual '%"PRIu64"u')", + qcprintf(" (recorded '%"PRIu64"' != actual '%"PRIu64"')", (uint64_t)e->mtime, (uint64_t)st.st_mtime);