whoozle / android-file-transfer-linux

Android File Transfer for Linux (and macOS!)
http://whoozle.github.io/android-file-transfer-linux/
GNU Lesser General Public License v2.1
1.47k stars 120 forks source link

It's not possible to upload files/folders with a ":" (colon) #216

Open RedirectCleaner opened 5 years ago

RedirectCleaner commented 5 years ago

Uploading a file/folder with a ":" (colon) like "test:large.jpg" breaks the upload and the upload dialog closes after some timeout, but the file doesn't get uploaded.

This is the debug output it get for a filename which includes a colon:

files dropped:  ("/home/test/test:larg.jpg")
uploadFiles  ("/home/test/test:larg.jpg")
uploading 69551 bytes
uploading file  "/home/test/test:larg.jpg" , parent:  "/home/test"
adding first parent path
directories[0]:  "/home/test"  ->  4294967295
uploadFile  "test:larg.jpg"  as  "test:larg.jpg"
sending  69551  bytes
new object id:  34949 , sending...
30028 ms since the last poll call
uploading file  "/home/test/test:larg.jpg"  failed:  "timeout reaping usb urb"
finishing queue
got unknown urb: 0x7fffdfffe360
30028 ms since the last poll call
finalizing commands failed:  "timeout reaping usb urb"
finished

Uploading a dirname with a colon:

files dropped:  ("/home/test/a:b")
uploadFiles  ("/home/test/a:b")
adding subdirectory "/home/test/a:b"
uploading 69551 bytes
making directory "/home/test/a:b" , parent:  "/home/test" , dir:  "a:b"
adding first parent path
directories[0]:  "/home/test"  ->  4294967295
creating directory "/home/test/a:b" failed:  "SendObjectInfo: invalid response code GeneralError (0x2002)"
uploading file  "/home/test/a:b/test:large.jpg" , parent:  "/home/test/a:b"
invalid parent  "/home/test/a:b"
finishing queue
finished

The folder "a:b" is now shown in the dialog but trying to delete it leads to a crash

deleting object  34950
terminate called after throwing an instance of 'mtp::InvalidResponseException'
  what():  Get: invalid response code InvalidObjectHandle (0x2009)
    ByteArray Session::Get(u32 transaction, int timeout)
    {
        if (timeout <= 0)
            timeout = _defaultTimeout;
        ByteArray data, response;
        ResponseType responseCode;
        _packeter.Read(transaction, data, responseCode, response, timeout);
        CHECK_RESPONSE(responseCode); <-- crashes here
        return data;
    }

Uploading the same file with the colon removed "testlarge.jpg" works without a problem

RedirectCleaner commented 5 years ago

i would guess that all "special characters" are not handled correctly like "<",">","|","?" and ":"

I would propose to just replace them with an underline (_) whenever a filename/foldername includes one of these characters

whoozle commented 5 years ago

Thanks, I have to handle exceptions in UI better.

whoozle commented 5 years ago

what's your phone make/model? Each symbol you mentioned works for my old nexus 5 :D

LGE Nexus 5 [100%]:Внутр. накопитель> ls
32047      ?
32048      |
whoozle commented 5 years ago

standard itself does not disallow anything except '/' in object name :)

whoozle commented 5 years ago

could you please check revision 96af0e1dd6e3af6be85a2ebacd0cbeb5d1c8c4b1 if it's working for you

RedirectCleaner commented 5 years ago

I compiled 0da7f4ed6f3e08a974d782b3313b0925cf8dd707

it's a Huawei device. now i get:

files dropped:  ("/tmp/foo:test.png")
uploadFiles  ("/tmp/foo:test.png")
uploading 31212 bytes
uploading file  "/tmp/foo:test.png" , parent:  "/tmp"
adding first parent path
directories[0]:  "/tmp"  ->  4294967295
uploadFile  "foo:test.png"  as  "foo:test.png"
sending  31212  bytes
new object id:  34960 , sending...
30029 ms since the last poll call
uploading file  "/tmp/foo:test.png"  failed:  "timeout reaping usb urb"
finishing queue
got unknown urb: 0x7fffdfffe360
30029 ms since the last poll call
finalizing commands failed:  "timeout reaping usb urb"
finished
refreshing object list
got unknown urb: 0x7fffdfffe2b0
30022 ms since the last poll call
terminate called after throwing an instance of 'mtp::usb::TimeoutException'
  what():  timeout reaping usb urb

