Skip to content

Commit 1011f1c

Browse files
authored
Fix osx-gcc CI build failures (#762)
The `osx-gcc` job fails with compiler errors due to the now-stricter type checks in the `curl_easy_setopt()` calls. There is an upstream contribution already to fix this in Git's own main branch, but those patches to not apply cleanly on top of `vfs-2.49.0`, therefore I backported them. <details><summary>Range-diff</summary> * 1: 6f11c42 ! 1: 3b1e099 curl: fix integer constant typechecks with curl_easy_setopt() ``````diff @@ Commit message We can fix it by just marking the constants with a long "L". + Backported-from: 6f11c42 (curl: fix integer constant typechecks with curl_easy_setopt(), 2025-06-04) Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]> + Signed-off-by: Johannes Schindelin <[email protected]> ## http-push.c ## @@ http-push.c: static char *xml_entities(const char *s) @@ http-push.c: static char *xml_entities(const char *s) curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite_null); ## http.c ## +@@ http.c: static int has_proxy_cert_password(void) + + static void set_curl_keepalive(CURL *c) + { +- curl_easy_setopt(c, CURLOPT_TCP_KEEPALIVE, 1); ++ curl_easy_setopt(c, CURLOPT_TCP_KEEPALIVE, 1L); + } + + /* Return 1 if redactions have been made, 0 otherwise. */ @@ http.c: static CURL *get_curl_handle(void) die("curl_easy_init failed"); @@ http.c: static CURL *get_curl_handle(void) if (curl_ssl_try) curl_easy_setopt(result, CURLOPT_USE_SSL, CURLUSESSL_TRY); -@@ http.c: static CURL *get_curl_handle(void) - } - init_curl_proxy_auth(result); - -- curl_easy_setopt(result, CURLOPT_TCP_KEEPALIVE, 1); -+ curl_easy_setopt(result, CURLOPT_TCP_KEEPALIVE, 1L); - - if (curl_tcp_keepidle > -1) - curl_easy_setopt(result, CURLOPT_TCP_KEEPIDLE, ## remote-curl.c ## @@ remote-curl.c: static int probe_rpc(struct rpc_state *rpc, struct slot_results *results) `````` * 2: 30325e2 ! 2: ecd7e78 curl: fix integer variable typechecks with curl_easy_setopt() ``````diff @@ Commit message going on obvious. There aren't that many spots to modify (and as you can see from the context, we already have some similar casts). + Backported-from: 30325e2 (curl: fix integer variable typechecks with curl_easy_setopt(), 2025-06-04) Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]> + Signed-off-by: Johannes Schindelin <[email protected]> ## imap-send.c ## @@ imap-send.c: static CURL *setup_curl(struct imap_server_conf *srvc, struct credential *cred) `````` * 3: 4558c8f ! 3: a53e8f6 curl: fix symbolic constant typechecks with curl_easy_setopt() ``````diff @@ Commit message dig, as it doesn't really matter: we have to follow what existing curl versions ask for anyway. + Backported-from: 4558c8f (curl: fix symbolic constant typechecks with curl_easy_setopt(), 2025-06-04) Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]> + Signed-off-by: Johannes Schindelin <[email protected]> ## http.c ## @@ http.c: static CURL *get_curl_handle(void) - - if (http_ssl_backend && !strcmp("schannel", http_ssl_backend) && - !http_schannel_check_revoke) { -- curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NO_REVOKE); -+ curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, (long)CURLSSLOPT_NO_REVOKE); - } - - if (http_proactive_auth != PROACTIVE_AUTH_NONE) -@@ http.c: static CURL *get_curl_handle(void) } curl_easy_setopt(result, CURLOPT_MAXREDIRS, 20L); `````` * 4: 80de749 = 4: 560fdc1 curl: pass `long` values where expected * -: ------------ > 5: 718faf7 gvfs-helper: pass `long` values where expected </details> Obviously, we also needed to address some calls in `gvfs-helper`, which means that the tip commit of this PR branch is _not_ a backport.
2 parents 6523961 + 718faf7 commit 1011f1c

File tree

5 files changed

+42
-42
lines changed

5 files changed

+42
-42
lines changed

gvfs-helper.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2910,7 +2910,7 @@ static void do_req(const char *url_base,
29102910
slot = get_active_slot();
29112911
slot->results = &results;
29122912

2913-
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0); /* not a HEAD request */
2913+
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0L); /* not a HEAD request */
29142914
curl_easy_setopt(slot->curl, CURLOPT_URL, rest_url.buf);
29152915
curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, params->headers);
29162916
if (curl_version_info(CURLVERSION_NOW)->version_num < 0x074b00)
@@ -2928,14 +2928,14 @@ static void do_req(const char *url_base,
29282928
curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, (long)0);
29292929

