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

Re: [PATCH 2/2] teach git-config to output large integers

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Aug 21, 2013, 06:34 UTC
Message-ID
<20130821063458.GB2802@elie.Belkin>
In-Reply-To
<20130821050053.GA875@sigill.intra.peff.net>
Jeff King wrote:
> On Tue, Aug 20, 2013 at 09:38:41PM -0700, Jonathan Nieder wrote:
Show 13 quoted lines
>> That is what I was trying to get at in discussing the test.  It is not
>> "We would like --int to reject values higher than this, but some
>> platforms do not allow us to", but "Either rejecting this value, or
>> even better, computing the right size and printing it, is an
>> acceptable behavior, and this test checks for those."
>
> You are conflating the two patches, I think. The test we were discussing
> is for the _first_ patch, which fixes a bug in the range check. It is
> not meant to test git-config in particular, but to test that values
> higher than INT_MAX and lower than LONG_MAX are properly range-checked.
>
> Forget the second patch for a moment. I believe the first one is a bug
> fix that we would want even if we do not take the second patch at all.

Sure. I'm not conflating the patches. What I mean is that tests are supposed to test desirable behavior, whatever that is --- they are not about preventing all behavior changes but only about preventing regressions.

So talking about tests is a (perhaps overly roundabout) way to figure out the desirable behavior.

In particular, at first glance I would think computing 3 * 2^20 instead of erroring out would be a *good* behavior, not a regression. If that's right, it doesn't make sense to me to go to careful lengths either to test that git continues to error out on most platforms, or to introduce new options to ensure "git config --int" continues to error out.

That is what I am trying to understand. Everything about the first patch except for the test makes sense to me, but the test doesn't. As you noted, we know the test won't pass on some platforms. Why is it something we should *want* to pass?

Jonathan
Previous: Jeff KingNext: Junio C Hamano
Message 12 of 25 in “git-config and large integers”
  1. 0/2 git-config and large integersJeff King, Aug 20, 2013
  2. 1/2 config: properly range-check integer valuesJeff King, Aug 20, 2013
  3. Jonathan NiederAug 20, 2013
  4. Jeff KingAug 21, 2013
  5. Stefan BellerAug 20, 2013
  6. Jeff KingAug 20, 2013
  7. 2/2 teach git-config to output large integersJeff King, Aug 20, 2013
  8. Jonathan NiederAug 20, 2013
  9. Jeff KingAug 21, 2013
  10. Jonathan NiederAug 21, 2013
  11. Jeff KingAug 21, 2013
  12. Jonathan NiederAug 21, 2013
  13. Junio C HamanoAug 20, 2013
  14. Junio C HamanoAug 20, 2013
  15. Jeff KingAug 21, 2013
  16. Jeff KingAug 21, 2013
  17. 0/5 git-config and large integersJeff King, Sep 8, 2013
  18. 1/5 config: factor out integer parsing from range checksJeff King, Sep 8, 2013
  19. 2/5 config: properly range-check integer valuesJeff King, Sep 8, 2013
  20. 3/5 config: set errno in numeric git_parse_* functionsJeff King, Sep 8, 2013
  21. Eric SunshineSep 9, 2013
  22. Jeff KingSep 9, 2013
  23. 4/5 config: make numeric parsing errors more clearJeff King, Sep 8, 2013
  24. 5/5 git-config: always treat --int as 64-bit internallyJeff King, Sep 8, 2013
  25. Junio C HamanoSep 9, 2013

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.