Now it crashes here:

    void Device::Submit(Urb *urb, int timeout)
    {
        urb->Submit();
        try
        {
            while(true)
            {
                usbdevfs_urb * completedKernelUrb = static_cast<usbdevfs_urb *>(Reap(timeout));
                if (urb->GetKernelUrb() != completedKernelUrb)
                {
                    error("got unknown urb: ", completedKernelUrb);
                    continue;
                }
                else
                    break;
            }
        }
        catch(const TimeoutException &ex)
        {
            urb->Discard();
            throw; <--- crashes here
        }
RedirectCleaner commented 5 years ago

The problem seems to be related to the SD card which is FAT32 (which doesn't allow "<",">","|","?" and ":" for filenames, at least in windows), copying the file to the internal memory works.

whoozle commented 5 years ago

hmm, can you show me backtrace of the crash please? just run gdb build/qt/android-file-transfer

then type in r command. When it crashed, type bt

RedirectCleaner commented 5 years ago

Thread 1 "android-file-tr" received signal SIGABRT, Aborted. __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory. (gdb) bt

0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50

1 0x00007ffff63ae535 in __GI_abort () at abort.c:79

2 0x00007ffff6988385 in __gnu_cxx::__verbose_terminate_handler ()

at /tmp/gcc-8.2.0-r6/work/gcc-8.2.0/libstdc++-v3/libsupc++/vterminate.cc:95

3 0x00007ffff69ac436 in cxxabiv1::terminate(void (*)()) ()

at /tmp/gcc-8.2.0-r6/work/gcc-8.2.0/libstdc++-v3/libsupc++/eh_terminate.cc:47

4 0x00007ffff69ac471 in std::terminate ()

at /tmp/gcc-8.2.0-r6/work/gcc-8.2.0/libstdc++-v3/libsupc++/eh_terminate.cc:57

5 0x00007ffff69ac6f6 in cxxabiv1::cxa_rethrow ()

at /tmp/gcc-8.2.0-r6/work/gcc-8.2.0/libstdc++-v3/libsupc++/eh_throw.cc:133

6 0x00005555556461ab in mtp::usb::Device::Submit (this=0x555555ac4f00, urb=0x7fffffffc110, timeout=30000)

at /mnt/data/Develop/android-file-transfer-linux/mtp/backend/linux/usb/Device.cpp:258

7 0x0000555555646345 in mtp::usb::Device::WriteBulk (this=0x555555ac4f00, ep=

std::shared_ptr<mtp::usb::Endpoint> (use count 2, weak count 0) = {...}, inputStream=
std::shared_ptr<mtp::IObjectInputStream> (use count 2, weak count 0) = {...}, timeout=30000)
at /mnt/data/Develop/android-file-transfer-linux/mtp/backend/linux/usb/Device.cpp:287

8 0x0000555555638705 in mtp::usb::BulkPipe::Write (this=0x555555ac5140,

inputStream=std::shared_ptr<mtp::IObjectInputStream> (use count 2, weak count 0) = {...}, timeout=30000)
at /mnt/data/Develop/android-file-transfer-linux/mtp/usb/BulkPipe.cpp:87

9 0x00005555556227a4 in mtp::PipePacketer::Write (this=0x555555aab8c0,

inputStream=std::shared_ptr<mtp::IObjectInputStream> (use count 2, weak count 0) = {...}, timeout=30000)
at /mnt/data/Develop/android-file-transfer-linux/mtp/ptp/PipePacketer.cpp:36

10 0x0000555555622807 in mtp::PipePacketer::Write (this=0x555555aab8c0, data=std::vector of length 24, capacity 512 = {...},

timeout=30000) at /mnt/data/Develop/android-file-transfer-linux/mtp/ptp/PipePacketer.cpp:39

11 0x0000555555628139 in mtp::Session::Send (this=0x555555aab870, req=..., timeout=30000)

at /mnt/data/Develop/android-file-transfer-linux/mtp/ptp/Session.cpp:88

12 0x000055555562e93b in mtp::Session::RunTransactionWithDataRequest<unsigned int&, unsigned int, unsigned int&> (

this=0x555555aab870, timeout=30000, code=mtp::OperationCode::GetObjectHandles, 
inputStream=std::shared_ptr<mtp::IObjectInputStream> (empty) = {...}, args#0=@0x7fffffffc49c: 1532231681, 
args#1=@0x7fffffffc4b0: 0, args#2=@0x7fffffffc494: 4294967295)
at /mnt/data/Develop/android-file-transfer-linux/mtp/ptp/Session.cpp:117

13 0x000055555562c919 in mtp::Session::RunTransaction<unsigned int&, unsigned int, unsigned int&> (this=0x555555aab870,

timeout=30000, code=mtp::OperationCode::GetObjectHandles, args#0=@0x7fffffffc49c: 1532231681, args#1=@0x7fffffffc4b0: 0, 

---Type to continue, or q to quit---

2=@0x7fffffffc494: 4294967295) at /mnt/data/Develop/android-file-transfer-linux/./mtp/ptp/Session.h:140

14 0x0000555555628593 in mtp::Session::GetObjectHandles (this=0x555555aab870, storageId=..., objectFormat=mtp::ObjectFormat::Any, parent=..., timeout=30000) at /mnt/data/Develop/android-file-transfer-linux/mtp/ptp/Session.cpp:139

15 0x0000555555608976 in MtpObjectsModel::setParent (this=0x555555764ae0, parentObjectId=...) at /mnt/data/Develop/android-file-transfer-linux/qt/mtpobjectsmodel.cpp:57

16 0x00005555555fc725 in MtpObjectsModel::refresh (this=0x555555764ae0) at /mnt/data/Develop/android-file-transfer-linux/qt/mtpobjectsmodel.h:90

17 0x00005555555f5461 in MainWindow::refresh (this=0x7fffffffd800) at /mnt/data/Develop/android-file-transfer-linux/qt/mainwindow.cpp:320

18 0x00005555555f6617 in MainWindow::uploadFiles (this=0x7fffffffd800, files=...) at /mnt/data/Develop/android-file-transfer-linux/qt/mainwindow.cpp:444

19 0x0000555555617865 in MainWindow::qt_static_metacall (_o=0x7fffffffd800, _c=QMetaObject::InvokeMetaMethod, _id=17, _a=0x7fffffffc820) at qt/moc_mainwindow.cpp:174

20 0x00007ffff6f6f13e in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib64/libQt5Core.so.5

21 0x0000555555618b62 in MtpObjectsModel::onFilesDropped (this=0x555555764ae0, _t1=...) at qt/moc_mtpobjectsmodel.cpp:161

22 0x000055555560b6d5 in MtpObjectsModel::dropMimeData (this=0x555555764ae0, data=0x7fffe8005680, action=Qt::CopyAction, row=-1, column=-1, parent=...) at /mnt/data/Develop/android-file-transfer-linux/qt/mtpobjectsmodel.cpp:342

23 0x00007ffff6f1deb3 in QAbstractProxyModel::dropMimeData(QMimeData const*, Qt::DropAction, int, int, QModelIndex const&) () from /usr/lib64/libQt5Core.so.5

24 0x00007ffff7cdf79c in QAbstractItemView::dropEvent(QDropEvent*) () from /usr/lib64/libQt5Widgets.so.5

25 0x00007ffff7ad40b8 in QWidget::event(QEvent*) () from /usr/lib64/libQt5Widgets.so.5

26 0x00007ffff7b78b3e in QFrame::event(QEvent*) () from /usr/lib64/libQt5Widgets.so.5

27 0x00007ffff7cea6a3 in QAbstractItemView::viewportEvent(QEvent*) () from /usr/lib64/libQt5Widgets.so.5

28 0x00007ffff6f472ee in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject, QEvent) () from /usr/lib64/libQt5Core.so.5

29 0x00007ffff7a94551 in QApplicationPrivate::notify_helper(QObject, QEvent) () from /usr/lib64/libQt5Widgets.so.5

30 0x00007ffff7a9ca78 in QApplication::notify(QObject, QEvent) () from /usr/lib64/libQt5Widgets.so.5

31 0x00007ffff6f474a2 in QCoreApplication::notifyInternal2(QObject, QEvent) () from /usr/lib64/libQt5Core.so.5

32 0x00007ffff7af0c62 in ?? () from /usr/lib64/libQt5Widgets.so.5

33 0x00007ffff7af18c5 in ?? () from /usr/lib64/libQt5Widgets.so.5

34 0x00007ffff7a94561 in QApplicationPrivate::notify_helper(QObject, QEvent) () from /usr/lib64/libQt5Widgets.so.5

35 0x00007ffff7a9bb78 in QApplication::notify(QObject, QEvent) () from /usr/lib64/libQt5Widgets.so.5

36 0x00007ffff6f474a2 in QCoreApplication::notifyInternal2(QObject, QEvent) () from /usr/lib64/libQt5Core.so.5

37 0x00007ffff730b3d2 in QGuiApplicationPrivate::processDrop(QWindow, QMimeData const, QPoint const&, QFlags, QFlags, QFlags) () from /usr/lib64/libQt5Gui.so.5

38 0x00007ffff72e59b8 in QWindowSystemInterface::handleDrop(QWindow, QMimeData const, QPoint const&, QFlags, QFlags, QFlags) () from /usr/lib64/libQt5Gui.so.5

39 0x00007ffff0aad315 in ?? () from /usr/lib64/libQt5XcbQpa.so.5

40 0x00007ffff0a90388 in QXcbWindow::handleClientMessageEvent(xcb_client_message_event_t const*) () from /usr/lib64/libQt5XcbQpa.so.5

41 0x00007ffff0a7b520 in QXcbConnection::handleXcbEvent(xcb_generic_event_t*) () from /usr/lib64/libQt5XcbQpa.so.5

42 0x00007ffff0a7c1cc in QXcbConnection::processXcbEvents(QFlags) () from /usr/lib64/libQt5XcbQpa.so.5

43 0x00007ffff0aa64e3 in ?? () from /usr/lib64/libQt5XcbQpa.so.5

44 0x00007ffff519949e in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0

45 0x00007ffff5199738 in ?? () from /usr/lib64/libglib-2.0.so.0

46 0x00007ffff51997cc in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0

47 0x00007ffff6f98e53 in QEventDispatcherGlib::processEvents(QFlags) () from /usr/lib64/libQt5Core.so.5

48 0x00007ffff6f4647b in QEventLoop::exec(QFlags) () from /usr/lib64/libQt5Core.so.5

49 0x00007ffff6f4e242 in QCoreApplication::exec() () from /usr/lib64/libQt5Core.so.5

50 0x00005555555f1f64 in main (argc=1, argv=0x7fffffffd998) at /mnt/data/Develop/android-file-transfer-linux/qt/main.cpp:74

whoozle commented 5 years ago

thanks a lot! this is the most helpful. I have to guard all slots with try/catch to avoid this type of crashes.

whoozle commented 5 years ago

please check 9811703a1be2affe400027fc6a5374cee8b6f487

RedirectCleaner commented 5 years ago

Now i get a sluggish interface that shows no files anymore after i dropped the file on a fat32 partition. Trying to switch to the internal storage afterwards leads to another crash

files dropped:  ("/tmp/foo:test.png")
uploadFiles  ("/tmp/foo:test.png")
uploading 31212 bytes
uploading file  "/tmp/foo:test.png" , parent:  "/tmp"
adding first parent path
directories[0]:  "/tmp"  ->  4294967295
uploadFile  "foo:test.png"  as  "foo:test.png"
sending  31212  bytes
new object id:  35028 , sending...
30028 ms since the last poll call
uploading file  "/tmp/foo:test.png"  failed:  "timeout reaping usb urb"
finishing queue
got unknown urb: 0x7fffdfffe360
30029 ms since the last poll call
setParent failed: "timeout reaping usb urb"
finished
refreshing object list
got unknown urb: 0x7fffdfffe240
30027 ms since the last poll call
setParent failed: "timeout reaping usb urb"
switching to storage id  65537
got unknown urb: 0x7fffffffbfe0
30028 ms since the last poll call
Thread 1 "android-file-tr" received signal SIGSEGV, Segmentation fault.
uw_frame_state_for (context=context@entry=0x7fffffffbaa0, fs=fs@entry=0x7fffffffbb90)
    at /tmp/gcc-8.2.0-r6/work/gcc-8.2.0/libgcc/unwind-dw2.c:1265
#0  uw_frame_state_for (context=context@entry=0x7fffffffbaa0, fs=fs@entry=0x7fffffffbb90)
    at /tmp/gcc-8.2.0-r6/work/gcc-8.2.0/libgcc/unwind-dw2.c:1265
#1  0x00007ffff656a7e3 in _Unwind_RaiseException (exc=0x555555d6c470)
    at /tmp/gcc-8.2.0-r6/work/gcc-8.2.0/libgcc/unwind.inc:104
#2  0x00007ffff656ae7d in _Unwind_Resume_or_Rethrow ()
    at /tmp/gcc-8.2.0-r6/work/gcc-8.2.0/libgcc/unwind.inc:264
#3  0x00007ffff69ac6e9 in __cxxabiv1::__cxa_rethrow ()
    at /tmp/gcc-8.2.0-r6/work/gcc-8.2.0/libstdc++-v3/libsupc++/eh_throw.cc:126
#4  0x00005555556463d3 in mtp::usb::Device::Submit (this=0x555555b045c0, urb=0x7fffffffc050, timeout=30000)
    at /mnt/data/Develop/android-file-transfer-linux/mtp/backend/linux/usb/Device.cpp:258
#5  0x0000555500000000 in ?? ()
#6  0x00007530ffffc030 in ?? ()
#7  0x00007fffffffc1a0 in ?? ()
#8  0x0000555555ad81e8 in ?? ()
#9  0x0000555555b045c0 in ?? ()
#10 0xffffffffffffc050 in ?? ()
#11 0x0100555555bbea28 in ?? ()
#12 0x0000000000001000 in ?? ()
#13 0x0000000000000018 in ?? ()
#14 0x0000000000000103 in ?? ()
#15 0x0000000000000040 in ?? ()
#16 0x0000555555f5f430 in ?? ()
#17 0x0000000000000018 in ?? ()
#18 0x0000000000000000 in ?? ()
whoozle commented 5 years ago

could you please pull again?

  1. wrapped everything with try catch :)
  2. added device reset 6df2411c3573735c6ddc94241624327ceff941f8 mentioned in PIMA spec.

For some reason, one of the folders in my old phone is responding with timeout when big files are uploaded, I used this phone to test this timeout problem. :)

