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

[PATCH v2 2/2] t5551: compare sorted cookies files

From
Thomas Gummerer <t.gummerer@gmail.com>
Date
Sep 17, 2018, 21:46 UTC
Message-ID
<20180917214628.28325-3-t.gummerer@gmail.com>
In-Reply-To
<20180917214628.28325-1-t.gummerer@gmail.com>

In t5551 we check that we save cookies correctly to a file when http.cookiefile and http.savecookies are set. To do so we create an expect file that expects the cookies in a certain order.

However after e2ef8d6fa ("cookies: support creation-time attribute for cookies", 2018-08-28) in curl.git (released in curl 7.61.1) that order changed.

We document the file format as "Netscape/Mozilla cookie file format (see curl(1))", so any format produced by libcurl should be fine here. Sort the files, to be agnostic to the order of the cookies, and make the test pass with both curl versions > 7.61.1 and earlier curl versions.

Reported-by: Todd Zullinger <tmz@pobox.com>
Helped-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
---
 t/t5551-http-fetch-smart.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/t5551-http-fetch-smart.sh b/t/t5551-http-fetch-smart.sh
index 71535631d3..3dc8f8ecec 100755
--- a/t/t5551-http-fetch-smart.sh
+++ b/t/t5551-http-fetch-smart.sh
@@ -207,7 +207,7 @@ test_expect_success 'cookies stored in http.cookiefile when http.savecookies set
 	cat >cookies.txt <<-\EOF &&
 	127.0.0.1	FALSE	/smart_cookies/	FALSE	0	othername	othervalue
 	EOF
-	cat >expect_cookies.txt <<-\EOF &&
+	sort >expect_cookies.txt <<-\EOF &&
 
 	127.0.0.1	FALSE	/smart_cookies/	FALSE	0	othername	othervalue
 	127.0.0.1	FALSE	/smart_cookies/repo.git/info/	FALSE	0	name	value
@@ -215,7 +215,7 @@ test_expect_success 'cookies stored in http.cookiefile when http.savecookies set
 	git config http.cookiefile cookies.txt &&
 	git config http.savecookies true &&
 	git ls-remote $HTTPD_URL/smart_cookies/repo.git master &&
-	tail -3 cookies.txt >cookies_tail.txt &&
+	tail -3 cookies.txt | sort >cookies_tail.txt &&
 	test_cmp expect_cookies.txt cookies_tail.txt
 '
 
-- 
2.19.0.444.g18242da7ef
Previous: Thomas Gummerer
Message 7 of 7 in “t5551: compare sorted cookies files”
  1. t5551: compare sorted cookies filesThomas Gummerer, Sep 17, 2018
  2. Junio C HamanoSep 17, 2018
  3. Thomas GummererSep 17, 2018
  4. Jonathan NiederSep 17, 2018
  5. 0/2 t5551: compare sorted cookies filesThomas Gummerer, Sep 17, 2018
  6. 1/2 t5551: move setup code inside test_expect blocksThomas Gummerer, Sep 17, 2018
  7. 2/2 t5551: compare sorted cookies filesThomas Gummerer, Sep 17, 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.