git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 6/6] Convert remaining die*(BUG) messages

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Apr 29, 2018, 22:19 UTC
Message-ID
<0e85c7a16e3767eb03cdce0a7ed75a0c2b77d7d5.1525040254.git.johannes.schindelin@gmx.de>
In-Reply-To
<cover.1525040253.git.johannes.schindelin@gmx.de>

These were not caught by the previous commit, as they did not match the regular expression.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 git-compat-util.h     | 2 +-
 pathspec.c            | 2 +-
 submodule.c           | 2 +-
 vcs-svn/fast_export.c | 6 ++++--
 4 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/git-compat-util.h b/git-compat-util.h
index 07e383257b4..3a7216f5313 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -1052,7 +1052,7 @@ int git_qsort_s(void *base, size_t nmemb, size_t size,
 
 #define QSORT_S(base, n, compar, ctx) do {			\
 	if (qsort_s((base), (n), sizeof(*(base)), compar, ctx))	\
-		die("BUG: qsort_s() failed");			\
+		BUG("qsort_s() failed");			\
 } while (0)
 
 #ifndef REG_STARTEND
diff --git a/pathspec.c b/pathspec.c
index a637a6d15c0..27cd6067860 100644
--- a/pathspec.c
+++ b/pathspec.c
@@ -486,7 +486,7 @@ static void init_pathspec_item(struct pathspec_item *item, unsigned flags,
 	/* sanity checks, pathspec matchers assume these are sane */
 	if (item->nowildcard_len > item->len ||
 	    item->prefix         > item->len) {
-		die ("BUG: error initializing pathspec_item");
+		BUG("error initializing pathspec_item");
 	}
 }
 
diff --git a/submodule.c b/submodule.c
index 733db441714..c282fa8fe51 100644
--- a/submodule.c
+++ b/submodule.c
@@ -2043,7 +2043,7 @@ const char *get_superproject_working_tree(void)
 
 		if (super_sub_len > cwd_len ||
 		    strcmp(&cwd[cwd_len - super_sub_len], super_sub))
-			die (_("BUG: returned path string doesn't match cwd?"));
+			BUG("returned path string doesn't match cwd?");
 
 		super_wt = xstrdup(cwd);
 		super_wt[cwd_len - super_sub_len] = '\0';
diff --git a/vcs-svn/fast_export.c b/vcs-svn/fast_export.c
index 3fd047a8b82..b5b8913cb0f 100644
--- a/vcs-svn/fast_export.c
+++ b/vcs-svn/fast_export.c
@@ -320,7 +320,8 @@ const char *fast_export_read_path(const char *path, uint32_t *mode_out)
 	err = fast_export_ls(path, mode_out, &buf);
 	if (err) {
 		if (errno != ENOENT)
-			die_errno("BUG: unexpected fast_export_ls error");
+			BUG("unexpected fast_export_ls error: %s",
+			    strerror(errno));
 		/* Treat missing paths as directories. */
 		*mode_out = S_IFDIR;
 		return NULL;
@@ -338,7 +339,8 @@ void fast_export_copy(uint32_t revision, const char *src, const char *dst)
 	err = fast_export_ls_rev(revision, src, &mode, &data);
 	if (err) {
 		if (errno != ENOENT)
-			die_errno("BUG: unexpected fast_export_ls_rev error");
+			BUG("unexpected fast_export_ls_rev error: %s",
+			    strerror(errno));
 		fast_export_delete(dst);
 		return;
 	}
-- 
2.17.0.windows.1.36.gdf4ca5fb72a
Previous: Johannes SchindelinNext: Eric Sunshine
Message 14 of 15 in “Finish the conversion from die("BUG: ...") to BUG()”
  1. 0/6 Finish the conversion from die("BUG: ...") to BUG()Johannes Schindelin, Apr 29, 2018
  2. 1/6 test_must_fail: support ok=sigabrtJohannes Schindelin, Apr 29, 2018
  3. 2/6 t1406: prepare for the refs code to fail with BUG()Johannes Schindelin, Apr 29, 2018
  4. Johannes SixtApr 30, 2018
  5. Johannes SchindelinMay 1, 2018
  6. Duy NguyenMay 1, 2018
  7. Duy NguyenMay 1, 2018
  8. Junio C HamanoMay 2, 2018
  9. Johannes SchindelinMay 2, 2018
  10. Junio C HamanoMay 2, 2018
  11. 3/6 refs/*: report bugs using the BUG() macroJohannes Schindelin, Apr 29, 2018
  12. 4/6 run-command: use BUG() to report bugs, not die()Johannes Schindelin, Apr 29, 2018
  13. 5/6 Replace all die("BUG: ...") calls by BUG() onesJohannes Schindelin, Apr 29, 2018
  14. 6/6 Convert remaining die*(BUG) messagesJohannes Schindelin, Apr 29, 2018
  15. Eric SunshineApr 30, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.