29302930
if (params->b_is_post) {
2931-
curl_easy_setopt(slot->curl, CURLOPT_POST, 1);
2931+
curl_easy_setopt(slot->curl, CURLOPT_POST, 1L);
29322932
curl_easy_setopt(slot->curl, CURLOPT_ENCODING, NULL);
29332933
curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDS,
29342934
params->post_payload->buf);
29352935
curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDSIZE,
29362936
(long)params->post_payload->len);
29372937
} else {
2938-
curl_easy_setopt(slot->curl, CURLOPT_POST, 0);
2938+
curl_easy_setopt(slot->curl, CURLOPT_POST, 0L);
29392939
}
29402940

29412941
if (params->b_write_to_file) {
@@ -2961,9 +2961,9 @@ static void do_req(const char *url_base,
29612961
curl_easy_setopt(slot->curl, CURLOPT_XFERINFOFUNCTION,
29622962
gh__curl_progress_cb);
29632963
curl_easy_setopt(slot->curl, CURLOPT_XFERINFODATA, params);
2964-
curl_easy_setopt(slot->curl, CURLOPT_NOPROGRESS, 0);
2964+
curl_easy_setopt(slot->curl, CURLOPT_NOPROGRESS, 0L);
29652965
} else {
2966-
curl_easy_setopt(slot->curl, CURLOPT_NOPROGRESS, 1);
2966+
curl_easy_setopt(slot->curl, CURLOPT_NOPROGRESS, 1L);
29672967
}
29682968

29692969
gh__run_one_slot(slot, params, status);

http-push.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ static char *xml_entities(const char *s)
194194
static void curl_setup_http_get(CURL *curl, const char *url,
195195
const char *custom_req)
196196
{
197-
curl_easy_setopt(curl, CURLOPT_HTTPGET, 1);
197+
curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L);
198198
curl_easy_setopt(curl, CURLOPT_URL, url);
199199
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, custom_req);
200200
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite_null);
@@ -204,17 +204,17 @@ static void curl_setup_http(CURL *curl, const char *url,
204204
const char *custom_req, struct buffer *buffer,
205205
curl_write_callback write_fn)
206206
{
207-
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1);
207+
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
208208
curl_easy_setopt(curl, CURLOPT_URL, url);
209209
curl_easy_setopt(curl, CURLOPT_INFILE, buffer);
210210
curl_easy_setopt(curl, CURLOPT_INFILESIZE, buffer->buf.len);
211211
curl_easy_setopt(curl, CURLOPT_READFUNCTION, fread_buffer);
212212
curl_easy_setopt(curl, CURLOPT_SEEKFUNCTION, seek_buffer);
213213
curl_easy_setopt(curl, CURLOPT_SEEKDATA, buffer);
214214
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_fn);
215-
curl_easy_setopt(curl, CURLOPT_NOBODY, 0);
215+
curl_easy_setopt(curl, CURLOPT_NOBODY, 0L);
216216
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, custom_req);
217-
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1);
217+
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
218218
}
219219

220220
static struct curl_slist *get_dav_token_headers(struct remote_lock *lock, enum dav_header_flag options)

http.c

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ static int has_proxy_cert_password(void)
731731

732732
static void set_curl_keepalive(CURL *c)
733733
{
734-
curl_easy_setopt(c, CURLOPT_TCP_KEEPALIVE, 1);
734+
curl_easy_setopt(c, CURLOPT_TCP_KEEPALIVE, 1L);
735735
}
736736

737737
/* Return 1 if redactions have been made, 0 otherwise. */
@@ -1032,13 +1032,13 @@ static CURL *get_curl_handle(void)
10321032
die("curl_easy_init failed");
10331033

10341034
if (!curl_ssl_verify) {
1035-
curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, 0);
1036-
curl_easy_setopt(result, CURLOPT_SSL_VERIFYHOST, 0);
1035+
curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, 0L);
1036+
curl_easy_setopt(result, CURLOPT_SSL_VERIFYHOST, 0L);
10371037
} else {
10381038
/* Verify authenticity of the peer's certificate */
1039-
curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, 1);
1039+
curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, 1L);
10401040
/* The name in the cert must match whom we tried to connect */
1041-
curl_easy_setopt(result, CURLOPT_SSL_VERIFYHOST, 2);
1041+
curl_easy_setopt(result, CURLOPT_SSL_VERIFYHOST, 2L);
10421042
}
10431043

10441044
if (curl_http_version) {
@@ -1141,8 +1141,8 @@ static CURL *get_curl_handle(void)
11411141
curl_low_speed_time);
11421142
}
11431143

1144-
curl_easy_setopt(result, CURLOPT_MAXREDIRS, 20);
1145-
curl_easy_setopt(result, CURLOPT_POSTREDIR, CURL_REDIR_POST_ALL);
1144+
curl_easy_setopt(result, CURLOPT_MAXREDIRS, 20L);
1145+
curl_easy_setopt(result, CURLOPT_POSTREDIR, (long)CURL_REDIR_POST_ALL);
11461146

11471147
#ifdef GIT_CURL_HAVE_CURLOPT_PROTOCOLS_STR
11481148
{
@@ -1175,7 +1175,7 @@ static CURL *get_curl_handle(void)
11751175
user_agent ? user_agent : git_user_agent());
11761176

11771177
if (curl_ftp_no_epsv)
1178-
curl_easy_setopt(result, CURLOPT_FTP_USE_EPSV, 0);
1178+
curl_easy_setopt(result, CURLOPT_FTP_USE_EPSV, 0L);
11791179

11801180
if (curl_ssl_try)
11811181
curl_easy_setopt(result, CURLOPT_USE_SSL, CURLUSESSL_TRY);
@@ -1217,18 +1217,18 @@ static CURL *get_curl_handle(void)
12171217

12181218
if (starts_with(curl_http_proxy, "socks5h"))
12191219
curl_easy_setopt(result,
1220-
CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5_HOSTNAME);
1220+
CURLOPT_PROXYTYPE, (long)CURLPROXY_SOCKS5_HOSTNAME);
12211221
else if (starts_with(curl_http_proxy, "socks5"))
12221222
curl_easy_setopt(result,
1223-
CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
1223+
CURLOPT_PROXYTYPE, (long)CURLPROXY_SOCKS5);
12241224
else if (starts_with(curl_http_proxy, "socks4a"))
12251225
curl_easy_setopt(result,
1226-
CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4A);
1226+
CURLOPT_PROXYTYPE, (long)CURLPROXY_SOCKS4A);
12271227
else if (starts_with(curl_http_proxy, "socks"))
12281228
curl_easy_setopt(result,
1229-
CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4);
1229+
CURLOPT_PROXYTYPE, (long)CURLPROXY_SOCKS4);
12301230
else if (starts_with(curl_http_proxy, "https")) {
1231-
curl_easy_setopt(result, CURLOPT_PROXYTYPE, CURLPROXY_HTTPS);
1231+
curl_easy_setopt(result, CURLOPT_PROXYTYPE, (long)CURLPROXY_HTTPS);
12321232

12331233
if (http_proxy_ssl_cert)
12341234
curl_easy_setopt(result, CURLOPT_PROXY_SSLCERT, http_proxy_ssl_cert);
@@ -1533,9 +1533,9 @@ struct active_request_slot *get_active_slot(void)
15331533
curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, NULL);
15341534
curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDS, NULL);
15351535
curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDSIZE, -1L);
1536-
curl_easy_setopt(slot->curl, CURLOPT_UPLOAD, 0);
1537-
curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1);
1538-
curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 1);
1536+
curl_easy_setopt(slot->curl, CURLOPT_UPLOAD, 0L);
1537+
curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1L);
1538+
curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 1L);
15391539
curl_easy_setopt(slot->curl, CURLOPT_RANGE, NULL);
15401540

15411541
/*
@@ -1544,9 +1544,9 @@ struct active_request_slot *get_active_slot(void)
15441544
* HTTP_FOLLOW_* cases themselves.
15451545
*/
15461546
if (http_follow_config == HTTP_FOLLOW_ALWAYS)
1547-
curl_easy_setopt(slot->curl, CURLOPT_FOLLOWLOCATION, 1);
1547+
curl_easy_setopt(slot->curl, CURLOPT_FOLLOWLOCATION, 1L);
15481548
else
1549-
curl_easy_setopt(slot->curl, CURLOPT_FOLLOWLOCATION, 0);
1549+
curl_easy_setopt(slot->curl, CURLOPT_FOLLOWLOCATION, 0L);
15501550

15511551
curl_easy_setopt(slot->curl, CURLOPT_IPRESOLVE, git_curl_ipresolve);
15521552
curl_easy_setopt(slot->curl, CURLOPT_HTTPAUTH, http_auth_methods);
@@ -2113,12 +2113,12 @@ static int http_request(const char *url,
21132113
int ret;
21142114

21152115
slot = get_active_slot();
2116-
curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1);
2116+
curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1L);
21172117

21182118
if (!result) {
2119-
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 1);
2119+
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 1L);
21202120
} else {
2121-
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0);
2121+
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0L);
21222122
curl_easy_setopt(slot->curl, CURLOPT_WRITEDATA, result);
21232123

