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

[PATCH v2 02/19] global: assign non-const strings as required

From
Patrick Steinhardt <ps@pks.im>
Date
May 30, 2024, 12:50 UTC
Message-ID
<3430bcc09bbb4a9fe86ba40b0b3a0d4864c92e4f.1717073346.git.ps@pks.im>
In-Reply-To
<cover.1717073346.git.ps@pks.im>

There are several cases where we initialize non-const fields with string constants. This is invalid and will cause warnings once we enable the `-Wwrite-strings` warning. Adapt those cases to instead use string arrays.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 builtin/remote.c          |  3 +-
 diff.c                    |  3 +-
 entry.c                   |  7 ++--
 ident.c                   |  9 +++-
 line-log.c                |  3 +-
 object-file.c             |  3 +-
 pretty.c                  |  5 ++-
 refs/reftable-backend.c   |  5 ++-
 reftable/basics_test.c    |  5 ++-
 reftable/block_test.c     |  4 +-
 reftable/merged_test.c    | 52 ++++++++++++-----------
 reftable/readwrite_test.c | 60 ++++++++++++++++-----------
 reftable/stack_test.c     | 87 +++++++++++++++++++++------------------
 13 files changed, 144 insertions(+), 102 deletions(-)
diff --git a/builtin/remote.c b/builtin/remote.c
index d52b1c0e10..0324a5d48d 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -494,11 +494,12 @@ static int get_head_names(const struct ref *remote_refs, struct ref_states *stat
 	struct ref *ref, *matches;
 	struct ref *fetch_map = NULL, **fetch_map_tail = &fetch_map;
 	struct refspec_item refspec;
+	char refspec_str[] = "refs/heads/*";
 
 	memset(&refspec, 0, sizeof(refspec));
 	refspec.force = 0;
 	refspec.pattern = 1;
-	refspec.src = refspec.dst = "refs/heads/*";
+	refspec.src = refspec.dst = refspec_str;
 	get_fetch_map(remote_refs, &refspec, &fetch_map_tail, 0);
 	matches = guess_remote_head(find_ref_by_name(remote_refs, "HEAD"),
 				    fetch_map, 1);
diff --git a/diff.c b/diff.c
index ffd867ef6c..1439a5a01d 100644
--- a/diff.c
+++ b/diff.c
@@ -7231,11 +7231,12 @@ size_t fill_textconv(struct repository *r,
 		     struct diff_filespec *df,
 		     char **outbuf)
 {
+	static char empty_str[] = "";
 	size_t size;
 
 	if (!driver) {
 		if (!DIFF_FILE_VALID(df)) {
-			*outbuf = "";
+			*outbuf = empty_str;
 			return 0;
 		}
 		if (diff_populate_filespec(r, df, NULL))
diff --git a/entry.c b/entry.c
index b8c257f6f9..2fc06ac90c 100644
--- a/entry.c
+++ b/entry.c
@@ -175,6 +175,7 @@ int finish_delayed_checkout(struct checkout *state, int show_progress)
 	struct string_list_item *filter, *path;
 	struct progress *progress = NULL;
 	struct delayed_checkout *dco = state->delayed_checkout;
+	char empty_str[] = "";
 
 	if (!state->delayed_checkout)
 		return errs;
@@ -189,7 +190,7 @@ int finish_delayed_checkout(struct checkout *state, int show_progress)
 			if (!async_query_available_blobs(filter->string, &available_paths)) {
 				/* Filter reported an error */
 				errs = 1;
-				filter->string = "";
+				filter->string = empty_str;
 				continue;
 			}
 			if (available_paths.nr <= 0) {
@@ -199,7 +200,7 @@ int finish_delayed_checkout(struct checkout *state, int show_progress)
 				 * filter from the list (see
 				 * "string_list_remove_empty_items" call below).
 				 */
-				filter->string = "";
+				filter->string = empty_str;
 				continue;
 			}
 
@@ -225,7 +226,7 @@ int finish_delayed_checkout(struct checkout *state, int show_progress)
 					 * Do not ask the filter for available blobs,
 					 * again, as the filter is likely buggy.
 					 */
-					filter->string = "";
+					filter->string = empty_str;
 					continue;
 				}
 				ce = index_file_exists(state->istate, path->string,
diff --git a/ident.c b/ident.c
index cc7afdbf81..df7aa42802 100644
--- a/ident.c
+++ b/ident.c
@@ -46,9 +46,14 @@ static struct passwd *xgetpwuid_self(int *is_bogus)
 	pw = getpwuid(getuid());
 	if (!pw) {
 		static struct passwd fallback;
-		fallback.pw_name = "unknown";
+		static char fallback_name[] = "unknown";
 #ifndef NO_GECOS_IN_PWENT
-		fallback.pw_gecos = "Unknown";
+		static char fallback_gcos[] = "Unknown";
+#endif
+
+		fallback.pw_name = fallback_name;
+#ifndef NO_GECOS_IN_PWENT
+		fallback.pw_gecos = fallback_gcos;
 #endif
 		pw = &fallback;
 		if (is_bogus)
diff --git a/line-log.c b/line-log.c
index 8ff6ccb772..d9bf2c8120 100644
--- a/line-log.c
+++ b/line-log.c
@@ -1032,6 +1032,7 @@ static int process_diff_filepair(struct rev_info *rev,
 	struct range_set tmp;
 	struct diff_ranges diff;
 	mmfile_t file_parent, file_target;
+	char empty_str[] = "";
 
 	assert(pair->two->path);
 	while (rg) {
@@ -1056,7 +1057,7 @@ static int process_diff_filepair(struct rev_info *rev,
 		file_parent.ptr = pair->one->data;
 		file_parent.size = pair->one->size;
 	} else {
-		file_parent.ptr = "";
+		file_parent.ptr = empty_str;
 		file_parent.size = 0;
 	}
 
diff --git a/object-file.c b/object-file.c
index 610b1f465c..c9e374e57e 100644
--- a/object-file.c
+++ b/object-file.c
@@ -282,12 +282,13 @@ static struct cached_object {
 } *cached_objects;
 static int cached_object_nr, cached_object_alloc;
 
+static char empty_tree_buf[] = "";
 static struct cached_object empty_tree = {
 	.oid = {
 		.hash = EMPTY_TREE_SHA1_BIN_LITERAL,
 	},
 	.type = OBJ_TREE,
-	.buf = "",
+	.buf = empty_tree_buf,
 };
 
 static struct cached_object *find_cached_object(const struct object_id *oid)
diff --git a/pretty.c b/pretty.c
index ec05db5655..1a0030b32a 100644
--- a/pretty.c
+++ b/pretty.c
@@ -1583,9 +1583,10 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
 		return 1;
 	case 'D':
 		{
+			char empty_str[] = "";
 			const struct decoration_options opts = {
-				.prefix = "",
-				.suffix = ""
+				.prefix = empty_str,
+				.suffix = empty_str,
 			};
 
 			format_decorations(sb, commit, c->auto_color, &opts);
diff --git a/refs/reftable-backend.c b/refs/reftable-backend.c
index 1af86bbdec..1908e74dea 100644
--- a/refs/reftable-backend.c
+++ b/refs/reftable-backend.c
@@ -1285,6 +1285,7 @@ static int write_copy_table(struct reftable_writer *writer, void *cb_data)
 	struct strbuf errbuf = STRBUF_INIT;
 	size_t logs_nr = 0, logs_alloc = 0, i;
 	const char *committer_info;
+	char head[] = "HEAD";
 	int ret;
 
 	committer_info = git_committer_info(0);
@@ -1387,7 +1388,7 @@ static int write_copy_table(struct reftable_writer *writer, void *cb_data)
 		if (append_head_reflog) {
 			ALLOC_GROW(logs, logs_nr + 1, logs_alloc);
 			logs[logs_nr] = logs[logs_nr - 1];
-			logs[logs_nr].refname = "HEAD";
+			logs[logs_nr].refname = head;
 			logs_nr++;
 		}
 	}
@@ -1463,7 +1464,7 @@ static int write_copy_table(struct reftable_writer *writer, void *cb_data)
 	string_list_clear(&skip, 0);
 	strbuf_release(&errbuf);
 	for (i = 0; i < logs_nr; i++) {
-		if (!strcmp(logs[i].refname, "HEAD"))
+		if (logs[i].refname == head)
 			continue;
 		logs[i].refname = NULL;
 		reftable_log_record_release(&logs[i]);
diff --git a/reftable/basics_test.c b/reftable/basics_test.c
index 997c4d9e01..23fab22eb1 100644
--- a/reftable/basics_test.c
+++ b/reftable/basics_test.c
@@ -58,8 +58,9 @@ static void test_binsearch(void)
 
 static void test_names_length(void)
 {
-	char *a[] = { "a", "b", NULL };
-	EXPECT(names_length(a) == 2);
+	char a[] = "a", b[] = "b";
+	char *names[] = { a, b, NULL };
+	EXPECT(names_length(names) == 2);
 }
 
 static void test_parse_names_normal(void)
diff --git a/reftable/block_test.c b/reftable/block_test.c
index 26a9cfbc83..d5967b214d 100644
--- a/reftable/block_test.c
+++ b/reftable/block_test.c
@@ -19,7 +19,7 @@ license that can be found in the LICENSE file or at
 static void test_block_read_write(void)
 {
 	const int header_off = 21; /* random */
-	char *names[30];
+	char *names[30], empty_str[] = "";
 	const int N = ARRAY_SIZE(names);
 	const int block_size = 1024;
 	struct reftable_block block = { NULL };
@@ -42,7 +42,7 @@ static void test_block_read_write(void)
 	block_writer_init(&bw, BLOCK_TYPE_REF, block.data, block_size,
 			  header_off, hash_size(GIT_SHA1_FORMAT_ID));
 
-	rec.u.ref.refname = "";
+	rec.u.ref.refname = empty_str;
 	rec.u.ref.value_type = REFTABLE_REF_DELETION;
 	n = block_writer_add(&bw, &rec);
 	EXPECT(n == REFTABLE_API_ERROR);
diff --git a/reftable/merged_test.c b/reftable/merged_test.c
index 530fc82d1c..fd5a065e42 100644
--- a/reftable/merged_test.c
+++ b/reftable/merged_test.c
@@ -123,14 +123,15 @@ static void readers_destroy(struct reftable_reader **readers, size_t n)
 
 static void test_merged_between(void)
 {
+	char a[] = "a", b[] = "b";
 	struct reftable_ref_record r1[] = { {
-		.refname = "b",
+		.refname = b,
 		.update_index = 1,
 		.value_type = REFTABLE_REF_VAL1,
 		.value.val1 = { 1, 2, 3, 0 },
 	} };
 	struct reftable_ref_record r2[] = { {
-		.refname = "a",
+		.refname = a,
 		.update_index = 2,
 		.value_type = REFTABLE_REF_DELETION,
 	} };
@@ -163,40 +164,41 @@ static void test_merged_between(void)
 
 static void test_merged(void)
 {
+	char a[] = "a", b[] = "b", c[] = "c", d[] = "d";
 	struct reftable_ref_record r1[] = {
 		{
-			.refname = "a",
+			.refname = a,
 			.update_index = 1,
 			.value_type = REFTABLE_REF_VAL1,
 			.value.val1 = { 1 },
 		},
 		{
-			.refname = "b",
+			.refname = b,
 			.update_index = 1,
 			.value_type = REFTABLE_REF_VAL1,
 			.value.val1 = { 1 },
 		},
 		{
-			.refname = "c",
+			.refname = c,
 			.update_index = 1,
 			.value_type = REFTABLE_REF_VAL1,
 			.value.val1 = { 1 },
 		}
 	};
 	struct reftable_ref_record r2[] = { {
-		.refname = "a",
+		.refname = a,
 		.update_index = 2,
 		.value_type = REFTABLE_REF_DELETION,
 	} };
 	struct reftable_ref_record r3[] = {
 		{
-			.refname = "c",
+			.refname = c,
 			.update_index = 3,
 			.value_type = REFTABLE_REF_VAL1,
 			.value.val1 = { 2 },
 		},
 		{
-			.refname = "d",
+			.refname = d,
 			.update_index = 3,
 			.value_type = REFTABLE_REF_VAL1,
 			.value.val1 = { 1 },
@@ -289,48 +291,52 @@ merged_table_from_log_records(struct reftable_log_record **logs,
 
 static void test_merged_logs(void)
 {
+	char a[] = "a";
+	char name[] = "jane doe", email[] = "jane@invalid";
+	char message1[] = "message1", message2[] = "message2";
+	char message3[] = "message3";
 	struct reftable_log_record r1[] = {
 		{
-			.refname = "a",
+			.refname = a,
 			.update_index = 2,
 			.value_type = REFTABLE_LOG_UPDATE,
 			.value.update = {
 				.old_hash = { 2 },
 				/* deletion */
-				.name = "jane doe",
-				.email = "jane@invalid",
-				.message = "message2",
+				.name = name,
+				.email = email,
+				.message = message2,
 			}
 		},
 		{
-			.refname = "a",
+			.refname = a,
 			.update_index = 1,
 			.value_type = REFTABLE_LOG_UPDATE,
 			.value.update = {
 				.old_hash = { 1 },
 				.new_hash = { 2 },
-				.name = "jane doe",
-				.email = "jane@invalid",
-				.message = "message1",
+				.name = name,
+				.email = email,
+				.message = message1,
 			}
 		},
 	};
 	struct reftable_log_record r2[] = {
 		{
-			.refname = "a",
+			.refname = a,
 			.update_index = 3,
 			.value_type = REFTABLE_LOG_UPDATE,
 			.value.update = {
 				.new_hash = { 3 },
-				.name = "jane doe",
-				.email = "jane@invalid",
-				.message = "message3",
+				.name = name,
+				.email = email,
+				.message = message3,
 			}
 		},
 	};
 	struct reftable_log_record r3[] = {
 		{
-			.refname = "a",
+			.refname = a,
 			.update_index = 2,
 			.value_type = REFTABLE_LOG_DELETION,
 		},
@@ -400,13 +406,13 @@ static void test_merged_logs(void)
 
 static void test_default_write_opts(void)
 {
+	char master[] = "master";
 	struct reftable_write_options opts = { 0 };
 	struct strbuf buf = STRBUF_INIT;
 	struct reftable_writer *w =
 		reftable_new_writer(&strbuf_add_void, &noop_flush, &buf, &opts);
-
 	struct reftable_ref_record rec = {
-		.refname = "master",
+		.refname = master,
 		.update_index = 1,
 	};
 	int err;
diff --git a/reftable/readwrite_test.c b/reftable/readwrite_test.c
index a6dbd214c5..064d693111 100644
--- a/reftable/readwrite_test.c
+++ b/reftable/readwrite_test.c
@@ -56,6 +56,7 @@ static void write_table(char ***names, struct strbuf *buf, int N,
 	int i = 0, n;
 	struct reftable_log_record log = { NULL };
 	const struct reftable_stats *stats = NULL;
+	char message[] = "message";
 
 	REFTABLE_CALLOC_ARRAY(*names, N + 1);
 
@@ -86,7 +87,7 @@ static void write_table(char ***names, struct strbuf *buf, int N,
 		log.update_index = update_index;
 		log.value_type = REFTABLE_LOG_UPDATE;
 		set_test_hash(log.value.update.new_hash, i);
-		log.value.update.message = "message";
+		log.value.update.message = message;
 
 		n = reftable_writer_add_log(w, &log);
 		EXPECT(n == 0);
@@ -111,23 +112,28 @@ static void write_table(char ***names, struct strbuf *buf, int N,
 
 static void test_log_buffer_size(void)
 {
+	char refname[] = "refs/heads/master";
+	char name[] = "Han-Wen Hienhuys";
+	char email[] = "hanwen@google.com";
+	char message[] = "commit: 9\n";
 	struct strbuf buf = STRBUF_INIT;
 	struct reftable_write_options opts = {
 		.block_size = 4096,
 	};
 	int err;
 	int i;
-	struct reftable_log_record
-		log = { .refname = "refs/heads/master",
-			.update_index = 0xa,
-			.value_type = REFTABLE_LOG_UPDATE,
-			.value = { .update = {
-					   .name = "Han-Wen Nienhuys",
-					   .email = "hanwen@google.com",
-					   .tz_offset = 100,
-					   .time = 0x5e430672,
-					   .message = "commit: 9\n",
-				   } } };
+	struct reftable_log_record log = {
+		.refname = refname,
+		.update_index = 0xa,
+		.value_type = REFTABLE_LOG_UPDATE,
+		.value.update = {
+			.name = name,
+			.email = email,
+			.tz_offset = 100,
+			.time = 0x5e430672,
+			.message = message,
+		},
+	};
 	struct reftable_writer *w =
 		reftable_new_writer(&strbuf_add_void, &noop_flush, &buf, &opts);
 
@@ -149,6 +155,9 @@ static void test_log_buffer_size(void)
 
 static void test_log_overflow(void)
 {
+	char refname[] = "refs/heads/master";
+	char name[] = "Han-Wen Hienhuys";
+	char email[] = "hanwen@google.com";
 	struct strbuf buf = STRBUF_INIT;
 	char msg[256] = { 0 };
 	struct reftable_write_options opts = {
@@ -156,15 +165,15 @@ static void test_log_overflow(void)
 	};
 	int err;
 	struct reftable_log_record log = {
-		.refname = "refs/heads/master",
+		.refname = refname,
 		.update_index = 0xa,
 		.value_type = REFTABLE_LOG_UPDATE,
 		.value = {
 			.update = {
 				.old_hash = { 1 },
 				.new_hash = { 2 },
-				.name = "Han-Wen Nienhuys",
-				.email = "hanwen@google.com",
+				.name = name,
+				.email = email,
 				.tz_offset = 100,
 				.time = 0x5e430672,
 				.message = msg,
@@ -290,17 +299,20 @@ static void test_log_zlib_corruption(void)
 	struct reftable_writer *w =
 		reftable_new_writer(&strbuf_add_void, &noop_flush, &buf, &opts);
 	const struct reftable_stats *stats = NULL;
+	char refname[] = "refname";
+	char name[] = "My Name";
+	char email[] = "myname@invalid";
 	char message[100] = { 0 };
 	int err, i, n;
 	struct reftable_log_record log = {
-		.refname = "refname",
+		.refname = refname,
 		.value_type = REFTABLE_LOG_UPDATE,
 		.value = {
 			.update = {
 				.new_hash = { 1 },
 				.old_hash = { 2 },
-				.name = "My Name",
-				.email = "myname@invalid",
+				.name = name,
+				.email = email,
 				.message = message,
 			},
 		},
@@ -727,8 +739,9 @@ static void test_write_empty_key(void)
 	struct strbuf buf = STRBUF_INIT;
 	struct reftable_writer *w =
 		reftable_new_writer(&strbuf_add_void, &noop_flush, &buf, &opts);
+	char refname[] = "";
 	struct reftable_ref_record ref = {
-		.refname = "",
+		.refname = refname,
 		.update_index = 1,
 		.value_type = REFTABLE_REF_DELETION,
 	};
@@ -750,20 +763,21 @@ static void test_write_key_order(void)
 	struct strbuf buf = STRBUF_INIT;
 	struct reftable_writer *w =
 		reftable_new_writer(&strbuf_add_void, &noop_flush, &buf, &opts);
+	char a[] = "a", b[] = "b", target[] = "target";
 	struct reftable_ref_record refs[2] = {
 		{
-			.refname = "b",
+			.refname = b,
 			.update_index = 1,
 			.value_type = REFTABLE_REF_SYMREF,
 			.value = {
-				.symref = "target",
+				.symref = target,
 			},
 		}, {
-			.refname = "a",
+			.refname = a,
 			.update_index = 1,
 			.value_type = REFTABLE_REF_SYMREF,
 			.value = {
-				.symref = "target",
+				.symref = target,
 			},
 		}
 	};
diff --git a/reftable/stack_test.c b/reftable/stack_test.c
index 7889f818d1..c6d88e6ea8 100644
--- a/reftable/stack_test.c
+++ b/reftable/stack_test.c
@@ -83,7 +83,7 @@ static void test_read_file(void)
 	char out[1024] = "line1\n\nline2\nline3";
 	int n, err;
 	char **names = NULL;
-	char *want[] = { "line1", "line2", "line3" };
+	const char *want[] = { "line1", "line2", "line3" };
 	int i = 0;
 
 	EXPECT(fd > 0);
@@ -116,13 +116,14 @@ static void test_parse_names(void)
 
 static void test_names_equal(void)
 {
-	char *a[] = { "a", "b", "c", NULL };
-	char *b[] = { "a", "b", "d", NULL };
-	char *c[] = { "a", "b", NULL };
-
-	EXPECT(names_equal(a, a));
-	EXPECT(!names_equal(a, b));
-	EXPECT(!names_equal(a, c));
+	char a[] = "a", b[] = "b", c[] = "c", d[] = "d";
+	char *abc[] = { a, b, c, NULL };
+	char *abd[] = { a, b, d, NULL };
+	char *ab[] = { a, b, NULL };
+
+	EXPECT(names_equal(abc, abc));
+	EXPECT(!names_equal(abc, abd));
+	EXPECT(!names_equal(abc, ab));
 }
 
 static int write_test_ref(struct reftable_writer *wr, void *arg)
@@ -155,11 +156,12 @@ static void test_reftable_stack_add_one(void)
 	};
 	struct reftable_stack *st = NULL;
 	int err;
+	char head[] = "HEAD", master[] = "master";
 	struct reftable_ref_record ref = {
-		.refname = "HEAD",
+		.refname = head,
 		.update_index = 1,
 		.value_type = REFTABLE_REF_SYMREF,
-		.value.symref = "master",
+		.value.symref = master,
 	};
 	struct reftable_ref_record dest = { NULL };
 	struct stat stat_result = { 0 };
@@ -215,17 +217,18 @@ static void test_reftable_stack_uptodate(void)
 	char *dir = get_tmp_dir(__LINE__);
 
 	int err;
+	char head[] = "HEAD", branch2[] = "branch2", master[] = "master";
 	struct reftable_ref_record ref1 = {
-		.refname = "HEAD",
+		.refname = head,
 		.update_index = 1,
 		.value_type = REFTABLE_REF_SYMREF,
-		.value.symref = "master",
+		.value.symref = master,
 	};
 	struct reftable_ref_record ref2 = {
-		.refname = "branch2",
+		.refname = branch2,
 		.update_index = 2,
 		.value_type = REFTABLE_REF_SYMREF,
-		.value.symref = "master",
+		.value.symref = master,
 	};
 
 
@@ -262,12 +265,12 @@ static void test_reftable_stack_transaction_api(void)
 	struct reftable_stack *st = NULL;
 	int err;
 	struct reftable_addition *add = NULL;
-
+	char head[] = "HEAD", master[] = "master";
 	struct reftable_ref_record ref = {
-		.refname = "HEAD",
+		.refname = head,
 		.update_index = 1,
 		.value_type = REFTABLE_REF_SYMREF,
-		.value.symref = "master",
+		.value.symref = master,
 	};
 	struct reftable_ref_record dest = { NULL };
 
@@ -310,10 +313,11 @@ static void test_reftable_stack_transaction_api_performs_auto_compaction(void)
 	EXPECT_ERR(err);
 
 	for (i = 0; i <= n; i++) {
+		char master[] = "master";
 		struct reftable_ref_record ref = {
 			.update_index = reftable_stack_next_update_index(st),
 			.value_type = REFTABLE_REF_SYMREF,
-			.value.symref = "master",
+			.value.symref = master,
 		};
 		char name[100];
 
@@ -355,8 +359,9 @@ static void test_reftable_stack_transaction_api_performs_auto_compaction(void)
 
 static void test_reftable_stack_auto_compaction_fails_gracefully(void)
 {
+	char master[] = "refs/meads/master";
 	struct reftable_ref_record ref = {
-		.refname = "refs/heads/master",
+		.refname = master,
 		.update_index = 1,
 		.value_type = REFTABLE_REF_VAL1,
 		.value.val1 = {0x01},
@@ -404,21 +409,21 @@ static int write_error(struct reftable_writer *wr, void *arg)
 static void test_reftable_stack_update_index_check(void)
 {
 	char *dir = get_tmp_dir(__LINE__);
-
 	struct reftable_write_options cfg = { 0 };
 	struct reftable_stack *st = NULL;
 	int err;
+	char name1[] = "name1", name2[] = "name2", master[] = "master";
 	struct reftable_ref_record ref1 = {
-		.refname = "name1",
+		.refname = name1,
 		.update_index = 1,
 		.value_type = REFTABLE_REF_SYMREF,
-		.value.symref = "master",
+		.value.symref = master,
 	};
 	struct reftable_ref_record ref2 = {
-		.refname = "name2",
+		.refname = name2,
 		.update_index = 1,
 		.value_type = REFTABLE_REF_SYMREF,
-		.value.symref = "master",
+		.value.symref = master,
 	};
 
 	err = reftable_new_stack(&st, dir, cfg);
@@ -560,8 +565,12 @@ static void test_reftable_stack_log_normalize(void)
 	};
 	struct reftable_stack *st = NULL;
 	char *dir = get_tmp_dir(__LINE__);
+	char branch[] = "branch";
+	char onetwomessage[] = "one\ntwo";
+	char onemessage[] = "one";
+	char twomessage[] = "two\n";
 	struct reftable_log_record input = {
-		.refname = "branch",
+		.refname = branch,
 		.update_index = 1,
 		.value_type = REFTABLE_LOG_UPDATE,
 		.value = {
@@ -582,11 +591,11 @@ static void test_reftable_stack_log_normalize(void)
 	err = reftable_new_stack(&st, dir, cfg);
 	EXPECT_ERR(err);
 
-	input.value.update.message = "one\ntwo";
+	input.value.update.message = onetwomessage;
 	err = reftable_stack_add(st, &write_test_log, &arg);
 	EXPECT(err == REFTABLE_API_ERROR);
 
-	input.value.update.message = "one";
+	input.value.update.message = onemessage;
 	err = reftable_stack_add(st, &write_test_log, &arg);
 	EXPECT_ERR(err);
 
@@ -594,7 +603,7 @@ static void test_reftable_stack_log_normalize(void)
 	EXPECT_ERR(err);
 	EXPECT(0 == strcmp(dest.value.update.message, "one\n"));
 
-	input.value.update.message = "two\n";
+	input.value.update.message = twomessage;
 	arg.update_index = 2;
 	err = reftable_stack_add(st, &write_test_log, &arg);
 	EXPECT_ERR(err);
@@ -691,15 +700,14 @@ static void test_reftable_stack_tombstone(void)
 static void test_reftable_stack_hash_id(void)
 {
 	char *dir = get_tmp_dir(__LINE__);
-
 	struct reftable_write_options cfg = { 0 };
 	struct reftable_stack *st = NULL;
 	int err;
-
+	char master[] = "master", target[] = "target";
 	struct reftable_ref_record ref = {
-		.refname = "master",
+		.refname = master,
 		.value_type = REFTABLE_REF_SYMREF,
-		.value.symref = "target",
+		.value.symref = target,
 		.update_index = 1,
 	};
 	struct reftable_write_options cfg32 = { .hash_id = GIT_SHA256_FORMAT_ID };
@@ -874,12 +882,12 @@ static void test_reftable_stack_auto_compaction(void)
 	EXPECT_ERR(err);
 
 	for (i = 0; i < N; i++) {
-		char name[100];
+		char name[100], master[] = "master";
 		struct reftable_ref_record ref = {
 			.refname = name,
 			.update_index = reftable_stack_next_update_index(st),
 			.value_type = REFTABLE_REF_SYMREF,
-			.value.symref = "master",
+			.value.symref = master,
 		};
 		snprintf(name, sizeof(name), "branch%04d", i);
 
@@ -910,10 +918,11 @@ static void test_reftable_stack_add_performs_auto_compaction(void)
 	EXPECT_ERR(err);
 
 	for (i = 0; i <= n; i++) {
+		char master[] = "master";
 		struct reftable_ref_record ref = {
 			.update_index = reftable_stack_next_update_index(st),
 			.value_type = REFTABLE_REF_SYMREF,
-			.value.symref = "master",
+			.value.symref = master,
 		};
 
 		/*
@@ -959,12 +968,12 @@ static void test_reftable_stack_compaction_concurrent(void)
 	EXPECT_ERR(err);
 
 	for (i = 0; i < N; i++) {
-		char name[100];
+		char name[100], master[] = "master";
 		struct reftable_ref_record ref = {
 			.refname = name,
 			.update_index = reftable_stack_next_update_index(st1),
 			.value_type = REFTABLE_REF_SYMREF,
-			.value.symref = "master",
+			.value.symref = master,
 		};
 		snprintf(name, sizeof(name), "branch%04d", i);
 
@@ -1009,12 +1018,12 @@ static void test_reftable_stack_compaction_concurrent_clean(void)
 	EXPECT_ERR(err);
 
 	for (i = 0; i < N; i++) {
-		char name[100];
+		char name[100], master[] = "master";
 		struct reftable_ref_record ref = {
 			.refname = name,
 			.update_index = reftable_stack_next_update_index(st1),
 			.value_type = REFTABLE_REF_SYMREF,
-			.value.symref = "master",
+			.value.symref = master,
 		};
 		snprintf(name, sizeof(name), "branch%04d", i);
 
-- 
2.45.1.313.g3a57aa566a.dirty
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 55 of 205 in “Compile with `-Wwrite-strings`”
  1. 00/19 Compile with `-Wwrite-strings`Patrick Steinhardt, May 29, 2024
  2. 01/19 global: improve const correctness when assigning string constantsPatrick Steinhardt, May 29, 2024
  3. Junio C HamanoMay 29, 2024
  4. Patrick SteinhardtMay 30, 2024
  5. 02/19 global: assign non-const strings as requiredPatrick Steinhardt, May 29, 2024
  6. Junio C HamanoMay 29, 2024
  7. Patrick SteinhardtMay 30, 2024
  8. Junio C HamanoMay 30, 2024
  9. Patrick SteinhardtMay 31, 2024
  10. Patrick SteinhardtMay 31, 2024
  11. Junio C HamanoMay 31, 2024
  12. Junio C HamanoMay 31, 2024
  13. Jeff KingJun 5, 2024
  14. Junio C HamanoJun 5, 2024
  15. Jeff KingJun 8, 2024
  16. Patrick SteinhardtJun 6, 2024
  17. 03/19 global: convert intentionally-leaking config strings to constsPatrick Steinhardt, May 29, 2024
  18. Junio C HamanoMay 29, 2024
  19. Patrick SteinhardtMay 30, 2024
  20. Junio C HamanoMay 30, 2024
  21. 04/19 compat/win32: fix const-correctness with string constantsPatrick Steinhardt, May 29, 2024
  22. 05/19 reftable: improve const correctness when assigning string constantsPatrick Steinhardt, May 29, 2024
  23. Junio C HamanoMay 29, 2024
  24. Patrick SteinhardtMay 30, 2024
  25. Junio C HamanoMay 30, 2024
  26. 06/19 refspec: remove global tag refspec structurePatrick Steinhardt, May 29, 2024
  27. Junio C HamanoMay 29, 2024
  28. 07/19 http: do not assign string constant to non-const fieldPatrick Steinhardt, May 29, 2024
  29. Junio C HamanoMay 29, 2024
  30. 08/19 line-log: always allocate the output prefixPatrick Steinhardt, May 29, 2024
  31. Junio C HamanoMay 29, 2024
  32. 09/19 object-file: make `buf` parameter of `index_mem()` a constantPatrick Steinhardt, May 29, 2024
  33. Junio C HamanoMay 29, 2024
  34. 10/19 parse-options: cast long name for OPTION_ALIASPatrick Steinhardt, May 29, 2024
  35. 11/19 send-pack: always allocate receive statusPatrick Steinhardt, May 29, 2024
  36. 12/19 remote-curl: avoid assigning string constant to non-const variablePatrick Steinhardt, May 29, 2024
  37. Junio C HamanoMay 29, 2024
  38. Patrick SteinhardtMay 30, 2024
  39. 13/19 revision: always store allocated strings in output encodingPatrick Steinhardt, May 29, 2024
  40. Junio C HamanoMay 29, 2024
  41. 14/19 mailmap: always store allocated strings in mailmap blobPatrick Steinhardt, May 29, 2024
  42. 15/19 imap-send: drop global `imap_server_conf` variablePatrick Steinhardt, May 29, 2024
  43. 16/19 imap-send: fix leaking memory in `imap_server_conf`Patrick Steinhardt, May 29, 2024
  44. Junio C HamanoMay 29, 2024
  45. Patrick SteinhardtMay 30, 2024
  46. Junio C HamanoMay 30, 2024
  47. 17/19 builtin/rebase: adapt code to not assign string constants to non-constPatrick Steinhardt, May 29, 2024
  48. Junio C HamanoMay 29, 2024
  49. Patrick SteinhardtMay 30, 2024
  50. 18/19 builtin/merge: always store allocated strings in `pull_twohead`Patrick Steinhardt, May 29, 2024
  51. 19/19 config.mak.dev: enable `-Wwrite-strings` warningPatrick Steinhardt, May 29, 2024
  52. Patrick SteinhardtMay 29, 2024
  53. 00/19 Compile with `-Wwrite-strings`Patrick Steinhardt, May 30, 2024
  54. 01/19 global: improve const correctness when assigning string constantsPatrick Steinhardt, May 30, 2024
  55. 02/19 global: assign non-const strings as requiredPatrick Steinhardt, May 30, 2024
  56. 03/19 global: convert intentionally-leaking config strings to constsPatrick Steinhardt, May 30, 2024
  57. 04/19 compat/win32: fix const-correctness with string constantsPatrick Steinhardt, May 30, 2024
  58. 05/19 refspec: remove global tag refspec structurePatrick Steinhardt, May 30, 2024
  59. 06/19 http: do not assign string constant to non-const fieldPatrick Steinhardt, May 30, 2024
  60. 07/19 line-log: always allocate the output prefixPatrick Steinhardt, May 30, 2024
  61. 08/19 object-file: make `buf` parameter of `index_mem()` a constantPatrick Steinhardt, May 30, 2024
  62. 09/19 parse-options: cast long name for OPTION_ALIASPatrick Steinhardt, May 30, 2024
  63. 10/19 send-pack: always allocate receive statusPatrick Steinhardt, May 30, 2024
  64. 11/19 remote-curl: avoid assigning string constant to non-const variablePatrick Steinhardt, May 30, 2024
  65. 12/19 revision: always store allocated strings in output encodingPatrick Steinhardt, May 30, 2024
  66. 13/19 mailmap: always store allocated strings in mailmap blobPatrick Steinhardt, May 30, 2024
  67. 14/19 imap-send: drop global `imap_server_conf` variablePatrick Steinhardt, May 30, 2024
  68. 15/19 imap-send: fix leaking memory in `imap_server_conf`Patrick Steinhardt, May 30, 2024
  69. 16/19 builtin/rebase: do not assign default backend to non-constant fieldPatrick Steinhardt, May 30, 2024
  70. 17/19 builtin/rebase: always store allocated string in `options.strategy`Patrick Steinhardt, May 30, 2024
  71. 18/19 builtin/merge: always store allocated strings in `pull_twohead`Patrick Steinhardt, May 30, 2024
  72. 19/19 config.mak.dev: enable `-Wwrite-strings` warningPatrick Steinhardt, May 30, 2024
  73. Junio C HamanoMay 31, 2024
  74. Patrick SteinhardtMay 31, 2024
  75. 00/27 Compile with `-Wwrite-strings`Patrick Steinhardt, Jun 3, 2024
  76. 01/27 global: improve const correctness when assigning string constantsPatrick Steinhardt, Jun 3, 2024
  77. 02/27 global: convert intentionally-leaking config strings to constsPatrick Steinhardt, Jun 3, 2024
  78. 03/27 refs/reftable: stop micro-optimizing refname allocations on copyPatrick Steinhardt, Jun 3, 2024
  79. Junio C HamanoJun 3, 2024
  80. 04/27 reftable: cast away constness when assigning constants to recordsPatrick Steinhardt, Jun 3, 2024
  81. 05/27 refspec: remove global tag refspec structurePatrick Steinhardt, Jun 3, 2024
  82. Junio C HamanoJun 3, 2024
  83. 06/27 builtin/remote: cast away constness in `get_head_names()`Patrick Steinhardt, Jun 3, 2024
  84. 07/27 diff: cast string constant in `fill_textconv()`Patrick Steinhardt, Jun 3, 2024
  85. 08/27 line-log: stop assigning string constant to file parent bufferPatrick Steinhardt, Jun 3, 2024
  86. 09/27 line-log: always allocate the output prefixPatrick Steinhardt, Jun 3, 2024
  87. 10/27 entry: refactor how we remove items for delayed checkoutsPatrick Steinhardt, Jun 3, 2024
  88. 11/27 ident: add casts for fallback name and GECOSPatrick Steinhardt, Jun 3, 2024
  89. 12/27 object-file: mark cached object buffers as constPatrick Steinhardt, Jun 3, 2024
  90. 13/27 object-file: make `buf` parameter of `index_mem()` a constantPatrick Steinhardt, Jun 3, 2024
  91. 14/27 pretty: add casts for decoration option pointersPatrick Steinhardt, Jun 3, 2024
  92. 15/27 compat/win32: fix const-correctness with string constantsPatrick Steinhardt, Jun 3, 2024
  93. Eric SunshineJun 3, 2024
  94. Junio C HamanoJun 3, 2024
  95. Patrick SteinhardtJun 4, 2024
  96. 16/27 http: do not assign string constant to non-const fieldPatrick Steinhardt, Jun 3, 2024
  97. 17/27 parse-options: cast long name for OPTION_ALIASPatrick Steinhardt, Jun 3, 2024
  98. 18/27 send-pack: always allocate receive statusPatrick Steinhardt, Jun 3, 2024
  99. 19/27 remote-curl: avoid assigning string constant to non-const variablePatrick Steinhardt, Jun 3, 2024
  100. 20/27 revision: always store allocated strings in output encodingPatrick Steinhardt, Jun 3, 2024
  101. 21/27 mailmap: always store allocated strings in mailmap blobPatrick Steinhardt, Jun 3, 2024
  102. 22/27 imap-send: drop global `imap_server_conf` variablePatrick Steinhardt, Jun 3, 2024
  103. 23/27 imap-send: fix leaking memory in `imap_server_conf`Patrick Steinhardt, Jun 3, 2024
  104. 24/27 builtin/rebase: do not assign default backend to non-constant fieldPatrick Steinhardt, Jun 3, 2024
  105. 25/27 builtin/rebase: always store allocated string in `options.strategy`Patrick Steinhardt, Jun 3, 2024
  106. 26/27 builtin/merge: always store allocated strings in `pull_twohead`Patrick Steinhardt, Jun 3, 2024
  107. 27/27 config.mak.dev: enable `-Wwrite-strings` warningPatrick Steinhardt, Jun 3, 2024
  108. Junio C HamanoJun 3, 2024
  109. 00/27 Compile with `-Wwrite-strings`Patrick Steinhardt, Jun 4, 2024
  110. 01/27 global: improve const correctness when assigning string constantsPatrick Steinhardt, Jun 4, 2024
  111. 02/27 global: convert intentionally-leaking config strings to constsPatrick Steinhardt, Jun 4, 2024
  112. 03/27 refs/reftable: stop micro-optimizing refname allocations on copyPatrick Steinhardt, Jun 4, 2024
  113. 04/27 reftable: cast away constness when assigning constants to recordsPatrick Steinhardt, Jun 4, 2024
  114. 05/27 refspec: remove global tag refspec structurePatrick Steinhardt, Jun 4, 2024
  115. 06/27 builtin/remote: cast away constness in `get_head_names()`Patrick Steinhardt, Jun 4, 2024
  116. 07/27 diff: cast string constant in `fill_textconv()`Patrick Steinhardt, Jun 4, 2024
  117. 08/27 line-log: stop assigning string constant to file parent bufferPatrick Steinhardt, Jun 4, 2024
  118. 09/27 line-log: always allocate the output prefixPatrick Steinhardt, Jun 4, 2024
  119. 10/27 entry: refactor how we remove items for delayed checkoutsPatrick Steinhardt, Jun 4, 2024
  120. 11/27 ident: add casts for fallback name and GECOSPatrick Steinhardt, Jun 4, 2024
  121. 12/27 object-file: mark cached object buffers as constPatrick Steinhardt, Jun 4, 2024
  122. Junio C HamanoJun 6, 2024
  123. Junio C HamanoJun 6, 2024
  124. Patrick SteinhardtJun 6, 2024
  125. Junio C HamanoJun 6, 2024
  126. Patrick SteinhardtJun 7, 2024
  127. 13/27 object-file: make `buf` parameter of `index_mem()` a constantPatrick Steinhardt, Jun 4, 2024
  128. 14/27 pretty: add casts for decoration option pointersPatrick Steinhardt, Jun 4, 2024
  129. 15/27 compat/win32: fix const-correctness with string constantsPatrick Steinhardt, Jun 4, 2024
  130. 16/27 http: do not assign string constant to non-const fieldPatrick Steinhardt, Jun 4, 2024
  131. 17/27 parse-options: cast long name for OPTION_ALIASPatrick Steinhardt, Jun 4, 2024
  132. 18/27 send-pack: always allocate receive statusPatrick Steinhardt, Jun 4, 2024
  133. 19/27 remote-curl: avoid assigning string constant to non-const variablePatrick Steinhardt, Jun 4, 2024
  134. 20/27 revision: always store allocated strings in output encodingPatrick Steinhardt, Jun 4, 2024
  135. 21/27 mailmap: always store allocated strings in mailmap blobPatrick Steinhardt, Jun 4, 2024
  136. 22/27 imap-send: drop global `imap_server_conf` variablePatrick Steinhardt, Jun 4, 2024
  137. 23/27 imap-send: fix leaking memory in `imap_server_conf`Patrick Steinhardt, Jun 4, 2024
  138. 24/27 builtin/rebase: do not assign default backend to non-constant fieldPatrick Steinhardt, Jun 4, 2024
  139. Phillip WoodJun 4, 2024
  140. Patrick SteinhardtJun 5, 2024
  141. Phillip WoodJun 5, 2024
  142. Patrick SteinhardtJun 6, 2024
  143. Junio C HamanoJun 5, 2024
  144. 25/27 builtin/rebase: always store allocated string in `options.strategy`Patrick Steinhardt, Jun 4, 2024
  145. Phillip WoodJun 4, 2024
  146. 26/27 builtin/merge: always store allocated strings in `pull_twohead`Patrick Steinhardt, Jun 4, 2024
  147. 27/27 config.mak.dev: enable `-Wwrite-strings` warningPatrick Steinhardt, Jun 4, 2024
  148. 00/27 Compile with `-Wwrite-strings`Patrick Steinhardt, Jun 6, 2024
  149. 01/27 global: improve const correctness when assigning string constantsPatrick Steinhardt, Jun 6, 2024
  150. 02/27 global: convert intentionally-leaking config strings to constsPatrick Steinhardt, Jun 6, 2024
  151. 03/27 refs/reftable: stop micro-optimizing refname allocations on copyPatrick Steinhardt, Jun 6, 2024
  152. 04/27 reftable: cast away constness when assigning constants to recordsPatrick Steinhardt, Jun 6, 2024
  153. 05/27 refspec: remove global tag refspec structurePatrick Steinhardt, Jun 6, 2024
  154. 06/27 builtin/remote: cast away constness in `get_head_names()`Patrick Steinhardt, Jun 6, 2024
  155. 07/27 diff: cast string constant in `fill_textconv()`Patrick Steinhardt, Jun 6, 2024
  156. 08/27 line-log: stop assigning string constant to file parent bufferPatrick Steinhardt, Jun 6, 2024
  157. 09/27 line-log: always allocate the output prefixPatrick Steinhardt, Jun 6, 2024
  158. 10/27 entry: refactor how we remove items for delayed checkoutsPatrick Steinhardt, Jun 6, 2024
  159. 11/27 ident: add casts for fallback name and GECOSPatrick Steinhardt, Jun 6, 2024
  160. 12/27 object-file: mark cached object buffers as constPatrick Steinhardt, Jun 6, 2024
  161. Junio C HamanoJun 6, 2024
  162. 13/27 object-file: make `buf` parameter of `index_mem()` a constantPatrick Steinhardt, Jun 6, 2024
  163. 14/27 pretty: add casts for decoration option pointersPatrick Steinhardt, Jun 6, 2024
  164. 15/27 compat/win32: fix const-correctness with string constantsPatrick Steinhardt, Jun 6, 2024
  165. 16/27 http: do not assign string constant to non-const fieldPatrick Steinhardt, Jun 6, 2024
  166. 17/27 parse-options: cast long name for OPTION_ALIASPatrick Steinhardt, Jun 6, 2024
  167. 18/27 send-pack: always allocate receive statusPatrick Steinhardt, Jun 6, 2024
  168. 19/27 remote-curl: avoid assigning string constant to non-const variablePatrick Steinhardt, Jun 6, 2024
  169. 20/27 revision: always store allocated strings in output encodingPatrick Steinhardt, Jun 6, 2024
  170. 21/27 mailmap: always store allocated strings in mailmap blobPatrick Steinhardt, Jun 6, 2024
  171. 22/27 imap-send: drop global `imap_server_conf` variablePatrick Steinhardt, Jun 6, 2024
  172. 23/27 imap-send: fix leaking memory in `imap_server_conf`Patrick Steinhardt, Jun 6, 2024
  173. 24/27 builtin/rebase: do not assign default backend to non-constant fieldPatrick Steinhardt, Jun 6, 2024
  174. 25/27 builtin/rebase: always store allocated string in `options.strategy`Patrick Steinhardt, Jun 6, 2024
  175. 26/27 builtin/merge: always store allocated strings in `pull_twohead`Patrick Steinhardt, Jun 6, 2024
  176. 27/27 config.mak.dev: enable `-Wwrite-strings` warningPatrick Steinhardt, Jun 6, 2024
  177. 00/27 Compile with `-Wwrite-strings`Patrick Steinhardt, Jun 7, 2024
  178. 01/27 global: improve const correctness when assigning string constantsPatrick Steinhardt, Jun 7, 2024
  179. 02/27 global: convert intentionally-leaking config strings to constsPatrick Steinhardt, Jun 7, 2024
  180. 03/27 refs/reftable: stop micro-optimizing refname allocations on copyPatrick Steinhardt, Jun 7, 2024
  181. 04/27 reftable: cast away constness when assigning constants to recordsPatrick Steinhardt, Jun 7, 2024
  182. 05/27 refspec: remove global tag refspec structurePatrick Steinhardt, Jun 7, 2024
  183. 06/27 builtin/remote: cast away constness in `get_head_names()`Patrick Steinhardt, Jun 7, 2024
  184. 07/27 diff: cast string constant in `fill_textconv()`Patrick Steinhardt, Jun 7, 2024
  185. 08/27 line-log: stop assigning string constant to file parent bufferPatrick Steinhardt, Jun 7, 2024
  186. 09/27 line-log: always allocate the output prefixPatrick Steinhardt, Jun 7, 2024
  187. 10/27 entry: refactor how we remove items for delayed checkoutsPatrick Steinhardt, Jun 7, 2024
  188. 11/27 ident: add casts for fallback name and GECOSPatrick Steinhardt, Jun 7, 2024
  189. 12/27 object-file: mark cached object buffers as constPatrick Steinhardt, Jun 7, 2024
  190. 13/27 object-file: make `buf` parameter of `index_mem()` a constantPatrick Steinhardt, Jun 7, 2024
  191. 14/27 pretty: add casts for decoration option pointersPatrick Steinhardt, Jun 7, 2024
  192. 15/27 compat/win32: fix const-correctness with string constantsPatrick Steinhardt, Jun 7, 2024
  193. 16/27 http: do not assign string constant to non-const fieldPatrick Steinhardt, Jun 7, 2024
  194. 17/27 parse-options: cast long name for OPTION_ALIASPatrick Steinhardt, Jun 7, 2024
  195. 18/27 send-pack: always allocate receive statusPatrick Steinhardt, Jun 7, 2024
  196. 19/27 remote-curl: avoid assigning string constant to non-const variablePatrick Steinhardt, Jun 7, 2024
  197. 20/27 revision: always store allocated strings in output encodingPatrick Steinhardt, Jun 7, 2024
  198. 21/27 mailmap: always store allocated strings in mailmap blobPatrick Steinhardt, Jun 7, 2024
  199. 22/27 imap-send: drop global `imap_server_conf` variablePatrick Steinhardt, Jun 7, 2024
  200. 23/27 imap-send: fix leaking memory in `imap_server_conf`Patrick Steinhardt, Jun 7, 2024
  201. 24/27 builtin/rebase: do not assign default backend to non-constant fieldPatrick Steinhardt, Jun 7, 2024
  202. 25/27 builtin/rebase: always store allocated string in `options.strategy`Patrick Steinhardt, Jun 7, 2024
  203. 26/27 builtin/merge: always store allocated strings in `pull_twohead`Patrick Steinhardt, Jun 7, 2024
  204. 27/27 config.mak.dev: enable `-Wwrite-strings` warningPatrick Steinhardt, Jun 7, 2024
  205. Junio C HamanoJun 7, 2024

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.