Qt for HarmonyOS/platform limitations: Difference between revisions
HarmonyOS Platform Limitations |
m draft |
||
| Line 14: | Line 14: | ||
The HarmonyOS security model does not permit <code>chmod()</code> or <code>fchmod()</code> | The HarmonyOS security model does not permit <code>chmod()</code> or <code>fchmod()</code> | ||
on existing files. As a result, <code>QFile::setPermissions()</code> is not supported | on existing files. As a result, <code>QFile::setPermissions()</code> is not supported | ||
on HarmonyOS for existing files and always returns <code>false</code> | on HarmonyOS for existing files and always returns <code>false</code> | ||
Note that operations that set permissions on a freshly created file descriptor | Note that operations that set permissions on a freshly created file descriptor | ||
| Line 21: | Line 22: | ||
Huawei's official response: | Huawei's official response: | ||
<blockquote>Due to security concerns, the system review for this interface was cancelled, | <blockquote>Due to security concerns, the system review for this interface was cancelled, and there is no alternative interface.</blockquote> | ||
and there is no alternative interface.</blockquote> | |||
'''Status:''' Confirmed by Huawei.<br> | '''Status:''' Confirmed by Huawei.<br> | ||
'''Impact:''' <code>QFile::setPermissions()</code> is a no-op on HarmonyOS for existing | '''Impact:''' <code>QFile::setPermissions()</code> is a no-op on HarmonyOS for existing files. | ||
files. | |||
'''Reference:''' [https://bugreports.qt.io/browse/QTBUG-146619 QTBUG-146619] | '''Reference:''' [https://bugreports.qt.io/browse/QTBUG-146619 QTBUG-146619] | ||
=== symlink() not available for third-party applications === | === symlink() not available for third-party applications === | ||
<code>::symlink()</code> and its ArkTS equivalent <code>fs.symlink</code> are unavailable | <code>::symlink()</code> and its ArkTS equivalent <code>fs.symlink</code> are unavailable to third-party applications on HarmonyOS. <code>QFile::link()</code> and any functionality depending on symbolic links will fail with <code>EACCES</code> | ||
to third-party applications on HarmonyOS. <code>QFile::link()</code> and any | |||
functionality depending on symbolic links will fail with <code>EACCES</code> | |||
(error code 13900012). | (error code 13900012). | ||
Huawei's official response: | Huawei's official response: | ||
<blockquote>fs.symlink is currently not available for third-party applications. | <blockquote>fs.symlink is currently not available for third-party applications. The official documentation will be updated accordingly.</blockquote> | ||
The official documentation will be updated accordingly.</blockquote> | |||
'''Status:''' Confirmed by Huawei.<br> | '''Status:''' Confirmed by Huawei.<br>'''Workaround:''' None available at this time.<br>'''Reference:''' [https://bugreports.qt.io/browse/QTBUG-146621 QTBUG-146621] | ||
'''Workaround:''' None available at this time.<br> | |||
'''Reference:''' [https://bugreports.qt.io/browse/QTBUG-146621 QTBUG-146621] | |||
=== stat() returns EACCES on system paths === | === stat() returns EACCES on system paths === | ||
| Line 48: | Line 42: | ||
to return <code>false</code> for system executables, while | to return <code>false</code> for system executables, while | ||
<code>QFileInfo::exists()</code> and <code>QFileInfo::isExecutable()</code> | <code>QFileInfo::exists()</code> and <code>QFileInfo::isExecutable()</code> | ||
(which use <code>access()</code> internally) return <code>true</code>. | (which use <code>access()</code> internally) return <code>true</code>As a consequence, <code>QStandardPaths::findExecutable()</code> cannot locate system executables on HarmonyOS. | ||
'''Status:''' Under verification with Huawei.<br>'''Reference:''' [https://bugreports.qt.io/browse/QTBUG-146625 QTBUG-146625] | |||
'''Status:''' Under verification with Huawei.<br> | |||
'''Reference:''' [https://bugreports.qt.io/browse/QTBUG-146625 QTBUG-146625] | |||
=== open() with trailing slashes does not fail as expected === | === open() with trailing slashes does not fail as expected === | ||
On Linux, <code>open("qwe//", O_RDWR|O_CREAT|O_CLOEXEC, 0666)</code> fails with | On Linux, <code>open("qwe//", O_RDWR|O_CREAT|O_CLOEXEC, 0666)</code> fails with | ||
<code>EISDIR</code> because trailing slashes imply a directory path. On HarmonyOS, | <code>EISDIR</code> because trailing slashes imply a directory path. On HarmonyOS, the trailing slashes are silently stripped and a regular file named <code>qwe</code> | ||
the trailing slashes are silently stripped and a regular file named <code>qwe</code> | |||
is created instead. This behavior differs from POSIX expectations. | is created instead. This behavior differs from POSIX expectations. | ||
'''Status:''' Not yet confirmed by Huawei.<br> | '''Status:''' Not yet confirmed by Huawei.<br>'''Reference:''' [https://bugreports.qt.io/browse/QTBUG-146578 QTBUG-146578] | ||
'''Reference:''' [https://bugreports.qt.io/browse/QTBUG-146578 QTBUG-146578] | |||
=== fread() incorrectly sets EOF on a non-blocking pipe === | === fread() incorrectly sets EOF on a non-blocking pipe === | ||
When <code>fread()</code> is called on a non-blocking pipe file descriptor with no | When <code>fread()</code> is called on a non-blocking pipe file descriptor with no data available, the HarmonyOS libc incorrectly sets the <code>EOF</code> flag on the <code>FILE*</code> stream. | ||
data available, the HarmonyOS libc incorrectly sets the <code>EOF</code> flag on | |||
the <code>FILE*</code> stream. | |||
'''Status:''' Not yet confirmed by Huawei.<br> | '''Status:''' Not yet confirmed by Huawei.<br>'''Reference:''' [https://bugreports.qt.io/browse/QTBUG-146579 QTBUG-146579] | ||
'''Reference:''' [https://bugreports.qt.io/browse/QTBUG-146579 QTBUG-146579] | |||
== Dynamic Linking == | == Dynamic Linking == | ||
=== MUSL-LDSO cannot load section-header-stripped ELF files === | === MUSL-LDSO cannot load section-header-stripped ELF files === | ||
The HarmonyOS MUSL dynamic linker fails to load ELF shared libraries from which | The HarmonyOS MUSL dynamic linker fails to load ELF shared libraries from which the section header table has been stripped. The linker internally depends on | ||
the section header table has been stripped. The linker internally depends on | |||
<code>e_shnum</code> and <code>e_shoff</code> fields within the | <code>e_shnum</code> and <code>e_shoff</code> fields within the | ||
<code>LOAD_ORDER_RANDOMIZATION</code> macro and cannot process binaries that omit | <code>LOAD_ORDER_RANDOMIZATION</code> macro and cannot process binaries that omit the section header. | ||
the section header. | |||
Huawei's analysis: | Huawei's analysis: | ||
<blockquote>Whether these dependencies can be eliminated in the future | <blockquote>Whether these dependencies can be eliminated in the future is still under investigation.</blockquote> | ||
is still under investigation.</blockquote> | |||
'''Status:''' Acknowledged by Huawei. Fix timeline unknown.<br> | '''Status:''' Acknowledged by Huawei. Fix timeline unknown.<br>'''Reference:''' [https://bugreports.qt.io/browse/QTBUG-146620 QTBUG-146620] | ||
'''Reference:''' [https://bugreports.qt.io/browse/QTBUG-146620 QTBUG-146620] | |||
=== MUSL-LDSO namespace policy prevents dlopen() from writable paths === | === MUSL-LDSO namespace policy prevents dlopen() from writable paths === | ||
The HarmonyOS MUSL dynamic linker rejects <code>dlopen()</code> for any path under | The HarmonyOS MUSL dynamic linker rejects <code>dlopen()</code> for any path under | ||
<code>/data/storage/el2/</code>, including temporary directories and all paths | <code>/data/storage/el2/</code>, including temporary directories and all paths returned by <code>QStandardPaths::writableLocation()</code> | ||
returned by <code>QStandardPaths::writableLocation()</code> | |||
(<code>AppDataLocation</code>, <code>AppConfigLocation</code>, <code>CacheLocation</code>). | (<code>AppDataLocation</code>, <code>AppConfigLocation</code>, <code>CacheLocation</code>). | ||
All available namespaces (<code>moduleNs_default</code>, <code>default</code>, | All available namespaces (<code>moduleNs_default</code>, <code>default</code>, | ||
| Line 100: | Line 80: | ||
<code>/data/storage/el1/</code>, which is read-only at runtime. | <code>/data/storage/el1/</code>, which is read-only at runtime. | ||
'''Status:''' Not yet confirmed by Huawei.<br> | '''Status:''' Not yet confirmed by Huawei.<br>'''Reference:''' [https://bugreports.qt.io/browse/QTBUG-146624 QTBUG-146624] | ||
'''Reference:''' [https://bugreports.qt.io/browse/QTBUG-146624 QTBUG-146624] | |||
== Standard Paths == | == Standard Paths == | ||
| Line 119: | Line 98: | ||
due to the <code>stat()</code> restriction described above. | due to the <code>stat()</code> restriction described above. | ||
'''Status:''' Under verification with Huawei.<br> | '''Status:''' Under verification with Huawei.<br>'''Reference:''' [https://bugreports.qt.io/browse/QTBUG-146625 QTBUG-146625] | ||
'''Reference:''' [https://bugreports.qt.io/browse/QTBUG-146625 QTBUG-146625] | |||
=== Application resource directory location === | === Application resource directory location === | ||
On HarmonyOS, an application's bundled read-only resource directory resides at | On HarmonyOS, an application's bundled read-only resource directory resides at | ||
<code><bundleCodeDir>/entry/resources/resfile</code>. This is the appropriate | <code><bundleCodeDir>/entry/resources/resfile</code>. This is the appropriate | ||
location for bundled resources such as <code>.rcc</code> files. | location for bundled resources such as <code>.rcc</code> files. No <code>QStandardPaths::StandardLocation</code> currently maps to this path. | ||
'''Status:''' Under investigation.<br>'''Reference:''' [https://bugreports.qt.io/browse/QTBUG-146626 QTBUG-146626] | |||
'''Status:''' Under investigation.<br> | |||
'''Reference:''' [https://bugreports.qt.io/browse/QTBUG-146626 QTBUG-146626] | |||
== Font System == | == Font System == | ||
| Line 136: | Line 111: | ||
=== No fixed-pitch (monospaced) font provided by default === | === No fixed-pitch (monospaced) font provided by default === | ||
HarmonyOS does not ship a monospaced (fixed-pitch) system font by default. | HarmonyOS does not ship a monospaced (fixed-pitch) system font by default. | ||
<code>QFontDatabase::systemFont(QFontDatabase::FixedFont)</code> returns a | <code>QFontDatabase::systemFont(QFontDatabase::FixedFont)</code> returns a non-monospaced font as a result. | ||
non-monospaced font as a result. | |||
Huawei confirmed that <code>NotoSansMono</code> must be installed by the user | Huawei confirmed that <code>NotoSansMono</code> must be installed by the user and is not included in the system font set. | ||
and is not included in the system font set. | |||
'''Status:''' Confirmed by Huawei.<br> | '''Status:''' Confirmed by Huawei.<br>'''Impact:''' Applications requiring a monospaced font must bundle and register one | ||
'''Impact:''' Applications requiring a monospaced font must bundle and register one | explicitly via <code>QFontDatabase::addApplicationFont()</code>'''Reference:''' [https://bugreports.qt.io/browse/QTBUG-146623 QTBUG-146623] | ||
explicitly via <code>QFontDatabase::addApplicationFont()</code> | |||
'''Reference:''' [https://bugreports.qt.io/browse/QTBUG-146623 QTBUG-146623] | |||
== ArkUI / ArkTS API == | == ArkUI / ArkTS API == | ||
=== XComponentType.NODE deprecated in API version 20 === | === XComponentType.NODE deprecated in API version 20 === | ||
<code>XComponentType.NODE</code> | <code>XComponentType.NODE</code>which Qt for HarmonyOS uses as the native rendering surface, has been deprecated since HarmonyOS API version 20. Huawei recommends | ||
surface, has been deprecated since HarmonyOS API version 20. Huawei recommends | |||
migrating to the <code>ContentSlot</code> component. | migrating to the <code>ContentSlot</code> component. | ||
| Line 161: | Line 133: | ||
'''Impact:''' <code>XComponentType.NODE</code> remains functional in current API | '''Impact:''' <code>XComponentType.NODE</code> remains functional in current API | ||
versions. Migration to <code>ContentSlot</code> is required before the deprecated | versions. Migration to <code>ContentSlot</code> is required before the deprecated | ||
API is removed.<br> | API is removed.<br>'''Reference:''' [https://bugreports.qt.io/browse/QTBUG-146622 QTBUG-146622] | ||
'''Reference:''' [https://bugreports.qt.io/browse/QTBUG-146622 QTBUG-146622] | |||
== See Also == | == See Also == | ||
Revision as of 08:05, 7 May 2026
This page documents known platform limitations of HarmonyOS that affect Qt behavior. These limitations stem from HarmonyOS security policies, missing system features, or deprecated APIs. Each entry includes its confirmation status and a reference to the corresponding public bug report.
Some items below are still under verification with Huawei and may be refined as more information becomes available.
File System & Permissions
chmod() / QFile::setPermissions() not supported
The HarmonyOS security model does not permit
chmod()or
fchmod()on existing files. As a result,
QFile::setPermissions()is not supported on HarmonyOS for existing files and always returns
false
Note that operations that set permissions on a freshly created file descriptor
— for example
QFile::copy(), which uses
fchmod()internally
on the newly created destination — are unaffected.
Huawei's official response:
Due to security concerns, the system review for this interface was cancelled, and there is no alternative interface.
Status: Confirmed by Huawei.
Impact:
QFile::setPermissions()is a no-op on HarmonyOS for existing files.
Reference: QTBUG-146619
symlink() not available for third-party applications
::symlink()and its ArkTS equivalent
fs.symlinkare unavailable to third-party applications on HarmonyOS.
QFile::link()and any functionality depending on symbolic links will fail with
EACCES(error code 13900012).
Huawei's official response:
fs.symlink is currently not available for third-party applications. The official documentation will be updated accordingly.
Status: Confirmed by Huawei.
Workaround: None available at this time.
Reference: QTBUG-146621
stat() returns EACCES on system paths
stat()returns
EACCES(errno 13) when called on system paths such as
/bin/shon HarmonyOS. This causes
QFileInfo::isFile()to return
falsefor system executables, while
QFileInfo::exists()and
QFileInfo::isExecutable()(which use
access()internally) return
true
As a consequence,
QStandardPaths::findExecutable()cannot locate system executables on HarmonyOS.
Status: Under verification with Huawei.
Reference: QTBUG-146625
open() with trailing slashes does not fail as expected
On Linux,
open("qwe//", O_RDWR|O_CREAT|O_CLOEXEC, 0666)fails with
EISDIRbecause trailing slashes imply a directory path. On HarmonyOS, the trailing slashes are silently stripped and a regular file named
qweis created instead. This behavior differs from POSIX expectations.
Status: Not yet confirmed by Huawei.
Reference: QTBUG-146578
fread() incorrectly sets EOF on a non-blocking pipe
When
fread()is called on a non-blocking pipe file descriptor with no data available, the HarmonyOS libc incorrectly sets the
EOFflag on the
FILE*stream.
Status: Not yet confirmed by Huawei.
Reference: QTBUG-146579
Dynamic Linking
MUSL-LDSO cannot load section-header-stripped ELF files
The HarmonyOS MUSL dynamic linker fails to load ELF shared libraries from which the section header table has been stripped. The linker internally depends on
e_shnumand
e_shofffields within the
LOAD_ORDER_RANDOMIZATIONmacro and cannot process binaries that omit the section header.
Huawei's analysis:
Whether these dependencies can be eliminated in the future is still under investigation.
Status: Acknowledged by Huawei. Fix timeline unknown.
Reference: QTBUG-146620
MUSL-LDSO namespace policy prevents dlopen() from writable paths
The HarmonyOS MUSL dynamic linker rejects
dlopen()for any path under
/data/storage/el2/, including temporary directories and all paths returned by
QStandardPaths::writableLocation()(
AppDataLocation,
AppConfigLocation,
CacheLocation). All available namespaces (
moduleNs_default,
default,
ndk) reject these paths with
errno=22 (EINVAL). The only paths accessible to
dlopen()reside under
/data/storage/el1/, which is read-only at runtime.
Status: Not yet confirmed by Huawei.
Reference: QTBUG-146624
Standard Paths
QStandardPaths constraints on HarmonyOS
The HarmonyOS application sandbox imposes several constraints on
QStandardPaths:
- and
standardLocations()
return identicalwritableLocation()
single-path results for all location types, since the sandbox does not expose multiple search locations.
- maps to HarmonyOS
AppLocalDataLocation
.preferencesDir
- The following location types are unsupported and return an empty path:
PublicShareLocation,
TemplatesLocation,
StateLocation,
GenericStateLocation.
- cannot locate system executables
QStandardPaths::findExecutable()
due to the
stat()restriction described above.
Status: Under verification with Huawei.
Reference: QTBUG-146625
Application resource directory location
On HarmonyOS, an application's bundled read-only resource directory resides at
<bundleCodeDir>/entry/resources/resfile. This is the appropriate location for bundled resources such as
.rccfiles. No
QStandardPaths::StandardLocationcurrently maps to this path.
Status: Under investigation.
Reference: QTBUG-146626
Font System
No fixed-pitch (monospaced) font provided by default
HarmonyOS does not ship a monospaced (fixed-pitch) system font by default.
QFontDatabase::systemFont(QFontDatabase::FixedFont)returns a non-monospaced font as a result.
Huawei confirmed that
NotoSansMonomust be installed by the user and is not included in the system font set.
Status: Confirmed by Huawei.
Impact: Applications requiring a monospaced font must bundle and register one
explicitly via
QFontDatabase::addApplicationFont()Reference: QTBUG-146623
ArkUI / ArkTS API
XComponentType.NODE deprecated in API version 20
XComponentType.NODEwhich Qt for HarmonyOS uses as the native rendering surface, has been deprecated since HarmonyOS API version 20. Huawei recommends migrating to the
ContentSlotcomponent.
No official porting guide has been provided by Huawei. Relevant documentation:
Status: API deprecated by Huawei.
Impact:
XComponentType.NODEremains functional in current API versions. Migration to
ContentSlotis required before the deprecated
API is removed.
Reference: QTBUG-146622