21242124
if (target == HTTP_REQUEST_FILE) {
@@ -2144,7 +2144,7 @@ static int http_request(const char *url,
21442144
strbuf_addstr(&buf, " no-cache");
21452145
if (options && options->initial_request &&
21462146
http_follow_config == HTTP_FOLLOW_INITIAL)
2147-
curl_easy_setopt(slot->curl, CURLOPT_FOLLOWLOCATION, 1);
2147+
curl_easy_setopt(slot->curl, CURLOPT_FOLLOWLOCATION, 1L);
21482148

21492149
headers = curl_slist_append(headers, buf.buf);
21502150

@@ -2163,7 +2163,7 @@ static int http_request(const char *url,
21632163
curl_easy_setopt(slot->curl, CURLOPT_URL, url);
21642164
curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, headers);
21652165
curl_easy_setopt(slot->curl, CURLOPT_ENCODING, "");
2166-
curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 0);
2166+
curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 0L);
21672167

21682168
ret = run_one_slot(slot, &results);
21692169

@@ -2743,7 +2743,7 @@ struct http_object_request *new_http_object_request(const char *base_url,
27432743
freq->headers = object_request_headers();
27442744

27452745
curl_easy_setopt(freq->slot->curl, CURLOPT_WRITEDATA, freq);
2746-
curl_easy_setopt(freq->slot->curl, CURLOPT_FAILONERROR, 0);
2746+
curl_easy_setopt(freq->slot->curl, CURLOPT_FAILONERROR, 0L);
27472747
curl_easy_setopt(freq->slot->curl, CURLOPT_WRITEFUNCTION, fwrite_sha1_file);
27482748
curl_easy_setopt(freq->slot->curl, CURLOPT_ERRORBUFFER, freq->errorstr);
27492749
curl_easy_setopt(freq->slot->curl, CURLOPT_URL, freq->url);

imap-send.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,7 +1418,7 @@ static CURL *setup_curl(struct imap_server_conf *srvc, struct credential *cred)
14181418

14191419
curl_easy_setopt(curl, CURLOPT_URL, path.buf);
14201420
strbuf_release(&path);
1421-
curl_easy_setopt(curl, CURLOPT_PORT, srvc->port);
1421+
curl_easy_setopt(curl, CURLOPT_PORT, (long)srvc->port);
14221422

14231423
if (srvc->auth_method) {
14241424
struct strbuf auth = STRBUF_INIT;
@@ -1431,8 +1431,8 @@ static CURL *setup_curl(struct imap_server_conf *srvc, struct credential *cred)
14311431
if (!srvc->use_ssl)
14321432
curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_TRY);
14331433

1434-
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, srvc->ssl_verify);
1435-
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, srvc->ssl_verify);
1434+
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, (long)srvc->ssl_verify);
1435+
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, (long)srvc->ssl_verify);
14361436

14371437
curl_easy_setopt(curl, CURLOPT_READFUNCTION, fread_buffer);
14381438

remote-curl.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -878,12 +878,12 @@ static int probe_rpc(struct rpc_state *rpc, struct slot_results *results)
878878
headers = curl_slist_append(headers, rpc->hdr_content_type);
879879
headers = curl_slist_append(headers, rpc->hdr_accept);
880880

881-
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0);
882-
curl_easy_setopt(slot->curl, CURLOPT_POST, 1);
881+
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0L);
882+
curl_easy_setopt(slot->curl, CURLOPT_POST, 1L);
883883
curl_easy_setopt(slot->curl, CURLOPT_URL, rpc->service_url);
884884
curl_easy_setopt(slot->curl, CURLOPT_ENCODING, NULL);
885885
curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDS, "0000");
886-
curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDSIZE, 4);
886+
curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDSIZE, 4L);
887887
curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, headers);
888888
curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, fwrite_buffer);
889889
curl_easy_setopt(slot->curl, CURLOPT_WRITEDATA, &buf);
@@ -971,8 +971,8 @@ static int post_rpc(struct rpc_state *rpc, int stateless_connect, int flush_rece
971971

972972
slot = get_active_slot();
973973

974-
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0);
975-
curl_easy_setopt(slot->curl, CURLOPT_POST, 1);
974+
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0L);
975+
curl_easy_setopt(slot->curl, CURLOPT_POST, 1L);
976976
curl_easy_setopt(slot->curl, CURLOPT_URL, rpc->service_url);
977977
curl_easy_setopt(slot->curl, CURLOPT_ENCODING, "");
978978

@@ -1059,7 +1059,7 @@ static int post_rpc(struct rpc_state *rpc, int stateless_connect, int flush_rece
10591059
rpc_in_data.check_pktline = stateless_connect;
10601060
memset(&rpc_in_data.pktline_state, 0, sizeof(rpc_in_data.pktline_state));
10611061
curl_easy_setopt(slot->curl, CURLOPT_WRITEDATA, &rpc_in_data);
1062-
curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 0);
1062+
curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 0L);
10631063

10641064

10651065
rpc->any_written = 0;

0 commit comments

Comments
 (0)