Usage of Admin Protocol with custom commands in 'Open with...'
Summary: Thunar fails to properly utilize the "%f" flag when operating within the admin protocol ("admin://"). The issue arises when attempting to open a file with a custom command in 'Open with other application...' using the format "application %f". This results in the evaluation of %f as an empty string ("") when in Thunar using admin protocol, likely due to the execution being performed as a non-root user (with environment variables set to the non-root user who initiated Thunar). Consequently, the application cannot identify the file path from a non-root perspective, leading to functionality issues.
Steps to Reproduce:
- Open Thunar with admin protocol ("admin://").
- Attempt to open a root-only file with a custom command / script, for example logging the output of %f to a file
- Inspect the result
Expected Behavior: The application should open the specified file with the provided custom command within the admin protocol, evaluating the file path correctly.
Actual Behavior: Thunar evaluates the "%f" flag as an empty string ("") while using the admin protocol, preventing the application from recognizing the file path, likely due to execution as a non-root user.
Additional Information: When attempting a similar procedure in Dolphin with kio-admin, the behavior differs. Dolphin copies the file to a temporary directory in the user's home, opens it with the specified application, and then, if modified, copies it back to a root-only directory, prompting for permissions. Finally, it overwrites the content of the file while preserving the original file permissions.
Fix suggestions: Modify Thunar to utilize the admin mode to collect the path and file info of the accessed file that is reachable only through the admin protocol, so that it can be correctly accessed with "%f" flag (and others). Also, mimicking the behavior already implemented in dolphin with kio-admin would also be a good - maybe even better - solution.
Environment Details:
- Thunar version: 4.18.10
- Operating System: ArchLinux, kernel version: 6.6.10-arch1-1
- DE: KDE Plasma 5.27.10
- (Dolphin version: 23.08.4, kio-admin version: 23.08.4-1)