Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential regression in the document portal #1234

Open
sonnyp opened this issue Dec 4, 2023 · 10 comments
Open

Potential regression in the document portal #1234

sonnyp opened this issue Dec 4, 2023 · 10 comments
Assignees
Labels
bug portal: documents Issues with the documents portal

Comments

@sonnyp
Copy link

sonnyp commented Dec 4, 2023

Operating System

Fedora

XDG Desktop Portal version

1.18

XDG Desktop Portal version (Other)

1.18.2

Desktop Environment

GNOME

Desktop Environment (Other)

No response

Expected Behavior

rust works fine in the document portal

Current Behavior

rustc throws fs related errors such as

error: couldn't get the current directory of the process

Caused by:
  No such file or directory (os error 2)

or

error: Current directory is invalid: No such file or directory (os error 2)

error: could not compile `demo` (lib) due to previous error

Steps to Reproduce

  1. Install Workbench
  2. Open the Library
  3. Select the "Welcome" entry in Rust
  4. Make a change to a string or something
  5. Close window, it will prompt to save the project, do so
  6. In Workbench menu, open the project with "Open Project"
  7. Press Run

If you reproduce the issue, it will happen until reboot.
A reboot might solve it

Anything else we should know?

Reproducible with: 1.18.2
Not reproducible with 1.18.0

@Mikenux
Copy link

Mikenux commented Dec 4, 2023

I installed Workbench (via Software) and launched it, but had to install the Rust extensions. I installed the extensions, then closed Workbench, restarted it, and no reproduction. I uninstalled by deleting data (via Software), except Rust extensions. I reinstalled it and no reproduction.

@hfiguiere hfiguiere moved this from Todo to In Progress in @hfiguiere's xdg-portal Dec 5, 2023
@hfiguiere
Copy link
Collaborator

I can't reproduce with these steps.

I run xdg-document-portal 1.18.2 from Fedora.

@hfiguiere
Copy link
Collaborator

Above I saved the project.

When I re-open it and press "Run" I can reproduce.

@hfiguiere
Copy link
Collaborator

The error:

  Downloaded 166 crates (10.5 MB) in 1.79s (largest was `linux-raw-sys` at 1013.8 KB)
   Compiling demo v1.0.0 (/run/flatpak/doc/265c72bf/TestWorkbenchRust)
error: Current directory is invalid: No such file or directory (os error 2)

error: could not compile `demo` (lib) due to previous error

@Mikenux
Copy link

Mikenux commented Dec 5, 2023

I can also reproduce by saving the project. Notice that the path to the folder is /run/flatpak/doc/... which does not exist, while the same path (after the /doc) exists in /run/user/1000/doc.

@sonnyp
Copy link
Author

sonnyp commented Dec 5, 2023

@Mikenux

I can also reproduce by saving the project. Notice that the path to the folder is /run/flatpak/doc/... which does not exist, while the same path (after the /doc) exists in /run/user/1000/doc.

/run/flatpak/doc is the document portal path from within the sandbox. See

sonny@porygon > flatpak run --command="bash" re.sonny.Workbench
[📦 re.sonny.Workbench ~]$ ls /run/flatpak/doc/

@hfiguiere ha yes of course I forgot the steps to save the project and reopen to make use of the document portal. I updated the instructions. Thanks for catching.

I haven't been able to reproduce the problem with the previous version of xdg-desktop-portal (1.18.0)

@hfiguiere
Copy link
Collaborator

The funny thing is that while I get the error, if I flatpak enter I can access all the files in question.

@hfiguiere
Copy link
Collaborator

The fatal call is in cargo:

getcwd(0x562ca5f7ee10, 512)             = -1 ENOENT (No such file or directory)

This mean it has been unlinked.

@hfiguiere
Copy link
Collaborator

All you need is to use this small reproducer:

#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>

int main(int, char**) {
	char cwd[4096];

	char* r = getcwd(cwd, 4096);

	printf("CWD = %s\n", r);

	return 0;
}