RedirectCleaner commented 5 years ago

i compiled f64743708404b07883c83be6af55d22c81a7ff97 but it still crashes, now after dropping the file (the dialog box "Upload Progress" doesn't close before the crash)

files dropped:  ("/tmp/foo:test.png")
uploadFiles  ("/tmp/foo:test.png")
uploading 31212 bytes
uploading file  "/tmp/foo:test.png" , parent:  "/tmp"
adding first parent path
directories[0]:  "/tmp"  ->  4294967295
uploadFile  "foo:test.png"  as  "foo:test.png"
sending  31212  bytes
new object id:  35029 , sending...
30029 ms since the last poll call
failed to send new object info  "timeout reaping usb urb"
finishing queue
got unknown urb: 0x7fffdfffe350
30029 ms since the last poll call
#0  _Unwind_GetGR (regno=16, context=0x7fffdfffdc90)
    at /tmp/gcc-8.2.0-r6/work/gcc-8.2.0/libgcc/unwind-dw2.c:250
#1  _Unwind_GetPtr (index=16, context=0x7fffdfffdc90)
    at /tmp/gcc-8.2.0-r6/work/gcc-8.2.0/libgcc/unwind-dw2.c:261
#2  uw_update_context () at /tmp/gcc-8.2.0-r6/work/gcc-8.2.0/libgcc/unwind-dw2.c:1535
#3  0x00007ffff656a7d8 in _Unwind_RaiseException (exc=0x7fffd8009310)
    at /tmp/gcc-8.2.0-r6/work/gcc-8.2.0/libgcc/unwind.inc:127
#4  0x00007ffff656ae7d in _Unwind_Resume_or_Rethrow ()
    at /tmp/gcc-8.2.0-r6/work/gcc-8.2.0/libgcc/unwind.inc:264
#5  0x00007ffff69ac6e9 in __cxxabiv1::__cxa_rethrow ()
    at /tmp/gcc-8.2.0-r6/work/gcc-8.2.0/libstdc++-v3/libsupc++/eh_throw.cc:126
#6  0x0000555555646af1 in mtp::usb::Device::Submit (this=0x555555b8ee50, urb=0x7fffdfffe240, timeout=30000)
    at /mnt/data/Develop/android-file-transfer-linux/mtp/backend/linux/usb/Device.cpp:268
#7  0x0000555555646c8b in mtp::usb::Device::WriteBulk (this=0x555555b8ee50, ep=
    std::shared_ptr<mtp::usb::Endpoint> (use count 2, weak count 0) = {...}, inputStream=
    std::shared_ptr<mtp::IObjectInputStream> (use count 2, weak count 0) = {...}, timeout=30000)
    at /mnt/data/Develop/android-file-transfer-linux/mtp/backend/linux/usb/Device.cpp:297
#8  0x0000555555638deb in mtp::usb::BulkPipe::Write (this=0x555555d9dec0, 
    inputStream=std::shared_ptr<mtp::IObjectInputStream> (use count 2, weak count 0) = {...}, timeout=30000)
    at /mnt/data/Develop/android-file-transfer-linux/mtp/usb/BulkPipe.cpp:87
#9  0x0000555555623316 in mtp::PipePacketer::Write (this=0x555555b8af10, 
    inputStream=std::shared_ptr<mtp::IObjectInputStream> (use count 2, weak count 0) = {...}, timeout=30000)
    at /mnt/data/Develop/android-file-transfer-linux/mtp/ptp/PipePacketer.cpp:36
#10 0x0000555555623379 in mtp::PipePacketer::Write (
    this=<error reading variable: Cannot access memory at address 0xfffffffedfffe378>, 
    data=<error reading variable: Cannot access memory at address 0xfffffffedfffe370>, 
    timeout=<error reading variable: Cannot access memory at address 0xfffffffedfffe36c>)
    at /mnt/data/Develop/android-file-transfer-linux/mtp/ptp/PipePacketer.cpp:39
Backtrace stopped: Cannot access memory at address 0xfffffffedfffe3c8
whoozle commented 5 years ago

and it's getting segmentation fault signal?

whoozle commented 5 years ago

I've added additional resets in 07ea91498976c0ab8a7148f860884c9cc7be12d3

RedirectCleaner commented 5 years ago

crashes again

files dropped:  ("/tmp/foo:test.png")
uploadFiles  ("/tmp/foo:test.png")
uploading 31212 bytes
uploading file  "/tmp/foo:test.png" , parent:  "/tmp"
adding first parent path
directories[0]:  "/tmp"  ->  4294967295
uploadFile  "foo:test.png"  as  "foo:test.png"
sending  31212  bytes
new object id:  35040 , sending...
30029 ms since the last poll call
failed to send new object info  "timeout reaping usb urb"
finishing queue
got unknown urb: 0x7fffdfffe350
30029 ms since the last poll call

Thread 4 "QThread" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffdffff700 (LWP 30868)]
_Unwind_GetGR (regno=16, context=0x7fffdfffdc90)
    at /tmp/gcc-8.2.0-r6/work/gcc-8.2.0/libgcc/unwind-dw2.c:250
250     /tmp/gcc-8.2.0-r6/work/gcc-8.2.0/libgcc/unwind-dw2.c: No such file or directory.
(gdb) bt
#0  _Unwind_GetGR (regno=16, context=0x7fffdfffdc90)
    at /tmp/gcc-8.2.0-r6/work/gcc-8.2.0/libgcc/unwind-dw2.c:250
#1  _Unwind_GetPtr (index=16, context=0x7fffdfffdc90)
    at /tmp/gcc-8.2.0-r6/work/gcc-8.2.0/libgcc/unwind-dw2.c:261
#2  uw_update_context () at /tmp/gcc-8.2.0-r6/work/gcc-8.2.0/libgcc/unwind-dw2.c:1535
#3  0x00007ffff656a7d8 in _Unwind_RaiseException (exc=0x7fffd8001dc0)
    at /tmp/gcc-8.2.0-r6/work/gcc-8.2.0/libgcc/unwind.inc:127
#4  0x00007ffff656ae7d in _Unwind_Resume_or_Rethrow ()
    at /tmp/gcc-8.2.0-r6/work/gcc-8.2.0/libgcc/unwind.inc:264
#5  0x00007ffff69ac6e9 in __cxxabiv1::__cxa_rethrow ()
    at /tmp/gcc-8.2.0-r6/work/gcc-8.2.0/libstdc++-v3/libsupc++/eh_throw.cc:126
