https://bugs.kde.org/show_bug.cgi?id=488859

            Bug ID: 488859
           Summary: startProcess() can generate service names that are too
                    long
    Classification: Frameworks and Libraries
           Product: frameworks-kio
           Version: 6.3.0
          Platform: openSUSE
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: kio-bugs-n...@kde.org
          Reporter: kde.dorsal...@passinbox.com
                CC: kdelibs-b...@kde.org
  Target Milestone: ---

SUMMARY
SystemdProcessRunner::startProcess() and ScopedProcessRunner::startProcess()
are generating service names including the whole escaped file name.
Systemd returns "Invalid unit name or type." when the service/unit name is
longer than 255 bytes.
This can be problematic with multi-byte characters.

With the leading "app-" and trailing "@<uuid>.service" taking 45 bytes, 210
bytes are left for the escaped file name.
For example, most CJK characters are 3 bytes long when encoded in UTF-8. These
become 12 bytes in the service name  (currently it's 15 bytes because of Bug
488854).
A file name with 18 3-byte characters or more will get the  "Invalid unit name
or type." error.

Is it necessary to include the whole file name? There is already the uuid part.
If it's necessary, tell the user to use a shorter file name can be helpful.

STEPS TO REPRODUCE
Execute a .desktop file with a moderately long file name, for example
"そこまで長いというわけでもないファイル名.desktop"

OBSERVED RESULT
The following error can be seen by journalctl -e
kf.kio.gui: Failed to launch process as service:
"app-\\x-1d\\x-7f\\x-63\\x-1d\\x-7f\\x-6d\\x-1d\\x-7f\\x-42\\x-1d\\x-7f\\x-59\\x-17\\x-6b\\x-49\\x-1d\\x-7f\\x-7c\\x-1d\\x-7f\\x-58\\x-1d\\x-7f\\x-7c\\x-1d\\x-7f\\x-7a\\x-1d\\x-7e\\x-71\\x-1d\\x-7f\\x-6f\\x-1d\\x-7f\\x-59\\x-1d\\x-7e\\x-7e\\x-1d\\x-7f\\x-56\\x-1d\\x-7f\\x-7c\\x-1d\\x-7d\\x-6b\\x-1d\\x-7e\\x-5f\\x-1d\\x-7e\\x-5c\\x-1d\\x-7d\\x-55\\x-1b\\x-70\\x-73@19241a262b06459c90ecaf538b57c701.service"
"org.freedesktop.DBus.Error.InvalidArgs" "Invalid unit name or type."

EXPECTED RESULT
Run the application without error.

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20240618
KDE Plasma Version: 6.0.5
KDE Frameworks Version: 6.3.0
Qt Version: 6.7.1

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to