Bug 1813727

Summary: Files copied from NFS4 to Desktop can't be opened
Product: Red Hat Enterprise Linux 8 Reporter: Ricardo Duarte <ricardoteixeiraduarte>
Component: gnome-shell-extensionsAssignee: Florian Müllner <fmuellner>
Status: CLOSED ERRATA QA Contact: Martin Krajnak <mkrajnak>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 8.1CC: fmuellner, jadahl, mclasen, oholy, tpelka
Target Milestone: rcKeywords: Triaged
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: gnome-shell-extensions-3.32.1-16.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-09 19:33:50 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ricardo Duarte 2020-03-15 20:59:02 UTC
Description of problem:
Files copied from nfsv4 shares do not open, when copied to the desktop

Version-Release number of selected component (if applicable):

Gnome 3.32.2

How reproducible:
Always

Steps to Reproduce:
- An NFS4 folder mounted anywhere in the system
- Copy a file from nfs4 to gnome (classic) desktop
- When I try to open the file by double-click at the desktop, nothing seems to happen. A strange file named "from" is created at the home folder.
- Righ Clicking  and selecting "Open With" does work.

Comment 1 Ricardo Duarte 2020-03-15 21:01:39 UTC
If I copy the same file from CIFS, it opens fine.
I inspected all the file permissions and md5 and the files (copied from cifs; copied from nfsv4) are exactly the same.
But the one copied from nfsv4 will not open.
The only thing I see, error wise, is some fs-cache messages at the text console.
No fscache, fsc or cachefiles are in use.

Comment 2 Ricardo Duarte 2020-03-15 21:18:16 UTC
The home folder itself is stored on a local ext4 disk.
Rebooting the server does not fix the issue. User is still unable to access the files by double click on the desktop.
Happens with selinux enabled or disabled.
Same setup works fine on RHEL 7.7.

A small difference between the files can be seen by right click > properties > permissions. The file from NFSv4 has a "-" at "Allow executing file as program". 
But cleaning the check box does not fix the issue.

Comment 3 Ricardo Duarte 2020-03-15 21:23:41 UTC
Also see sometimes a "Execution of command full_path_to_the_file_at_desktop", "command not found notification".

Comment 5 Matthias Clasen 2020-10-06 20:28:34 UTC
This is misfiled against gnome-desktop3. I'll assume that you copied the file in nautilus, and move the bug there.

Comment 6 Ondrej Holy 2020-10-07 06:27:32 UTC
The files on your server are probably marked as executable for some reason. NFS is aware of UNIX permissions, thus the copied files are also marked as executable. CIFS doesn't have enabled UNIX Extensions by default, thus the exectuable permissions are not copied. Consequenlty, the desktop-icons extensions tries to execute the file instead of opening: https://gitlab.gnome.org/World/ShellExtensions/desktop-icons/-/issues/144, which is fixed by  https://gitlab.gnome.org/World/ShellExtensions/desktop-icons/-/merge_requests/147. So changing component to gnome-shell-extensions as it would be probably nice to backport the mentioned fix, however, the root of the problem seems to be simply the wrong permissions...

Comment 8 Martin Krajnak 2021-06-02 11:38:47 UTC
gnome-shell-extension-desktop-icons-3.32.1-18.el8.noarch

Reproducer:
1. Login to gnome-classic, mount nfs4 storage
2. copy text file to ~/Desktop from the nfs storage via terminal
3. open nautilus, navigate to nfs4 share, copy a .png image to ~/Desktop folder

Result:
 Both files have desktop icons and can be opened in gedit/eog by clicking on their icons.

However after reading Comment 6, I tried the same reproducer but before copying files I marked them as executable:
 - the .png file was opened in eog as expected
 - nothing happens after clicking on .txt file

I understand that based on permissions the extension tries to execute the file but I just want to be sure before I verify this,
so is this expected ?

Comment 9 Florian Müllner 2021-06-02 16:59:44 UTC
(In reply to Martin Krajnak from comment #8)
> gnome-shell-extension-desktop-icons-3.32.1-18.el8.noarch
> 
> However after reading Comment 6, I tried the same reproducer but before
> copying files I marked them as executable:
>  - the .png file was opened in eog as expected
>  - nothing happens after clicking on .txt file
> 
> I understand that based on permissions the extension tries to execute the
> file

That was the case before the fix.

With the fix, the extension *also* checks whether the content type (based on the file extension) can be executable. That's why the image now opens as expected, but unfortunately text files *may* be executable (as documented in https://gitlab.gnome.org/GNOME/glib/-/blob/master/gio/gcontenttype.c#L648).

I could add another special-case to not execute executable files of type "text/plain", but that would mean that scripts without .sh suffix aren't executed anymore.

I suspect that that's a more common case than a wrongly set executable bit, so I'm a bit wary of diverging from upstream here.

Comment 14 errata-xmlrpc 2021-11-09 19:33:50 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: GNOME security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2021:4381