#6  0x0000555555646c85 in mtp::usb::Device::Submit (this=0x555555c50570, urb=0x7fffdfffe240, timeout=30000)
    at /mnt/data/Develop/Progs/android-file-transfer-linux/mtp/backend/linux/usb/Device.cpp:280
#7  0x0000555555646e1f in mtp::usb::Device::WriteBulk (this=0x555555c50570, ep=
    std::shared_ptr<mtp::usb::Endpoint> (use count 2, weak count 0) = {...}, inputStream=
    std::shared_ptr<mtp::IObjectInputStream> (use count 2, weak count 0) = {...}, timeout=30000)
    at /mnt/data/Develop/Progs/android-file-transfer-linux/mtp/backend/linux/usb/Device.cpp:309
#8  0x0000555555638ec3 in mtp::usb::BulkPipe::Write (this=0x555555a87d50, 
    inputStream=std::shared_ptr<mtp::IObjectInputStream> (use count 2, weak count 0) = {...}, timeout=30000)
    at /mnt/data/Develop/Progs/android-file-transfer-linux/mtp/usb/BulkPipe.cpp:97
#9  0x0000555555623316 in mtp::PipePacketer::Write (this=0x555555aacc20, 
    inputStream=std::shared_ptr<mtp::IObjectInputStream> (use count 2, weak count 0) = {...}, timeout=30000)
    at /mnt/data/Develop/Progs/android-file-transfer-linux/mtp/ptp/PipePacketer.cpp:36
#10 0x0000555555623379 in mtp::PipePacketer::Write (
    this=<error reading variable: Cannot access memory at address 0xfffffffedfffe378>, 
    data=<error reading variable: Cannot access memory at address 0xfffffffedfffe370>, 
    timeout=<error reading variable: Cannot access memory at address 0xfffffffedfffe36c>)
    at /mnt/data/Develop/Progs/android-file-transfer-linux/mtp/ptp/PipePacketer.cpp:39
Backtrace stopped: Cannot access memory at address 0xfffffffedfffe3c8
whoozle commented 5 years ago

that's really weird, as if your code is built with -fno-exception, or similar option. Can you run verbose build with ninja -v or make VERBOSE=1 and show me typical options you have

RedirectCleaner commented 5 years ago

compiled with "ninja -v"

Thread 4 "QThread" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe4f8f700 (LWP 16374)]
_Unwind_GetGR (regno=16, context=0x7fffe4f8dc90)
    at /tmp/gcc-8.3.0-r1/work/gcc-8.3.0/libgcc/unwind-dw2.c:250
250     /tmp/gcc-8.3.0-r1/work/gcc-8.3.0/libgcc/unwind-dw2.c: No such file or directory.
(gdb) bt
#0  _Unwind_GetGR (regno=16, context=0x7fffe4f8dc90)
    at /tmp/gcc-8.3.0-r1/work/gcc-8.3.0/libgcc/unwind-dw2.c:250
#1  _Unwind_GetPtr (index=16, context=0x7fffe4f8dc90)
    at /tmp/gcc-8.3.0-r1/work/gcc-8.3.0/libgcc/unwind-dw2.c:261
#2  uw_update_context () at /tmp/gcc-8.3.0-r1/work/gcc-8.3.0/libgcc/unwind-dw2.c:1535
#3  0x00007ffff6966078 in _Unwind_RaiseException (exc=0x7fffd8001dc0)
    at /tmp/gcc-8.3.0-r1/work/gcc-8.3.0/libgcc/unwind.inc:127
#4  0x00007ffff696671d in _Unwind_Resume_or_Rethrow ()
    at /tmp/gcc-8.3.0-r1/work/gcc-8.3.0/libgcc/unwind.inc:264
#5  0x00007ffff6ba9dd9 in __cxxabiv1::__cxa_rethrow ()
    at /tmp/gcc-8.3.0-r1/work/gcc-8.3.0/libstdc++-v3/libsupc++/eh_throw.cc:126
#6  0x0000555555646951 in mtp::usb::Device::Submit (this=0x555555da1590, urb=0x7fffe4f8e240, timeout=30000)
    at /mnt/data/Develop/Progs/android-file-transfer-linux/mtp/backend/linux/usb/Device.cpp:280
#7  0x0000555555646aeb in mtp::usb::Device::WriteBulk (this=0x555555da1590, ep=
    std::shared_ptr<mtp::usb::Endpoint> (use count 2, weak count 0) = {...}, inputStream=
    std::shared_ptr<mtp::IObjectInputStream> (use count 2, weak count 0) = {...}, timeout=30000)
    at /mnt/data/Develop/Progs/android-file-transfer-linux/mtp/backend/linux/usb/Device.cpp:309
#8  0x0000555555638c6f in mtp::usb::BulkPipe::Write (this=0x555555ad7980, 
    inputStream=std::shared_ptr<mtp::IObjectInputStream> (use count 2, weak count 0) = {...}, timeout=30000)
    at /mnt/data/Develop/Progs/android-file-transfer-linux/mtp/usb/BulkPipe.cpp:97
