You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
# Create a dummy cookie jar larger than 4KiB.
$ printf'%s\tFALSE\t/\tTRUE\t2147483647\to\tfoo=bar\n' {0..200}.example.com > x
# Run curl reading & writing that cookie jar.
$ strace -e'!signal' curl https://google.com --cookie x --cookie-jar x
...
openat(AT_FDCWD, "x", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
write(4, "# Netscape HTTP Cookie File\n# ht"..., 4096) = 4096
write(4, "e.com\tFALSE\t/\tTRUE\t2147483647\to\t"..., 4096) = 4096
write(4, "LSE\t/\tTRUE\t2147483647\to\tfoo=bar\n"..., 1884) = 1884
close(4) = 0
...
I expected the following
other processes accessing the cookie jar should be able to rely on the file being coherent/complete. as it stands, the cookie jar is unreliable with more than one user at a time.
seems like it wouldn't be too difficult to create a tempfile using the name as a base, write to that, then do a single atomic rename.
It should indeed be possible to create the file with a temp name and then rename it. I would propose we do it by appending a suffix to the actual name.
I did this
I expected the following
other processes accessing the cookie jar should be able to rely on the file being coherent/complete. as it stands, the cookie jar is unreliable with more than one user at a time.
seems like it wouldn't be too difficult to create a tempfile using the name as a base, write to that, then do a single atomic rename.
curl/libcurl version
curl 7.66.0 (x86_64-pc-linux-gnu) libcurl/7.66.0 OpenSSL/1.1.1d zlib/1.2.11 nghttp2/1.39.2
operating system
Linux vapier 5.3.1 #1 SMP PREEMPT Fri Sep 27 00:26:44 EDT 2019 x86_64 AMD FX(tm)-4350 Quad-Core Processor AuthenticAMD GNU/Linux
The text was updated successfully, but these errors were encountered: