From: Phillip Wood <phillip.wood123@gmail.com>
To: ions via GitGitGadget <gitgitgadget@gmail.com>, git@vger.kernel.org
Cc: ions <zara.leonardo@gmail.com>,
"brian m . carlson" <sandals@crustytoothpaste.net>
Subject: Re: [PATCH v4] libgit-rs: add get_bool(), get_ulong(), and get_pathname() methods
Date: Wed, 1 Oct 2025 11:15:28 +0100 [thread overview]
Message-ID: <0cb55558-a48e-42ac-a80e-a24ee2be55ee@gmail.com> (raw)
In-Reply-To: <pull.1977.v4.git.1759221968318.gitgitgadget@gmail.com>
[I've cc'd brian to sanity check my suggestion for handling c_ulong in
rust 1.63 which lacks std::ffi::c_ulong]
On 30/09/2025 09:46, ions via GitGitGadget wrote:
> From: ionnss <zara.leonardo@gmail.com>
>
> Expand ConfigSet API with three new configuration value parsers:
>
> - get_bool(): Parse boolean values using git_configset_get_bool()
> - get_ulong(): Parse unsigned long values
> - get_pathname(): Parse file paths, returning PathBuf
I would be nice to explain in the commit message why we require paths to
be utf-8 encoded. I've left one comment below, apart from that I think
this looks good.
> --- a/contrib/libgit-sys/src/lib.rs
> +++ b/contrib/libgit-sys/src/lib.rs
> @@ -1,7 +1,7 @@
> use std::ffi::c_void;
>
> #[cfg(has_std__ffi__c_char)]
> -use std::ffi::{c_char, c_int};
> +use std::ffi::{c_char, c_int, c_ulong};
>
> #[cfg(not(has_std__ffi__c_char))]
> #[allow(non_camel_case_types)]
> @@ -11,6 +11,10 @@ pub type c_char = i8;
> #[allow(non_camel_case_types)]
> pub type c_int = i32;
>
> +#[cfg(not(has_std__ffi__c_char))]
> +#[allow(non_camel_case_types)]
> +pub type c_ulong = u64;
As I said before this wont work because C's ulong type is platform
dependent so you cannot assume it 64 bits wide. Looking at the previous
discussion[1] the reason we have these fallback definitions is because
std::ffi::c_int etc were only added in rust 1.64 and we want to support
rust 1.63 as that is the version shipped by Debian oldstable. I think it
would be better to have a separate preparatory patch that changes the
existing fallbacks to
#[cfg(not(has_std__ff__c_char))]
use std::os::raw::{c_char, c_int};
and then this patch can add "c_ulong" to the list.
Thanks
Phillip
[1]
https://lore.kernel.org/git/ZtivGeDZ_MZDEDB_@tapette.crustytoothpaste.net/
next prev parent reply other threads:[~2025-10-01 10:15 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-25 11:44 [PATCH 0/2] libgit-rs: add get_bool() method to ConfigSet ions via GitGitGadget
2025-09-25 11:44 ` [PATCH 1/2] po: fix escaped underscores in README.md ionnss via GitGitGadget
2025-09-25 11:44 ` [PATCH 2/2] libgit-rs: add get_bool() method to ConfigSet ionnss via GitGitGadget
2025-09-26 6:43 ` Chris Torek
2025-09-26 9:58 ` Phillip Wood
2025-09-26 17:15 ` Junio C Hamano
2025-09-27 0:07 ` [PATCH v2 0/3] " ions via GitGitGadget
2025-09-27 0:07 ` [PATCH v2 1/3] po: fix escaped underscores in README.md ionnss via GitGitGadget
2025-09-27 0:07 ` [PATCH v2 2/3] libgit-rs: add get_bool() method to ConfigSet ionnss via GitGitGadget
2025-09-27 0:07 ` [PATCH v2 3/3] libgit-rs: address review feedback for get_bool() ionnss via GitGitGadget
2025-09-27 2:01 ` [PATCH v2 0/3] libgit-rs: add get_bool() method to ConfigSet Junio C Hamano
2025-09-27 3:51 ` [PATCH v3 " ions via GitGitGadget
2025-09-27 3:51 ` [PATCH v3 1/3] po: fix escaped underscores in README.md ionnss via GitGitGadget
2025-09-29 13:26 ` Phillip Wood
2025-09-27 3:51 ` [PATCH v3 2/3] libgit-rs: add get_bool() method to ConfigSet ionnss via GitGitGadget
2025-09-29 13:23 ` Phillip Wood
2025-09-27 3:51 ` [PATCH v3 3/3] libgit-rs: add get_ulong() and get_pathname() methods ionnss via GitGitGadget
2025-09-29 13:23 ` Phillip Wood
2025-09-30 8:46 ` [PATCH v4] libgit-rs: add get_bool(), get_ulong(), " ions via GitGitGadget
2025-10-01 10:15 ` Phillip Wood [this message]
2025-10-06 21:20 ` brian m. carlson
2025-10-08 13:36 ` Phillip Wood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0cb55558-a48e-42ac-a80e-a24ee2be55ee@gmail.com \
--to=phillip.wood123@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=phillip.wood@dunelm.org.uk \
--cc=sandals@crustytoothpaste.net \
--cc=zara.leonardo@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.