#9  0x000055555562315a in mtp::PipePacketer::Write (this=0x555555ac2950, 
    inputStream=std::shared_ptr<mtp::IObjectInputStream> (use count 2, weak count 0) = {...}, timeout=30000)
    at /mnt/data/Develop/Progs/android-file-transfer-linux/mtp/ptp/PipePacketer.cpp:36
#10 0x00005555556231bd in mtp::PipePacketer::Write (
    this=<error reading variable: Cannot access memory at address 0xfffffffee4f8e378>, 
    data=<error reading variable: Cannot access memory at address 0xfffffffee4f8e370>, 
    timeout=<error reading variable: Cannot access memory at address 0xfffffffee4f8e36c>)
    at /mnt/data/Develop/Progs/android-file-transfer-linux/mtp/ptp/PipePacketer.cpp:39
Backtrace stopped: Cannot access memory at address 0xfffffffee4f8e3c8

compiled with make VERBOSE=1

Thread 1 "android-file-tr" received signal SIGSEGV, Segmentation fault.
0x00005555555c375b in mtp::usb::Device::AsyncReap() ()
(gdb) 
(gdb) bt
#0  0x00005555555c375b in mtp::usb::Device::AsyncReap() ()
#1  0x00005555555c3822 in mtp::usb::Device::Reap(int) ()
#2  0x00005555555c3b5b in mtp::usb::Device::Submit(mtp::usb::Device::Urb*, int) ()
#3  0x00005555555c5775 in mtp::usb::Device::WriteBulk(std::shared_ptr<mtp::usb::Endpoint> const&, std::shared_ptr<mtp::IObjectInputStream> const&, int) ()
#4  0x00005555555bd663 in mtp::usb::BulkPipe::Write(std::shared_ptr<mtp::IObjectInputStream> const&, int) ()
#5  0x00005555555aaec0 in mtp::PipePacketer::Write(std::vector<unsigned char, std::allocator<unsigned char> > const&, int) ()
#6  0x00005555555ae147 in mtp::Session::Send(mtp::OperationRequest const&, int) ()
#7  0x00005555555b6ded in std::vector<unsigned char, std::allocator<unsigned char> > mtp::Session::RunTransactionWithDataRequest<unsigned int&, unsigned int, unsigned int&>(int, mtp::OperationCode, std::shared_ptr<mtp::IObjectInputStream> const&, unsigned int&, unsigned int&&, unsigned int&) ()
#8  0x00005555555b3d27 in mtp::Session::GetObjectHandles(mtp::StorageId, mtp::ObjectFormat, mtp::ObjectId, int) ()
#9  0x000055555559471f in MtpObjectsModel::setParent(mtp::ObjectId) ()
#10 0x0000555555583df4 in MainWindow::onStorageChanged(int) ()
#11 0x000055555559f36b in MainWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) ()
#12 0x00007ffff6f6f13e in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib64/libQt5Core.so.5
#13 0x00007ffff7b8e751 in QComboBox::activated(int) () from /usr/lib64/libQt5Widgets.so.5
#14 0x00007ffff7b907de in ?? () from /usr/lib64/libQt5Widgets.so.5
#15 0x00007ffff7b921aa in ?? () from /usr/lib64/libQt5Widgets.so.5
#16 0x00007ffff7b9820d in ?? () from /usr/lib64/libQt5Widgets.so.5
#17 0x00007ffff6f6f13e in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib64/libQt5Core.so.5
#18 0x00007ffff7b8ea02 in QComboBoxPrivateContainer::itemSelected(QModelIndex const&) () from /usr/lib64/libQt5Widgets.so.5
#19 0x00007ffff7b8efc1 in QComboBoxPrivateContainer::eventFilter(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#20 0x00007ffff6f472ee in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) ()
   from /usr/lib64/libQt5Core.so.5
#21 0x00007ffff7a94551 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#22 0x00007ffff7a9bdbf in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#23 0x00007ffff6f474a2 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib64/libQt5Core.so.5
#24 0x00007ffff7a9b060 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) () from /usr/lib64/libQt5Widgets.so.5
#25 0x00007ffff7aef2f6 in ?? () from /usr/lib64/libQt5Widgets.so.5
#26 0x00007ffff7af18ef in ?? () from /usr/lib64/libQt5Widgets.so.5
#27 0x00007ffff7a94561 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
---Type <return> to continue, or q <return> to quit---
#28 0x00007ffff7a9bb78 in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#29 0x00007ffff6f474a2 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib64/libQt5Core.so.5
#30 0x00007ffff730987c in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) ()
   from /usr/lib64/libQt5Gui.so.5
#31 0x00007ffff730adf5 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) ()
   from /usr/lib64/libQt5Gui.so.5
#32 0x00007ffff72e6c6b in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /usr/lib64/libQt5Gui.so.5
#33 0x00007ffff0ea14ea in ?? () from /usr/lib64/libQt5XcbQpa.so.5
#34 0x00007ffff559449e in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
#35 0x00007ffff5594738 in ?? () from /usr/lib64/libglib-2.0.so.0
#36 0x00007ffff55947cc in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#37 0x00007ffff6f98e53 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /usr/lib64/libQt5Core.so.5
#38 0x00007ffff6f4647b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#39 0x00007ffff6f4e242 in QCoreApplication::exec() () from /usr/lib64/libQt5Core.so.5
#40 0x0000555555581b8e in main ()
yurikoles commented 5 years ago

