On Tue, May 15, 2012 at 10:21 PM, Raphael Kubo da Costa
<rak...@freebsd.org> wrote:
> Raphael Kubo da Costa <rak...@freebsd.org> writes:
>
>> I was working on some code which uses evas_object_image_memfile_set here
>> on FreeBSD, and it was failing.
>>
>> After some investigation, I found out that the problem was in the stat()
>> call in evas_cache_image_request.
>>
>> On Linux, _create_tmpf() open()s a temporary file with O_CREAT,
>> unlink()s it and then changes the actual filename to
>> /proc/<PID>/fds/<GENERATED-FD>, which exists and reads/writes into the
>> file descriptor returned by open().
>>
>> On non-Linux systems, the filename renaming does not happen (since
>> there's usually no /proc with that structure), so unlink() removes the
>> file and the stat() in evas_cache_image_request() fails.
>
> I've attached a patch to try to address this.
>
> The idea is to remove the unlink() call in _create_tmpf() and only
> remove the file in _cleanup_tmpf(). This has consequences for the Linux

Not looking at the code, but from your description this is the wrong
thing to do.

The renaming there is probably a hack so code paths that calls stat()
to check if the file exists. If you know it exists, you could rename
it to "/" for example or any path in <put-here-your-choice-of-OS> that
is guaranteed to exist in the meantime. Reading
http://lists.freebsd.org/pipermail/freebsd-hackers/2007-November/022227.html
it looks like you have an equivalent in FreeBSD in /dev/fd/.


> case as well, since the Linux code might also end up creating a file in
> /tmp if the attempt to use /dev/shm fails. Since the unlink() is now
> made unconditionally, the indirection code which made o->tmpf point to
> the process' /proc entry has also been removed, since we can't remove
> that.

Doing what I said above you wouldn't have this ugly side effect.

>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> enlightenment-devel mailing list
> enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to