Bug 1551747 - Can't read gvfs/gphoto2 filesystem: Error: Failed to get folder list: -1: Unspecified error
Summary: Can't read gvfs/gphoto2 filesystem: Error: Failed to get folder list: -1: Uns...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libgphoto2
Version: 7.5
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: rc
: ---
Assignee: Josef Ridky
QA Contact: Desktop QE
URL:
Whiteboard:
: 1676681 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-03-05 21:33 UTC by Michael Mráka
Modified: 2019-08-06 13:04 UTC (History)
10 users (show)

Fixed In Version: libgphoto2-2.5.15-2.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-08-06 13:03:58 UTC


Attachments (Terms of Use)
debug logfile (31.52 KB, text/plain)
2018-03-06 22:47 UTC, Michael Mráka
no flags Details
gphoto2 debug log file (35.88 KB, text/plain)
2018-06-03 22:38 UTC, Akemi Yagi
no flags Details
debug from working version (69.48 KB, text/plain)
2019-02-14 19:57 UTC, Michael Mráka
no flags Details


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:2194 None None None 2019-08-06 13:03:59 UTC

Description Michael Mráka 2018-03-05 21:33:16 UTC
Description of problem:
Digital camera connected via gvfs-gphoto2 no more works.

Version-Release number of selected component (if applicable):
gvfs-gphoto2.x86_64 0:1.30.4-5.el7
libgphoto2.x86_64 0:2.5.15-1.el7

How reproducible:
Always.

Steps to Reproduce:
1. connect a camera providing MTP interface via usb
2. gvfs-ls /run/user/1000/gvfs/gphoto2:host=%5Busb%3A001%2C008%5D/store_deadbeef/DCIM/
3. (same error message pops up in nautilus)

Actual results:
$ gvfs-ls /run/user/1000/gvfs/gphoto2:host=%5Busb%3A001%2C008%5D/store_deadbeef/DCIM/
Error: Failed to get folder list: -1: Unspecified error

Expected results:
$ gvfs-ls /run/user/1000/gvfs/gphoto2:host=%5Busb%3A001%2C008%5D/store_deadbeef/DCIM/
126__02/
127__03/

i.e. content of directory shown.

Additional info:
dmesg show connected camera:
[  925.607955] usb 1-4.1: new high-speed USB device number 8 using xhci_hcd
[  925.696356] usb 1-4.1: New USB device found, idVendor=04a9, idProduct=329a
[  925.696365] usb 1-4.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  925.696369] usb 1-4.1: Product: Canon Digital Camera
[  925.696373] usb 1-4.1: Manufacturer: Canon Inc.

Works after downgrade to RHEL 7.4 versions:
gvfs-gphoto2.x86_64 0:1.30.4-3.el7
libgphoto2.x86_64 0:2.5.2-5.el7

Comment 1 Tomas Pelka 2018-03-06 06:47:50 UTC
We updated libgphoto2 to libgphoto2-2.5.15-1.el7 in rhel7.5, would you mind checking this new version?

Note that couple of other components were updated too, see https://errata.devel.redhat.com/advisory/30790

Comment 2 Michael Mráka 2018-03-06 07:24:52 UTC
(In reply to Tomas Pelka from comment #1)
> We updated libgphoto2 to libgphoto2-2.5.15-1.el7 in rhel7.5, would you mind
> checking this new version?

This is the broken version reported in comment #0.

Comment 3 Ondrej Holy 2018-03-06 09:38:42 UTC
Nothing changed in gphoto2 backend between gvfs-gphoto2.x86_64 0:1.30.4-5.el7 and gvfs-gphoto2.x86_64 0:1.30.4-3.el7. This error comes from gp_camera_folder_list_folders, so something had to change in libgphoto2. I can't reproduce with my camera, but it is probably because it does not use folders... 

It would be good to try with gphoto2 cmd utils (see --list-folders and --debug options).

Changing component to libgphoto2.

Comment 5 Michael Mráka 2018-03-06 22:45:16 UTC
old version (libgphoto2-2.5.2-5.el7.x86_64)

$ gphoto2 --list-folders
There is 1 folder in folder '/'.                                               
 - store_00010001
There is 1 folder in folder '/store_00010001'.
 - DCIM
There are 2 folders in folder '/store_00010001/DCIM'.
 - 126___02
 - 127___03
There are 0 folders in folder '/store_00010001/DCIM/126___02'.
There are 0 folders in folder '/store_00010001/DCIM/127___03'.


new version (libgphoto2-2.5.15-1.el7.x86_64)

$ gphoto2 --list-folders
There is 1 folder in folder '/'.                                               
 - store_deadbeef
There is 1 folder in folder '/store_deadbeef'.
 - DCIM

*** Error ***              
PTP Invalid Storage ID
*** Error (-1: 'Unspecified error') ***       

For debugging messages, please use the --debug option.
Debugging messages may help finding a solution to your problem.
If you intend to send any error or debug messages to the gphoto
developer mailing list <gphoto-devel@lists.sourceforge.net>, please run
gphoto2 as follows:

    env LANG=C gphoto2 --debug --debug-logfile=my-logfile.txt --list-folders

Please make sure there is sufficient quoting around the arguments.

Comment 6 Michael Mráka 2018-03-06 22:47:27 UTC
Created attachment 1405049 [details]
debug logfile

Debug info obtained using

$ env LANG=C gphoto2 --debug --debug-logfile=my-logfile.txt --list-folders
There is 1 folder in folder '/'.                                               
 - store_deadbeef
There is 1 folder in folder '/store_deadbeef'.
 - DCIM

*** Error ***              
PTP Invalid Storage ID
*** Error (-1: 'Unspecified error') ***

Comment 7 Akemi Yagi 2018-06-03 22:38:12 UTC
Created attachment 1447268 [details]
gphoto2 debug log file

Comment 8 Akemi Yagi 2018-06-03 22:39:20 UTC
I'm seeing the same problem with my two Canon cameras. I have uploaded a debug file.

Comment 9 Akemi Yagi 2018-06-04 15:44:02 UTC
I have rebuilt libgphoto2 using the 2.5.17 tar file. The issue seems to be fixed in this version.

$ gphoto2 --list-folders
There is 1 folder in folder '/'.                                               
 - store_00010001
There is 1 folder in folder '/store_00010001'.
 - DCIM
There are 20 folders in folder '/store_00010001/DCIM'.
 - 124___02
 - 126___04
 - 127___05
 - 128___06
 - 129___07
etc.

Comment 10 Josef Ridky 2018-06-05 06:05:51 UTC
Thanks for it. I'll check changes between 2.5.15 and 2.5.17 and prepare patch with solution.

Comment 12 Akemi Yagi 2018-12-06 15:30:33 UTC
(In reply to Josef Ridky from comment #10)
> Thanks for it. I'll check changes between 2.5.15 and 2.5.17 and prepare
> patch with solution.

Any update on this?

I see that RHEL 8 beta has 2.5.16. I don't (yet) know if this works or not.

Comment 13 Jiri Kucera 2019-02-14 10:54:49 UTC
Hello Michael,

could you please provide also a log for successful cases? I'm curious for whats going on in
- libgphoto2-2.5.2-5.el7.x86_64
- libgphoto2 using the 2.5.17 tar file

From the inspection of the log previously attached, I am deducing that there is something wrong with the device info obtained from camera ("Supported operations:" list should not be empty).

Comment 14 Michael Mráka 2019-02-14 19:57:11 UTC
Created attachment 1534950 [details]
debug from working version

Hello Jiri,

here is the log using libgphoto2-2.5.2-5.el7.x86_64 obtained by

$ env LANG=C gphoto2 --debug --debug-logfile=my-logfile.txt --list-folders
There is 1 folder in folder '/'.                                               
 - store_00010001
There is 1 folder in folder '/store_00010001'.
 - DCIM
There is 1 folder in folder '/store_00010001/DCIM'.
 - 137___01
There are 0 folders in folder '/store_00010001/DCIM/137___01'.



I don't have access to libgphoto2 2.5.17 version.

Comment 15 Jiri Kucera 2019-02-14 22:39:20 UTC
Thank you Michael!

Finally, I found it. In libgphoto2-2.5.15, the problem was that ptp_unpack_string from camlibs/ptp2/ptp-pack.c returns prematurely if the length of string is 0 and leave data to which 'len' points untouched:

https://github.com/gphoto/libgphoto2/blob/230b2433ee567676c779a7a1ac021f061288cfff/camlibs/ptp2/ptp-pack.c#L143

Since len points to an uninitialized local variable, it contains random data and hence the nonsensical device output in logs, concretely:
- in your previous log, it contains 0x1 and hence it treats the Supported operations array's size (0x42) as Functional Mode
- in Akemi Yagi's log, it contains 0x1f (if I computed it rightly), and hence the 'Functional Mode: 0x901c' (offset 0x53 from the beginning of received USB packet)

As we can see, libgphoto2-2.5.2 has no such a problem:

https://github.com/gphoto/libgphoto2/blob/21984d946125e411d72d002907c8038ba7984b74/camlibs/ptp2/ptp-pack.c#L134

Simply said, this bug has been caused by a regression introduced by refactoring of ptp_unpack_string somewhere between libgphoto2-2.5.2 and libgphoto2-2.5.15.

This patch from libgphoto2-2.5.16 should fix the problem:

https://github.com/gphoto/libgphoto2/commit/d8f6ec8c1a03572f638cfca44a2ee48cccb8c465.patch

Comment 16 Akemi Yagi 2019-02-15 01:30:40 UTC
Hi Jiri,

Thanks for identifying the patch. I applied it to libgphoto2-2.5.15 and confirm that it does fix the problem.

Comment 17 Josef Ridky 2019-02-21 10:28:14 UTC
*** Bug 1676681 has been marked as a duplicate of this bug. ***

Comment 22 errata-xmlrpc 2019-08-06 13:03:58 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:2194


Note You need to log in before you can comment on or make changes to this bug.