[Geeqie-devel] Revisiting file_data_free: assertion failed: (fd->sidecar_files == NULL)

2011-03-04 Thread Michael Schwendt
Hello everyone!

This post is related to Geeqie crashing in an assertion in file_data_unref
(see subject line).

In addition to perusing more of the source code, I've received helpful --debug
output from a bug reporter, who can reproduce the issue with a few attempts,
while I don't manage to reproduce it:

  filedata.c:718: file_data_unref: deleting 
'/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.JPG', parent 
'/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.jpg'
  **
  ERROR:filedata.c:676:file_data_free: assertion failed: (fd->sidecar_files == 
NULL)

This has been encountered during loading images from an SD card.

As one can see, it added a file (*.JPG) as its own sidecar file (*.jpg),
and file_data_unref cannot cope with that.

This is because in filedata.c  file_data_check_sidecars()
and  check_case_insensitive_ext()  a case-insensitive fstat is performed
for files with a generated list of potential sidecar file name extensions.
This gives wrong results on a case-insensitive file-system and apparently
adds .jpg as a sidecar file for .JPG.

layout.c:2204: 0.341570 (+0.033411) layout_new: end
filedata.c:390: file_data_new: '/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.JPG' 
1 0
filedata.c:390: file_data_new: '/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.JPG' 
0 0
filedata.c:655: file_data_ref (2): 
'/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.JPG' @ filedata.c:398
filedata.c:428: file_data_pool hit: 
'/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.JPG' 
filedata.c:390: file_data_new: '/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.JPg' 
0 0
filedata.c:390: file_data_new: '/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.JpG' 
0 0
filedata.c:390: file_data_new: '/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.Jpg' 
0 0
filedata.c:390: file_data_new: '/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.jPG' 
0 0
filedata.c:390: file_data_new: '/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.jPg' 
0 0
filedata.c:390: file_data_new: '/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.jpG' 
0 0
filedata.c:390: file_data_new: '/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.jpg' 
0 0
filedata.c:390: file_data_new: '/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.CR2' 
0 0
filedata.c:390: file_data_new: '/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.Cr2' 
0 0
filedata.c:390: file_data_new: '/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.cR2' 
0 0
filedata.c:390: file_data_new: '/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.cr2' 
0 0

As a work-around, I've inserted a file ext comparison directly in
file_data_check_sidecars(), but I could imagine adding another one in
file_data_unref().

What do you think?

Regards,
Michael

--
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
___
Geeqie-devel mailing list
Geeqie-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geeqie-devel


Re: [Geeqie-devel] Revisiting file_data_free: assertion failed: (fd->sidecar_files == NULL)

2011-03-05 Thread Omari Stephens
On 03/04/2011 11:04 PM, Michael Schwendt wrote:
> Hello everyone!
>
> This post is related to Geeqie crashing in an assertion in file_data_unref
> (see subject line).
>
> In addition to perusing more of the source code, I've received helpful --debug
> output from a bug reporter, who can reproduce the issue with a few attempts,
> while I don't manage to reproduce it:
>
>filedata.c:718: file_data_unref: deleting 
> '/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.JPG', parent 
> '/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.jpg'
>**
>ERROR:filedata.c:676:file_data_free: assertion failed: (fd->sidecar_files 
> == NULL)
>
> This has been encountered during loading images from an SD card.
>
> As one can see, it added a file (*.JPG) as its own sidecar file (*.jpg),
> and file_data_unref cannot cope with that.
>
> This is because in filedata.c  file_data_check_sidecars()
> and  check_case_insensitive_ext()  a case-insensitive fstat is performed
> for files with a generated list of potential sidecar file name extensions.
> This gives wrong results on a case-insensitive file-system and apparently
> adds .jpg as a sidecar file for .JPG.
>
> layout.c:2204: 0.341570 (+0.033411) layout_new: end
> filedata.c:390: file_data_new: 
> '/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.JPG' 1 0
> filedata.c:390: file_data_new: 
> '/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.JPG' 0 0
> filedata.c:655: file_data_ref (2): 
> '/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.JPG' @ filedata.c:398
> filedata.c:428: file_data_pool hit: 
> '/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.JPG'
> filedata.c:390: file_data_new: 
> '/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.JPg' 0 0
> filedata.c:390: file_data_new: 
> '/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.JpG' 0 0
> filedata.c:390: file_data_new: 
> '/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.Jpg' 0 0
> filedata.c:390: file_data_new: 
> '/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.jPG' 0 0
> filedata.c:390: file_data_new: 
> '/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.jPg' 0 0
> filedata.c:390: file_data_new: 
> '/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.jpG' 0 0
> filedata.c:390: file_data_new: 
> '/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.jpg' 0 0
> filedata.c:390: file_data_new: 
> '/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.CR2' 0 0
> filedata.c:390: file_data_new: 
> '/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.Cr2' 0 0
> filedata.c:390: file_data_new: 
> '/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.cR2' 0 0
> filedata.c:390: file_data_new: 
> '/media/EOS_DIGITAL/DCIM/100CANON/IMG_3230.cr2' 0 0
>
> As a work-around, I've inserted a file ext comparison directly in
> file_data_check_sidecars(), but I could imagine adding another one in
> file_data_unref().
>
> What do you think?

I don't think it's ever legitimate for file foo.jpg to have a sidecar 
foo.JPG, even on a case-sensitive filesystem.  So doing a check in 
file_data_check_sidecars() sounds reasonable.

I wouldn't add extra checks in file_data_unref() unless they are 
guaranteed to be correct for all filesystems (since it is definitely 
valid for foo.jpg and foo.JPG to _exist_, and we don't want to end up 
with memory/resource leaks in that case).

--xsdg

--
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
___
Geeqie-devel mailing list
Geeqie-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geeqie-devel


Re: [Geeqie-devel] Revisiting file_data_free: assertion failed: (fd->sidecar_files == NULL)

2011-03-06 Thread Michael Schwendt
On Sat, 05 Mar 2011 18:49:50 +, Omari wrote:

> >ERROR:filedata.c:676:file_data_free: assertion failed: 
> > (fd->sidecar_files == NULL)
> >
> > This has been encountered during loading images from an SD card.

> I don't think it's ever legitimate for file foo.jpg to have a sidecar 
> foo.JPG, even on a case-sensitive filesystem.  So doing a check in 
> file_data_check_sidecars() sounds reasonable.
> 
> I wouldn't add extra checks in file_data_unref() unless they are 
> guaranteed to be correct for all filesystems (since it is definitely 
> valid for foo.jpg and foo.JPG to _exist_, and we don't want to end up 
> with memory/resource leaks in that case).

Okay. I've only thought about ways to handle (and prevent) the special
case where the file path of a parent and one of its childs would match
during case-insensitive comparison.

Meanwhile I've revised the patch.

Bug reporter has found another related issue, which required patching
also the function that does the fstat check for a generated list of file
extensions. If one starts Geeqie with a file arg, such as the path to a
.CR2 file that would become a sidecar file, the fstat would succeed for
all the generated mixed-cased permutations of .JPG. That resulted in the
same fatal assertion crash.

The patch has been submitted to the project's Patch tracker.

--
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
___
Geeqie-devel mailing list
Geeqie-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geeqie-devel