Re: [ANNOUNCE] CGit v0.1-pre

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/11/06, Linus Torvalds <torvalds@xxxxxxxx> wrote:


On Mon, 11 Dec 2006, Lars Hjemli wrote:
>
> Ok. Code speeks louder than words, so I'll blatantly paste the key functions:

Yeah, they're still buggy:

> int cache_unlock(struct cacheitem *item)
> {
>       close(item->fd);
>       return (rename(fmt("%s.lock", item->name), item->name) == 0);
> }
...
>       if (!cache_exist(item)) {
>               if (!cache_lock(item)) {
>                       sleep(1);
>                       goto top;
>               }
>               if (!cache_exist(item))
>                       cgit_fill_cache(item);
>               cache_unlock(item);

What do you think happens if that last "cache_exist()" returned true?

That's right: the "cache_unlock()" will now OVERWRITE the valid cache with
the (empty) lock-file that you didn't fill in.

Oops.


Wow, that's embarrassing.

Thanks for the debugging, I'll try to actually fix it this time :-)

--
lars
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]