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

[PATCH 04/12] contrib/credential: fix compiling "libsecret" helper

From
Patrick Steinhardt <ps@pks.im>
Date
Feb 18, 2025, 07:45 UTC
Message-ID
<20250218-b4-pks-meson-contrib-v1-4-c3edd292beb8@pks.im>
In-Reply-To
<20250218-b4-pks-meson-contrib-v1-0-c3edd292beb8@pks.im>

The "libsecret" credential helper does not compile when developer warnings are enabled due to three warnings:

    - contrib/credential/libsecret/git-credential-libsecret.c:78:1:
      missing initializer for field ‘reserved’ of ‘SecretSchema’
      [-Werror=missing-field-initializers]. This issue is fixed by using
      designated initializers.
    - contrib/credential/libsecret/git-credential-libsecret.c:171:43:
      comparison of integer expressions of different signedness: ‘int’
      and ‘guint’ {aka ‘unsigned int’} [-Werror=sign-compare]. This
      issue is fixed by using an unsigned variable to iterate through
      the string vector.
    - contrib/credential/libsecret/git-credential-libsecret.c:420:14:
      unused parameter ‘argc’ [-Werror=unused-parameter]. This issue is
      fixed by checking the number of arguments, but in the least
      restrictive way possible.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 contrib/credential/libsecret/git-credential-libsecret.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/contrib/credential/libsecret/git-credential-libsecret.c b/contrib/credential/libsecret/git-credential-libsecret.c
index 90034d0cf1e..941b2afd5ee 100644
--- a/contrib/credential/libsecret/git-credential-libsecret.c
+++ b/contrib/credential/libsecret/git-credential-libsecret.c
@@ -59,10 +59,10 @@ static void credential_clear(struct credential *c);
 /* ----------------- Secret Service functions ----------------- */
 
 static const SecretSchema schema = {
-	"org.git.Password",
+	.name = "org.git.Password",
 	/* Ignore schema name during search for backwards compatibility */
-	SECRET_SCHEMA_DONT_MATCH_NAME,
-	{
+	.flags = SECRET_SCHEMA_DONT_MATCH_NAME,
+	.attributes = {
 		/*
 		 * libsecret assumes attribute values are non-confidential and
 		 * unchanging, so we can't include oauth_refresh_token or
@@ -168,7 +168,7 @@ static int keyring_get(struct credential *c)
 				g_free(c->password);
 				c->password = g_strdup("");
 			}
-			for (int i = 1; i < g_strv_length(parts); i++) {
+			for (guint i = 1; i < g_strv_length(parts); i++) {
 				if (g_str_has_prefix(parts[i], "password_expiry_utc=")) {
 					g_free(c->password_expiry_utc);
 					c->password_expiry_utc = g_strdup(&parts[i][20]);
@@ -424,7 +424,7 @@ int main(int argc, char *argv[])
 	struct credential_operation const *try_op = credential_helper_ops;
 	struct credential cred = CREDENTIAL_INIT;
 
-	if (!argv[1]) {
+	if (argc < 2 || !*argv[1]) {
 		usage(argv[0]);
 		exit(EXIT_FAILURE);
 	}
-- 
2.48.1.666.gff9fcf71b7.dirty
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 6 of 37 in “meson: wire up bits and pieces from "contrib/"”
  1. 00/12 meson: wire up bits and pieces from "contrib/"Patrick Steinhardt, Feb 18, 2025
  2. 01/12 GIT-BUILD-OPTIONS: propagate project's source directoryPatrick Steinhardt, Feb 18, 2025
  3. 02/12 contrib/credential: fix "netrc" tests with out-of-tree buildsPatrick Steinhardt, Feb 18, 2025
  4. 03/12 contrib/credential: fix compilation of wincred helper with MSVCPatrick Steinhardt, Feb 18, 2025
  5. 05/12 contrib/credential: fix compilation of "osxkeychain" helperPatrick Steinhardt, Feb 18, 2025
  6. 04/12 contrib/credential: fix compiling "libsecret" helperPatrick Steinhardt, Feb 18, 2025
  7. 06/12 meson: wire up credential helpersPatrick Steinhardt, Feb 18, 2025
  8. M HickfordFeb 18, 2025
  9. Patrick SteinhardtFeb 18, 2025
  10. M HickfordMar 29, 2025
  11. Patrick SteinhardtMar 31, 2025
  12. 07/12 meson: wire up git-contacts(1)Patrick Steinhardt, Feb 18, 2025
  13. 08/12 meson: wire up static analysis via CoccinellePatrick Steinhardt, Feb 18, 2025
  14. 09/12 gitk: extract script to build GitkPatrick Steinhardt, Feb 18, 2025
  15. Junio C HamanoFeb 18, 2025
  16. Patrick SteinhardtFeb 19, 2025
  17. Johannes SixtFeb 19, 2025
  18. Patrick SteinhardtFeb 19, 2025
  19. Johannes SixtFeb 19, 2025
  20. 10/12 meson: wire up GitkPatrick Steinhardt, Feb 18, 2025
  21. 11/12 ci: fix propagating UTF-8 test locale in musl-based Meson jobPatrick Steinhardt, Feb 18, 2025
  22. 12/12 ci: exercise credential helpersPatrick Steinhardt, Feb 18, 2025
  23. M HickfordFeb 18, 2025
  24. 00/10 meson: wire up bits and pieces from "contrib/"Patrick Steinhardt, Feb 19, 2025
  25. 01/10 GIT-BUILD-OPTIONS: propagate project's source directoryPatrick Steinhardt, Feb 19, 2025
  26. 02/10 contrib/credential: fix "netrc" tests with out-of-tree buildsPatrick Steinhardt, Feb 19, 2025
  27. 03/10 contrib/credential: fix compilation of wincred helper with MSVCPatrick Steinhardt, Feb 19, 2025
  28. 05/10 contrib/credential: fix compilation of "osxkeychain" helperPatrick Steinhardt, Feb 19, 2025
  29. 04/10 contrib/credential: fix compiling "libsecret" helperPatrick Steinhardt, Feb 19, 2025
  30. 06/10 meson: wire up credential helpersPatrick Steinhardt, Feb 19, 2025
  31. 07/10 meson: wire up git-contacts(1)Patrick Steinhardt, Feb 19, 2025
  32. 08/10 meson: wire up static analysis via CoccinellePatrick Steinhardt, Feb 19, 2025
  33. 09/10 ci: fix propagating UTF-8 test locale in musl-based Meson jobPatrick Steinhardt, Feb 19, 2025
  34. 10/10 ci: exercise credential helpersPatrick Steinhardt, Feb 19, 2025
  35. Ramsay JonesFeb 20, 2025
  36. Patrick SteinhardtFeb 20, 2025
  37. Ramsay JonesFeb 21, 2025

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.