[darcs-devel] [issue2215] darcs get hangs when it can't write to the user's cache

Simon Michael bugs at darcs.net
Tue Jul 24 21:38:52 UTC 2012


New submission from Simon Michael <simon at joyful.com>:

1. Summarise the issue (what were doing, what went wrong?)

I was doing

USER1> sudo -u USER2 darcs-2.8.1 get http://darcs.net/screened

In this situation darcs uses USER1's ~/.darcs/cache even though running as USER2. The get runs 
fine as long as the patches are found in cache, but hangs as soon as it tries to cache more 
patches, assuming USER2 doesn't have write permission there. It will hang at the same patch 
number every time, and if you run with --debug-http you'll see "fopen() failed: Permission 
denied" just before the hang. See strace below.

To reproduce, set up an empty ~/.cabal/cache directory containing a read-only pristine.hashed 
directory, then darcs get any repo via http. 

2. What behaviour were you expecting instead?

Give a nice "could not write to CACHE_FILE_PATH due to file permissions" warning and continue 
without updating the cache (or at least terminate.)

Also, use ~USER2's cache when running as USER2.

3. What darcs version are you using? (Try: darcs --exact-version)

$ darcs --exact-version
darcs compiled on Jul 10 2012, at 14:00:28

Context:

[add PrimV1Job kind of RepoJob to support darcsden
Ganesh Sittampalam <ganesh at earth.li>**20120710173113
 Ignore-this: 3163e04346e48fb26c5c189036370052
]

[TAG 2.8.1
Ganesh Sittampalam <ganesh at earth.li>**20120514063340
 Ignore-this: fbc024be64f47a743c1336c374f9bb14
]

Compiled with:

HTTP-4000.2.2
array-0.4.0.0
base-4.5.0.0
bytestring-0.9.2.1
containers-0.4.2.1
directory-1.1.0.2
extensible-exceptions-0.1.1.4
filepath-1.3.0.0
hashed-storage-0.5.9
haskeline-0.6.4.6
html-1.0.1.2
mmap-0.5.7
mtl-2.0.1.0
network-2.3.0.11
old-time-1.1.0.0
parsec-3.1.2
process-1.1.0.1
random-1.0.1.1
regex-compat-0.95.1
tar-0.3.2.0
terminfo-0.3.2.3
text-0.11.1.13
unix-2.5.1.0
vector-0.9.1
zlib-0.5.3.3

4. What operating system are you running?

Ubuntu Natty

STRACE:

