[PATCH v6 0/3] parse: replace atoi() with strtoul_ui() and strtol_i()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Changes from Version 5:

 * Save the content of .gitattributes in .gitattributes.bak before adding
   conflict-marker-size=3a, as subsequent tests do not depend on having
   invalid lines. Restore .gitattributes to its original state after
   testing.
 * Use test_grep for testing failure output, as it provides a cleaner
   approach.
 * Use err instead of actual_error for conciseness and to maintain
   consistency with the style of the rest of the test suite.

Usman Akinyemi (3):
  daemon: replace atoi() with strtoul_ui() and strtol_i()
  merge: replace atoi() with strtol_i() for marker size validation
  imap: replace atoi() with strtol_i() for UIDVALIDITY and UIDNEXT
    parsing

 daemon.c              | 12 ++++++++----
 imap-send.c           | 13 ++++++++-----
 merge-ll.c            | 11 +++++++++--
 t/t5570-git-daemon.sh | 25 +++++++++++++++++++++++++
 t/t6406-merge-attr.sh |  8 ++++++++
 5 files changed, 58 insertions(+), 11 deletions(-)


base-commit: 90fe3800b92a49173530828c0a17951abd30f0e1
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1810%2FUnique-Usman%2Fr_atoi-v6
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1810/Unique-Usman/r_atoi-v6
Pull-Request: https://github.com/git/git/pull/1810

Range-diff vs v5:

 1:  d9c997d7a9c ! 1:  3daedaeb260 daemon: replace atoi() with strtoul_ui() and strtol_i()
     @@ t/t5570-git-daemon.sh: TEST_PASSES_SANITIZE_LEAK=true
      +test_expect_success 'daemon rejects invalid --init-timeout values' '
      +	for arg in "3a" "-3"
      +	do
     -+		test_must_fail git daemon --init-timeout="$arg" 2>actual_error &&
     -+		test_write_lines "fatal: invalid init-timeout ${SQ}$arg${SQ}, expecting a non-negative integer" >expected &&
     -+		test_cmp actual_error expected || return 1
     ++		test_must_fail git daemon --init-timeout="$arg" 2>err &&
     ++		test_grep "fatal: invalid init-timeout ${SQ}$arg${SQ}, expecting a non-negative integer" err ||
     ++		return 1
      +	done
      +'
      +
      +test_expect_success 'daemon rejects invalid --timeout values' '
      +	for arg in "3a" "-3"
      +	do
     -+		test_must_fail git daemon --timeout="$arg" 2>actual_error &&
     -+		test_write_lines "fatal: invalid timeout ${SQ}$arg${SQ}, expecting a non-negative integer" >expected &&
     -+		test_cmp actual_error expected || return 1
     ++		test_must_fail git daemon --timeout="$arg" 2>err &&
     ++		test_grep "fatal: invalid timeout ${SQ}$arg${SQ}, expecting a non-negative integer" err ||
     ++		return 1
      +	done
      +'
      +
      +test_expect_success 'daemon rejects invalid --max-connections values' '
      +	arg='3a' &&
     -+	test_must_fail git daemon --max-connections=3a 2>actual_error &&
     -+	test_write_lines "fatal: invalid max-connections ${SQ}$arg${SQ}, expecting an integer" >expected &&
     -+	test_cmp actual_error expected
     ++	test_must_fail git daemon --max-connections=3a 2>err &&
     ++	test_grep "fatal: invalid max-connections ${SQ}$arg${SQ}, expecting an integer" err
      +'
      +
       start_git_daemon
 2:  da9ea10e4e1 ! 2:  0ea3b349560 merge: replace atoi() with strtol_i() for marker size validation
     @@ t/t6406-merge-attr.sh: test_expect_success 'retry the merge with longer context'
       '
       
      +test_expect_success 'invalid conflict-marker-size 3a' '
     -+    echo "text conflict-marker-size=3a" >>.gitattributes &&
     -+    git checkout -m text 2>error &&
     -+    test_grep "warning: invalid marker-size ${SQ}3a${SQ}, expecting an integer" error
     ++	cp .gitattributes .gitattributes.bak &&
     ++	echo "text conflict-marker-size=3a" >>.gitattributes &&
     ++	test_when_finished "mv .gitattributes.bak .gitattributes" &&
     ++	git checkout -m text 2>err &&
     ++	test_grep "warning: invalid marker-size ${SQ}3a${SQ}, expecting an integer" err
      +'
      +
       test_expect_success 'custom merge backend' '
 3:  9b2b2dc8fc8 = 3:  17484df5200 imap: replace atoi() with strtol_i() for UIDVALIDITY and UIDNEXT parsing

-- 
gitgitgadget




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux