All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] parse-options: harden handling of integer values
@ 2025-04-01 15:01 Patrick Steinhardt
  2025-04-01 15:01 ` [PATCH 1/5] global: use designated initializers for options Patrick Steinhardt
                   ` (7 more replies)
  0 siblings, 8 replies; 46+ messages in thread
From: Patrick Steinhardt @ 2025-04-01 15:01 UTC (permalink / raw)
  To: git
  Cc: John Paul Adrian Glaubitz, Todd Zullinger, René Scharfe,
	SZEDER Gábor, Derrick Stolee, Jeff King

Hi,

this patch series addresses the issues raised in [1] and [2]. As
discussed in [1], the series also introduces a couple of safeguards to
make it harder to misuse `OPT_INTEGER()` and `OPT_MAGNITUDE()`:

  - We now track the precision of the underlying integer types. This
    makes it possible to pass arbitrarily-sized integers to those
    options, not only `int` and `unsigned long`, respectively.

  - We introduce a build assert to verify that the passed variable has
    correct signedness.

Furthermore, the series introduces `OPT_UNSIGNED()` to adapt all
callsites that previously used variables with the wrong signedness.

Thanks!

Patrick

[1]: <89257ab82cd60d135cce02d51eacee7ec35c1c37.camel@physik.fu-berlin.de>
[2]: <Z8HW6petWuMRWSXf@teonanacatl.net>

---
Patrick Steinhardt (5):
      global: use designated initializers for options
      parse-options: introduce precision handling for `OPTION_INTEGER`
      parse-options: introduce precision handling for `OPTION_MAGNITUDE`
      parse-options: introduce `OPTION_UNSIGNED`
      parse-options: detect mismatches in integer signedness

 apply.c                       |   4 +-
 archive.c                     |  35 +++++++---
 builtin/am.c                  |  28 +++++---
 builtin/backfill.c            |   4 +-
 builtin/clone.c               |  13 +++-
 builtin/column.c              |   2 +-
 builtin/commit-tree.c         |  12 +++-
 builtin/commit.c              |  62 ++++++++++++++----
 builtin/config.c              |  13 +++-
 builtin/describe.c            |  24 +++++--
 builtin/fetch.c               |  10 ++-
 builtin/fmt-merge-msg.c       |  27 ++++++--
 builtin/gc.c                  |  12 +++-
 builtin/grep.c                |  18 ++++--
 builtin/init-db.c             |  13 ++--
 builtin/ls-remote.c           |  11 +++-
 builtin/merge.c               |  38 ++++++++---
 builtin/read-tree.c           |  11 +++-
 builtin/rebase.c              |  25 ++++++--
 builtin/revert.c              |  12 +++-
 builtin/show-branch.c         |  13 +++-
 builtin/tag.c                 |  24 +++++--
 builtin/update-index.c        | 131 ++++++++++++++++++++++++++------------
 builtin/write-tree.c          |  12 ++--
 diff.c                        |  13 ++--
 git-compat-util.h             |   7 ++
 parse-options.c               | 145 ++++++++++++++++++++++++++++++++++++------
 parse-options.h               |  23 ++++++-
 ref-filter.h                  |  15 +++--
 t/helper/test-parse-options.c |  46 +++++++++++---
 t/t0040-parse-options.sh      |  57 ++++++++++++++++-
 31 files changed, 671 insertions(+), 189 deletions(-)


---
base-commit: 5b97a56fa0e7d580dc8865b73107407c9b3f0eff
change-id: 20250401-b4-pks-parse-options-integers-9b4bbcf21011


^ permalink raw reply	[flat|nested] 46+ messages in thread

end of thread, other threads:[~2025-04-17 15:17 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-01 15:01 [PATCH 0/5] parse-options: harden handling of integer values Patrick Steinhardt
2025-04-01 15:01 ` [PATCH 1/5] global: use designated initializers for options Patrick Steinhardt
2025-04-01 15:01 ` [PATCH 2/5] parse-options: introduce precision handling for `OPTION_INTEGER` Patrick Steinhardt
2025-04-01 18:47   ` René Scharfe
2025-04-15 10:26     ` Patrick Steinhardt
2025-04-01 15:01 ` [PATCH 3/5] parse-options: introduce precision handling for `OPTION_MAGNITUDE` Patrick Steinhardt
2025-04-01 15:01 ` [PATCH 4/5] parse-options: introduce `OPTION_UNSIGNED` Patrick Steinhardt
2025-04-01 15:01 ` [PATCH 5/5] parse-options: detect mismatches in integer signedness Patrick Steinhardt
2025-04-15 12:14 ` [PATCH v2 0/5] parse-options: harden handling of integer values Patrick Steinhardt
2025-04-15 12:14   ` [PATCH v2 1/5] global: use designated initializers for options Patrick Steinhardt
2025-04-15 12:14   ` [PATCH v2 2/5] parse-options: introduce precision handling for `OPTION_INTEGER` Patrick Steinhardt
2025-04-15 15:51     ` Phillip Wood
2025-04-16 10:28       ` Patrick Steinhardt
2025-04-15 16:59     ` Junio C Hamano
2025-04-16 10:28       ` Patrick Steinhardt
2025-04-15 12:14   ` [PATCH v2 3/5] parse-options: introduce precision handling for `OPTION_MAGNITUDE` Patrick Steinhardt
2025-04-15 12:14   ` [PATCH v2 4/5] parse-options: introduce `OPTION_UNSIGNED` Patrick Steinhardt
2025-04-15 15:52     ` Phillip Wood
2025-04-16 10:27       ` Patrick Steinhardt
2025-04-16 13:31         ` phillip.wood123
2025-04-15 17:38     ` René Scharfe
2025-04-16 10:28       ` Patrick Steinhardt
2025-04-15 12:14   ` [PATCH v2 5/5] parse-options: detect mismatches in integer signedness Patrick Steinhardt
2025-04-15 17:02     ` Junio C Hamano
2025-04-16 10:02 ` [PATCH v3 0/7] parse-options: harden handling of integer values Patrick Steinhardt
2025-04-16 10:02   ` [PATCH v3 1/7] global: use designated initializers for options Patrick Steinhardt
2025-04-16 10:02   ` [PATCH v3 2/7] parse-options: check for overflow when parsing integers Patrick Steinhardt
2025-04-16 10:02   ` [PATCH v3 3/7] parse-options: introduce precision handling for `OPTION_INTEGER` Patrick Steinhardt
2025-04-16 17:29     ` Junio C Hamano
2025-04-16 10:02   ` [PATCH v3 4/7] parse-options: introduce precision handling for `OPTION_MAGNITUDE` Patrick Steinhardt
2025-04-16 10:02   ` [PATCH v3 5/7] parse-options: introduce `OPTION_UNSIGNED` Patrick Steinhardt
2025-04-16 18:50     ` Junio C Hamano
2025-04-17  8:15       ` Patrick Steinhardt
2025-04-16 10:02   ` [PATCH v3 6/7] parse-options: detect mismatches in integer signedness Patrick Steinhardt
2025-04-16 10:02   ` [PATCH v3 7/7] parse-options: introduce bounded integer options Patrick Steinhardt
2025-04-16 19:19     ` Junio C Hamano
2025-04-17  8:14       ` Patrick Steinhardt
2025-04-17 10:49 ` [PATCH v4 0/7] parse-options: harden handling of integer values Patrick Steinhardt
2025-04-17 10:49   ` [PATCH v4 1/7] parse: fix off-by-one for minimum signed values Patrick Steinhardt
2025-04-17 10:49   ` [PATCH v4 2/7] global: use designated initializers for options Patrick Steinhardt
2025-04-17 10:49   ` [PATCH v4 3/7] parse-options: support unit factors in `OPT_INTEGER()` Patrick Steinhardt
2025-04-17 10:49   ` [PATCH v4 4/7] parse-options: rename `OPT_MAGNITUDE()` to `OPT_UNSIGNED()` Patrick Steinhardt
2025-04-17 15:17     ` Junio C Hamano
2025-04-17 10:49   ` [PATCH v4 5/7] parse-options: introduce precision handling for `OPTION_INTEGER` Patrick Steinhardt
2025-04-17 10:49   ` [PATCH v4 6/7] parse-options: introduce precision handling for `OPTION_UNSIGNED` Patrick Steinhardt
2025-04-17 10:49   ` [PATCH v4 7/7] parse-options: detect mismatches in integer signedness Patrick Steinhardt

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.