commit 05f7204b7c26d432547753965bf1a27fb7fb2e01 from: Omar Polo date: Mon Aug 12 09:01:08 2024 UTC skip over lonely packidx when searching for objects This changes the search_packidx, match_packed_object and get_packfile_info routines to skip over lonely packidx. These seems to be generated occasionally by 'git fetch' over HTTP/S. Instead of dealing with this situation in gotwebd, which is fragile, attempt to do it at the lib/ level. `gotadmin cleanup' will still complain about these lonely packidx and `gotadmin cleanup -p' is still required. discussed with and ok stsp@ commit - 5d0baf4e3f639af9dcfcde4e24f9db7aa72332c3 commit + 05f7204b7c26d432547753965bf1a27fb7fb2e01 blob - ea44d67c0df8c731d5a45b797add4cbee60f171c blob + ff01852b75f3531996e1e87a3c719dbe369b65d9 --- gotwebd/gotweb.c +++ gotwebd/gotweb.c @@ -197,7 +197,7 @@ gotweb_process_request(struct request *c) if (qs->action != INDEX) { error = gotweb_load_got_path(&repo_dir, qs->path, c); c->t->repo_dir = repo_dir; - if (error && error->code != GOT_ERR_LONELY_PACKIDX) + if (error) goto err; } @@ -825,7 +825,7 @@ gotweb_render_index(struct template *tp) error = gotweb_load_got_path(&repo_dir, sd_dent[d_i]->d_name, c); - if (error && error->code != GOT_ERR_LONELY_PACKIDX) { + if (error) { if (error->code != GOT_ERR_NOT_GIT_REPO) log_warnx("%s: %s: %s", __func__, sd_dent[d_i]->d_name, error->msg); blob - f6c9b881e64ee0270d643a9dc809378060318b2b blob + 4a2aa626c6bfeafe49ae89b98803e3ba71f9ba15 --- lib/repository.c +++ lib/repository.c @@ -1404,8 +1404,13 @@ got_repo_search_packidx(struct got_packidx **packidx, err = got_packidx_open(packidx, got_repo_get_fd(repo), path_packidx, 0, repo->algo); - if (err) + if (err) { + if (err->code == GOT_ERR_LONELY_PACKIDX) { + err = NULL; + continue; + } goto done; + } err = add_packidx_bloom_filter(repo, *packidx, path_packidx); if (err) @@ -1849,8 +1854,13 @@ retry: err = got_packidx_open(&packidx, got_repo_get_fd(repo), path_packidx, 0, repo->algo); - if (err) + if (err) { + if (err->code == GOT_ERR_LONELY_PACKIDX) { + err = NULL; + continue; + } break; + } got_object_id_queue_free(&matched_ids); @@ -2598,8 +2608,13 @@ got_repo_get_packfile_info(int *npackfiles, int *nobje err = got_packidx_open(&packidx, got_repo_get_fd(repo), path_packidx, 0, repo->algo); free(path_packidx); - if (err) + if (err) { + if (err->code == GOT_ERR_LONELY_PACKIDX) { + err = NULL; + continue; + } goto done; + } if (fstat(packidx->fd, &sb) == -1) goto done;