$ rm -rf screened*; strace darcs get http://darcs.net/screened --debug-http
execve("/home/simon/.cabal/bin/darcs", ["darcs", "get", "http://darcs.net/screened", "--debug-
http"], [/* 30 vars */]) = 0
...
chdir("/home/simon/screened")           = 0
futex(0x99bab00, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x99baafc, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) 
= 1
futex(0x99bab2c, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x89802bc, FUTEX_WAKE_PRIVATE, 1) = 1
mkdir(".", 0777)                        = -1 EEXIST (File exists)
stat64(".", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
getcwd("/home/simon/screened", 4096)    = 21
chdir(".")                              = 0
open("/home/simon/screened/_darcs/hashed_inventory", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE) 
= 8
fstat64(8, {st_mode=S_IFREG|0644, st_size=28407, ...}) = 0
ioctl(8, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfd89628) = -1 ENOTTY (Inappropriate ioctl for 
device)
fstat64(8, {st_mode=S_IFREG|0644, st_size=28407, ...}) = 0
read(8, "pristine:c94729a709ad6df0b1d4a66"..., 28407) = 28407
close(8)                                = 0
stat64("/home/simon/screened/_darcs/pristine.hashed/c94729a709ad6df0b1d4a6634e201522824f99e333a
f6e6de56d2af8a299f835", 0xb6fceb10) = -1 ENOENT (No such file or directory)
stat64("/home/simon/.darcs/cache/pristine.hashed/c94729a709ad6df0b1d4a6634e201522824f99e333af6e
6de56d2af8a299f835", 0xb6fcee40) = -1 ENOENT (No such file or directory)
stat64("/home/simon/screened/_darcs/pristine.hashed/c94729a709ad6df0b1d4a6634e201522824f99e333a
f6e6de56d2af8a299f835", 0xb6fb32c0) = -1 ENOENT (No such file or directory)
stat64("/home/simon/.darcs/cache/pristine.hashed/c94729a709ad6df0b1d4a6634e201522824f99e333af6e
6de56d2af8a299f835", 0xb6fb35f0) = -1 ENOENT (No such file or directory)
mkdir("/home/simon/.darcs/cache/pristine.hashed", 0777) = -1 EEXIST (File exists)
stat64("/home/simon/.darcs/cache/pristine.hashed", {st_mode=S_IFDIR|0555, st_size=4096, ...}) = 
0
futex(0x99bac90, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x99bac8c, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) 
= 1
futex(0x99bacbc, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x89802bc, FUTEX_WAKE_PRIVATE, 1fopen() failed: Permission denied
) = 1
--- SIGVTALRM (Virtual timer expired) @ 0 (0) ---
sigreturn()                             = ? (mask now [])
open("./darcs14143", O_RDWR|O_CREAT|O_EXCL|O_NOCTTY|O_NONBLOCK|O_LARGEFILE, 0600) = 8
fstat64(8, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
ioctl(8, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfd89628) = -1 ENOTTY (Inappropriate ioctl for 
device)
close(8)                                = 0
futex(0x99bac90, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x99bac8c, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) 
= 1
futex(0x99bacbc, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x89802bc, FUTEX_WAKE_PRIVATE, 1* Re-using existing connection! (#0) with host darcs.net
* Connected to darcs.net (140.211.166.73) port 80 (#0)
* 0x99e3860 is at send pipe head!
> GET /screened/_darcs/hashed_inventory HTTP/1.1
User-Agent: darcs/2.8.1 libcurl/7.21.3
Host: darcs.net
Accept: */*

) = 1
futex(0x99baa10, FUTEX_WAIT_PRIVATE, 17, NULL) = ? ERESTARTSYS (To be restarted)
--- SIGVTALRM (Virtual timer expired) @ 0 (0) ---
sigreturn()                             = ? (mask now [])
futex(0x99baa10, FUTEX_WAIT_PRIVATE, 17, NULL) = ? ERESTARTSYS (To be restarted)
--- SIGVTALRM (Virtual timer expired) @ 0 (0) ---
sigreturn()                             = ? (mask now [])
futex(0x99baa10, FUTEX_WAIT_PRIVATE, 17, NULL< HTTP/1.1 200 OK
< Date: Tue, 24 Jul 2012 21:31:06 GMT
< Server: Apache/2.2.9 (Debian) mod_python/3.3.1 Python/2.5.2
< Last-Modified: Sat, 21 Jul 2012 16:18:55 GMT
< ETag: "4289-6ef7-4c5595e7f39c0"
< Accept-Ranges: bytes
< Content-Length: 28407
< Content-Type: text/plain
< 
) = ? ERESTARTSYS (To be restarted)
--- SIGVTALRM (Virtual timer expired) @ 0 (0) ---
sigreturn()                             = ? (mask now [])
* Connection #0 to host darcs.net left intact
futex(0x99baa10, FUTEX_WAIT_PRIVATE, 17, NULL) = -1 EAGAIN (Resource temporarily unavailable)
futex(0x99baa3c, FUTEX_WAKE_PRIVATE, 1) = 0
unlink("./darcs14143")                  = 0
open("/home/simon/screened/_darcs/pristine.hashed/c94729a709ad6df0b1d4a6634e201522824f99e333af6
e6de56d2af8a299f835", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE) = -1 ENOENT (No such file or 
directory)
stat64("/home/simon/screened", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/home/simon/.darcs/cache/pristine.hashed/c94729a709ad6df0b1d4a6634e201522824f99e333af6e6d
e56d2af8a299f835", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE) = -1 ENOENT (No such file or 
directory)
mkdir("/home/simon/.darcs/cache/pristine.hashed", 0777) = -1 EEXIST (File exists)
stat64("/home/simon/.darcs/cache/pristine.hashed", {st_mode=S_IFDIR|0555, st_size=4096, ...}) = 
0
stat64("/home/simon/.darcs/cache", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("./darcs14143", O_RDWR|O_CREAT|O_EXCL|O_NOCTTY|O_NONBLOCK|O_LARGEFILE, 0600) = 8
fstat64(8, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
ioctl(8, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfd89628) = -1 ENOTTY (Inappropriate ioctl for 
device)
close(8)                                = 0
futex(0x99bac90, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x99bac8c, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) 
= 1
futex(0x99bacbc, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x89802bc, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x99baa10, FUTEX_WAIT_PRIVATE, 19, NULL) = ? ERESTARTSYS (To be restarted)
--- SIGVTALRM (Virtual timer expired) @ 0 (0) ---
sigreturn()                             = ? (mask now [])
futex(0x99baa10, FUTEX_WAIT_PRIVATE, 19, NULL) = ? ERESTARTSYS (To be restarted)
--- SIGVTALRM (Virtual timer expired) @ 0 (0) ---
sigreturn()                             = ? (mask now [])
futex(0x99baa10, FUTEX_WAIT_PRIVATE, 19, NULL) = ? ERESTARTSYS (To be restarted)
--- SIGVTALRM (Virtual timer expired) @ 0 (0) ---
sigreturn()                             = ? (mask now [])

----------
messages: 15920
nosy: simon
priority: bug
status: needs-implementation
title: darcs get hangs when it can't write to the user's cache
topic: HTTP, Regression

__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/issue2215>
__________________________________


More information about the darcs-devel mailing list