Radish alpha
H
HardenedBSD Package Manager
Radicle
Git (anonymous pull)
Log in to clone via SSH
Do not try to search if no repositories are configured
Baptiste Daroussin committed 12 years ago
commit ea87e65f0c7afd56dd620a8f4cfddfa5e44568c0
parent 3c8b2d0374acdb87272d94736446623065c1f824
2 files changed +7 -1
modified libpkg/pkgdb.c
@@ -3291,6 +3291,11 @@ pkgdb_search(struct pkgdb *db, const char *pattern, match_t match,
			return (NULL);
		}
	} else {
+
		if (pkg_repos_count() == 0) {
+
			pkg_emit_error("No repositories configured");
+
			sbuf_delete(sql);
+
			return (NULL);
+
		}
		/* test on all the attached databases */
		if (sql_on_all_attached_db(db->sqlite, sql,
		    multireposql, " UNION ALL ") != EPKG_OK) {
@@ -3308,6 +3313,7 @@ pkgdb_search(struct pkgdb *db, const char *pattern, match_t match,

	ret = sqlite3_prepare_v2(db->sqlite, sbuf_get(sql), -1, &stmt, NULL);
	if (ret != SQLITE_OK) {
+
		printf("%s\n", sbuf_data(sql));
		ERROR_SQLITE(db->sqlite);
		sbuf_delete(sql);
		return (NULL);
modified tests/frontend/search.sh
@@ -7,7 +7,7 @@ search_head() {

search_body() {
	REPOS_DIR=/nonexistent
-
	atf_check -o inline:"pkg                            New generation package manager\n" -e empty -s exit:0 pkg -C '' search -e -Q comment -S name pkg
+
	atf_check -e inline:"pkg: No repositories configured\n" -o empty -s exit:74 pkg -C '' search -e -Q comment -S name pkg
}

atf_init_test_cases() {