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

Re: [PATCH] t5551-http-fetch-smart.sh: sort cookies before comparing

From
Jeff King <peff@peff.net>
Date
Sep 8, 2018, 16:17 UTC
Message-ID
<20180908161712.GA9016@sigill.intra.peff.net>
In-Reply-To
<20180908032841.GK7192@zaya.teonanacatl.net>
On Fri, Sep 07, 2018 at 11:28:41PM -0400, Todd Zullinger wrote:
Show 10 quoted lines
> > So this fix looks fine. It might be worth a comment above the creation
> > of expect_cookies.txt to mention it must be in sorted order (of course
> > anybody modifying it would see a test failure).
> 
> I thought about running the expect_cookies.txt file through
> sort as well.  That would ensure that both files were using
> the same sorting.  Whether that's needed on any platform
> now, I don't know.  Maybe that would be a useful way to
> protect against future edits to the expect_cookies.txt file
> catching the editor?

Yes, I think sorting the expect file would work fine. I'm OK with that, or just leaving a comment. The comment has the bonus that it does not cost an extra process at runtime. I'd probably use a sort if we expected the list to be long and complicated, since it makes life easier on a future developer. But since there are only 2 lines, I don't think it's a big deal either way (or even just leaving it as-is without a comment is probably OK).

Show 9 quoted lines
> I thought there might be a test function to sort the output,
> but I was (incorrectly) thinking of check_access_log() which
> Gábor added in e8b3b2e275 ("t/lib-httpd: avoid occasional
> failures when checking access.log", 2018-07-12).
> 
> Perhaps it would be useful to have a test_cmp_sorted() to do
> the simple dance of sorting the actual & expected.  I
> haven't looked through the tests to see how often such a
> function might be useful.

I suspect it would occasionally be useful, but I don't recall it coming up all that often.

-Peff
Previous: Todd ZullingerNext: Junio C Hamano
Message 4 of 8 in “t5551-http-fetch-smart.sh: sort cookies before comparing”
  1. t5551-http-fetch-smart.sh: sort cookies before comparingTodd Zullinger, Sep 7, 2018
  2. Jeff KingSep 7, 2018
  3. Todd ZullingerSep 8, 2018
  4. Jeff KingSep 8, 2018
  5. Junio C HamanoSep 17, 2018
  6. Jeff KingSep 17, 2018
  7. Junio C HamanoSep 18, 2018
  8. Junio C HamanoSep 11, 2018

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.