@RedirectCleaner and build log?

RedirectCleaner commented 5 years ago

http://dpaste.com/0FQ74PD

whoozle commented 5 years ago

crash on start when device fails to response should be fixed in 82127426b3eb94b737d643e6380e5692763a0157

whoozle commented 5 years ago

please test it and close this issue if it worked for you :)

RedirectCleaner commented 5 years ago

when i try to copy the file "foo:test.png" to my fat32 sdcard, i still get (with : https://github.com/whoozle/android-file-transfer-linux/commit/803f53f2f79042112e331fc52ab47fc413102728)

files dropped:  ("/tmp/foo:test.png")
uploadFiles  ("/tmp/foo:test.png")
uploading 31212 bytes
uploading file  "/tmp/foo:test.png" , parent:  "/tmp"
adding first parent path
directories[0]:  "/tmp"  ->  4294967295
uploadFile  "foo:test.png"  as  "foo:test.png"
sending  31212  bytes
new object id:  35205 , sending...
30029 ms since the last poll call
failed to send new object info  "timeout reaping usb urb"
finishing queue
got unknown urb: 0x7fffe58a0370
30030 ms since the last poll call

Thread 4 "QThread" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe58a1700 (LWP 21141)]
_Unwind_GetGR (regno=16, context=0x7fffe589fcb0)
    at /tmp/gcc-8.3.0-r1/work/gcc-8.3.0/libgcc/unwind-dw2.c:250
250     /tmp/gcc-8.3.0-r1/work/gcc-8.3.0/libgcc/unwind-dw2.c: No such file or directory.
(gdb) bt
#0  _Unwind_GetGR (regno=16, context=0x7fffe589fcb0)
    at /tmp/gcc-8.3.0-r1/work/gcc-8.3.0/libgcc/unwind-dw2.c:250
#1  _Unwind_GetPtr (index=16, context=0x7fffe589fcb0)
    at /tmp/gcc-8.3.0-r1/work/gcc-8.3.0/libgcc/unwind-dw2.c:261
#2  uw_update_context () at /tmp/gcc-8.3.0-r1/work/gcc-8.3.0/libgcc/unwind-dw2.c:1535
#3  0x00007ffff69a6078 in _Unwind_RaiseException (exc=0x7fffd8001dc0)
    at /tmp/gcc-8.3.0-r1/work/gcc-8.3.0/libgcc/unwind.inc:127
#4  0x00007ffff69a671d in _Unwind_Resume_or_Rethrow ()
    at /tmp/gcc-8.3.0-r1/work/gcc-8.3.0/libgcc/unwind.inc:264
#5  0x00007ffff6babdd9 in __cxxabiv1::__cxa_rethrow ()
    at /tmp/gcc-8.3.0-r1/work/gcc-8.3.0/libstdc++-v3/libsupc++/eh_throw.cc:126
#6  0x0000555555646ff7 in mtp::usb::Device::Submit (this=0x555555b030c0, urb=0x7fffe58a0260, timeout=30000)
    at /mnt/data/Develop/Progs/android-file-transfer-linux/mtp/backend/linux/usb/Device.cpp:283
#7  0x0000555555647191 in mtp::usb::Device::WriteBulk (this=0x555555b030c0, ep=
    std::shared_ptr<mtp::usb::Endpoint> (use count 2, weak count 0) = {...}, inputStream=
    std::shared_ptr<mtp::IObjectInputStream> (use count 2, weak count 0) = {...}, timeout=30000)
    at /mnt/data/Develop/Progs/android-file-transfer-linux/mtp/backend/linux/usb/Device.cpp:312
#8  0x0000555555639305 in mtp::usb::BulkPipe::Write (this=0x555555cedb60, 
    inputStream=std::shared_ptr<mtp::IObjectInputStream> (use count 2, weak count 0) = {...}, timeout=30000)
    at /mnt/data/Develop/Progs/android-file-transfer-linux/mtp/usb/BulkPipe.cpp:97
#9  0x00005555556237f0 in mtp::PipePacketer::Write (this=0x555555ac23c0, 
    inputStream=std::shared_ptr<mtp::IObjectInputStream> (use count 2, weak count 0) = {...}, timeout=30000)
    at /mnt/data/Develop/Progs/android-file-transfer-linux/mtp/ptp/PipePacketer.cpp:36
#10 0x0000555555623853 in mtp::PipePacketer::Write (
    this=<error reading variable: Cannot access memory at address 0xfffffffee58a0398>, 
    data=<error reading variable: Cannot access memory at address 0xfffffffee58a0390>, 
    timeout=<error reading variable: Cannot access memory at address 0xfffffffee58a038c>)
    at /mnt/data/Develop/Progs/android-file-transfer-linux/mtp/ptp/PipePacketer.cpp:39
Backtrace stopped: Cannot access memory at address 0xfffffffee58a03e8