It will print NULL on a failure.

@hfiguiere
Copy link
Collaborator

$ ls -l /proc/self/cwd
lrwxrwxrwx. 1 hub hub 0 Dec  5 21:37 /proc/self/cwd -> '/run/user/1000/doc/by-app/re.sonny.Workbench/265c72bf/TestWorkbenchRust (deleted)'

hfiguiere added a commit to hfiguiere/xdg-desktop-portal that referenced this issue Dec 20, 2023
hfiguiere added a commit to hfiguiere/xdg-desktop-portal that referenced this issue Dec 20, 2023
This fixes issue flatpak#1234

fuse_lowlevel_notify_inval_entry() will invalidate directories too,
which is a problem as it invalidate the current workdir directory.
So now we don't invalidate them and will let the kernel deal with it.

This is consistent with the passthrough_hp example from fuse.

Signed-off-by: Hubert Figuière <[email protected]>
hfiguiere added a commit to hfiguiere/xdg-desktop-portal that referenced this issue Dec 20, 2023
This fixes issue flatpak#1234

fuse_lowlevel_notify_inval_entry() will invalidate directories too,
which is a problem as it invalidate the current workdir directory.
So now we don't invalidate them and will let the kernel deal with it.

This is consistent with the passthrough_hp example from fuse.

Signed-off-by: Hubert Figuière <[email protected]>
@GeorgesStavracas GeorgesStavracas added the portal: documents Issues with the documents portal label Dec 20, 2023
@GeorgesStavracas GeorgesStavracas moved this from Needs Triage to Triaged in Triage Dec 20, 2023
@GeorgesStavracas GeorgesStavracas moved this to In Progress in XDG Portals workboard Dec 20, 2023
hfiguiere added a commit to hfiguiere/xdg-desktop-portal that referenced this issue Dec 20, 2023
This fixes issue flatpak#1234. This is a followup from flatpak#1190.

fuse_lowlevel_notify_inval_entry() will invalidate directories too,
which is a problem as it invalidate the current workdir directory.
So now we don't invalidate them and will let the kernel deal with it.

This is consistent with the passthrough_hp example from fuse.

Signed-off-by: Hubert Figuière <[email protected]>
hfiguiere added a commit to hfiguiere/xdg-desktop-portal that referenced this issue Dec 25, 2023
This fixes issue flatpak#1234. This is a followup from flatpak#1190.

fuse_lowlevel_notify_inval_entry() will invalidate directories too,
which is a problem as it invalidate the current workdir directory.
So now we don't invalidate them and will let the kernel deal with it.

This is consistent with the passthrough_hp example from fuse.

Signed-off-by: Hubert Figuière <[email protected]>
hfiguiere added a commit to hfiguiere/xdg-desktop-portal that referenced this issue Jan 12, 2024
This works around issue flatpak#1234. This is a followup from flatpak#1190.

fuse_lowlevel_notify_inval_entry() will invalidate directories too,
which is a problem as it invalidate the current workdir directory.
So now we don't invalidate them and will let the kernel deal with it.

This is consistent with the passthrough_hp example from fuse.

But this still make the directory being held for longer than
necessary.

Signed-off-by: Hubert Figuière <[email protected]>
hfiguiere added a commit to hfiguiere/xdg-desktop-portal that referenced this issue Jan 13, 2024
This works around issue flatpak#1234. This is a followup from flatpak#1190.

fuse_lowlevel_notify_inval_entry() will invalidate directories too,
which is a problem as it invalidate the current workdir directory.
So now we don't invalidate them and will let the kernel deal with it.

This is consistent with the passthrough_hp example from fuse.

But this still make the directory being held for longer than
necessary.

Signed-off-by: Hubert Figuière <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug portal: documents Issues with the documents portal
Projects
Status: Triaged
Status: In Progress
Development

No branches or pull requests

4 participants