commit 63f810e6fee43e699585195a24eebdb53a99a4f4 from: Stefan Sperling date: Sat Feb 29 07:54:55 2020 UTC when "bad path" errors occur, always show the path in question commit - a2f4a3591f215ab55f58ef4ee630b960af87a4d5 commit + 63f810e6fee43e699585195a24eebdb53a99a4f4 blob - 174d3ab02fe48232c74cae3094711739da35c167 blob + f8ccc9ef0e7b576e82bc848e98037ce52202878d --- lib/object.c +++ lib/object.c @@ -152,7 +152,7 @@ get_packfile_path(char **path_packfile, struct got_pac /* Packfile path contains ".pack" instead of ".idx", so add one byte. */ size = strlen(packidx->path_packidx) + 2; if (size < GOT_PACKFILE_NAMELEN + 1) - return got_error(GOT_ERR_BAD_PATH); + return got_error_path(packidx->path_packidx, GOT_ERR_BAD_PATH); *path_packfile = malloc(size); if (*path_packfile == NULL) @@ -1643,7 +1643,7 @@ got_object_tree_path_changed(int *changed, /* We not do support comparing the root path. */ if (path[1] == '\0') - return got_error(GOT_ERR_BAD_PATH); + return got_error_path(path, GOT_ERR_BAD_PATH); tree1 = tree01; tree2 = tree02; blob - 612f8eabe6d1cf8aefde3bc0a3817eb786a9ba74 blob + 01ae02ebd326f6b7cb885ce12ceef93b6fbcce17 --- lib/path.c +++ lib/path.c @@ -112,11 +112,11 @@ got_path_skip_common_ancestor(char **child, const char len_parent = strlen(parent_abspath); len = strlen(abspath); if (len_parent >= len) - return got_error(GOT_ERR_BAD_PATH); + return got_error_path(abspath, GOT_ERR_BAD_PATH); if (strncmp(parent_abspath, abspath, len_parent) != 0) - return got_error(GOT_ERR_BAD_PATH); + return got_error_path(abspath, GOT_ERR_BAD_PATH); if (!got_path_is_root_dir(parent_abspath) && abspath[len_parent] != '/') - return got_error(GOT_ERR_BAD_PATH); + return got_error_path(abspath, GOT_ERR_BAD_PATH); while (abspath[len_parent] == '/') abspath++; bufsize = len - len_parent + 1; @@ -363,7 +363,7 @@ got_path_dirname(char **parent, const char *path) return got_error_from_errno2("dirname", path); if (p[0] == '.' && p[1] == '\0') - return got_error(GOT_ERR_BAD_PATH); + return got_error_path(path, GOT_ERR_BAD_PATH); *parent = strdup(p); if (*parent == NULL) blob - 479f6f6d957cf01339764d71a6da6db9ef04ed9a blob + 1b376ccd1c6213845cf4cf8b877850e79bd3c1b5 --- lib/repository.c +++ lib/repository.c @@ -543,7 +543,7 @@ got_repo_open(struct got_repository **repop, const cha else abspath = got_path_get_absolute(path); if (abspath == NULL) - return got_error(GOT_ERR_BAD_PATH); + return got_error_path(path, GOT_ERR_BAD_PATH); repo = calloc(1, sizeof(*repo)); if (repo == NULL) { blob - 86333ed330f408d057d9d8d3b52a016f28de4cb9 blob + 0e0bef70fa58ed856ec28833fae027d8744acaae --- lib/worktree.c +++ lib/worktree.c @@ -2833,7 +2833,7 @@ got_worktree_resolve_path(char **wt_path, struct got_w if (strncmp(got_worktree_get_root_path(worktree), resolved, strlen(got_worktree_get_root_path(worktree)))) { - err = got_error(GOT_ERR_BAD_PATH); + err = got_error_path(resolved, GOT_ERR_BAD_PATH); goto done; } @@ -2996,7 +2996,7 @@ schedule_for_deletion(void *arg, unsigned char status, ie = got_fileindex_entry_get(a->fileindex, relpath, strlen(relpath)); if (ie == NULL) - return got_error(GOT_ERR_BAD_PATH); + return got_error_path(relpath, GOT_ERR_BAD_PATH); staged_status = get_staged_status(ie); if (staged_status != GOT_STATUS_NO_CHANGE) { @@ -3465,7 +3465,7 @@ revert_file(void *arg, unsigned char status, unsigned ie = got_fileindex_entry_get(a->fileindex, relpath, strlen(relpath)); if (ie == NULL) - return got_error(GOT_ERR_BAD_PATH); + return got_error_path(relpath, GOT_ERR_BAD_PATH); /* Construct in-repository path of tree which contains this blob. */ err = got_path_dirname(&parent_path, ie->path); blob - 49133597718c2ff09eff39bb48313bb803aea2e4 blob + 37bda9dd94ab119f94c85d7df3a751715a5a1b8d --- libexec/got-read-pack/got-read-pack.c +++ libexec/got-read-pack/got-read-pack.c @@ -452,7 +452,7 @@ tree_path_changed(int *changed, uint8_t **buf1, uint8_ /* We not do support comparing the root path. */ if (path[1] == '\0') - return got_error(GOT_ERR_BAD_PATH); + return got_error_path(path, GOT_ERR_BAD_PATH); s = path; s++; /* skip leading '/' */