Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-64103

[regression] QFile::rename fails on Android

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.10.0 RC2, 5.10.0 Beta 2, 5.10.0 Beta 3, 5.10.0 Beta 4, 5.10.0 RC
    • Fix Version/s: 5.10.1
    • Component/s: Core: I/O
    • Labels:
      None
    • Environment:
      Qt 5.10 on Windows, Android NDK r10e

      deployment targets: Android ARMv7 device (Android 6.0), Android emulator (from package system-images;android-23;default;x86)
    • Platform/s:
      Android
    • Commits:
      138d34b9c8aa368dd252d0c46393816c7e372837

      Description

      QFile::copy don't copies file and returns false, when i'm trying to copy file from resources (rcc) to app data directory with Qt 5.10. Same code build with Qt 5.9.2/5.9.3 kits works fine

      #include <QCoreApplication>
      #include <QFile>
      #include <QStandardPaths>
      #include <QFile>
      #include <QDebug>
      
      int main(int argc, char *argv[])
      {
      	QCoreApplication a(argc, argv);
      	QFile sourceFile(":/info.txt");
      	qDebug() << "is source exists:" << sourceFile.exists();
      	QString destinationPath = QStandardPaths::writableLocation(QStandardPaths::DataLocation)+"/info.txt";
      //	QString destinationPath = QStandardPaths::standardLocations(QStandardPaths::DataLocation).first()+"/filecopy.txt";
      	bool result = sourceFile.copy(destinationPath);
      	qDebug() << "copying" << sourceFile.fileName() << "to" << destinationPath << ":" << result << sourceFile.errorString();
      	return a.exec();
      }
      

       
      output:

      I Qt : qt start
      W linker : /data/app/org.qtproject.example.test_console-1/lib/arm/libtest-console.so: unused DT entry: type 0x1d arg 0x794
      D OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
      I Adreno-EGL: <qeglDrvAPI_eglInitialize:379>: QUALCOMM Build: 10/21/15, 369a2ea, I96aee987eb
      I OpenGLRenderer: Initialized EGL, version 1.4
      D libtest-console.so: ..\test-console\main.cpp:47 (int main(int, char**)): is source exists: true
      D libtest-console.so: ..\test-console\main.cpp:51 (int main(int, char**)): copying ":/info.txt" to "/data/user/0/org.qtproject.example.test_console/files/info.txt" : false "Cannot create /data/user/0/org.qtproject.example.test_console/files/info.txt for output"

       

      second example

      #include <QApplication>
      #include <QPushButton>
      #include <QFile>
      #include <QStandardPaths>
      #include <QDebug>
      
      int main(int argc, char *argv[])
      {
      	QApplication a(argc, argv);
      	QPushButton button("Click to copy");
      	button.show();
      	QFile sourceFile(":/info.txt");
      	qDebug() << "is source exists:" << sourceFile.exists();
      	QString destinationPath = QStandardPaths::writableLocation(QStandardPaths::DataLocation)+"/info.txt";
      	//	QString destinationPath = QStandardPaths::standardLocations(QStandardPaths::DataLocation).first()+"/info.txt";
      	QObject::connect(&button, &QPushButton::clicked, [&sourceFile, &destinationPath] {
      		bool result = sourceFile.copy(destinationPath);
      		qDebug() << "copying" << sourceFile.fileName() << "to" << destinationPath << ":" << result << sourceFile.errorString();
      	});
      	return a.exec();
      }
      

       

        Attachments

        1. copy.asm
          6 kB
        2. strace_output.txt
          4.63 MB
        3. strace-copy_only.txt
          14 kB

          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Activity

              People

              • Assignee:
                thiago Thiago Macieira
                Reporter:
                morte Maxim Bescherevnykh
              • Votes:
                3 Vote for this issue
                Watchers:
                15 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes