flatpak / flatpak-xdg-utils

Simple portal-based commandline tools for use inside flatpak sandboxes
GNU Lesser General Public License v2.1
34 stars 14 forks source link

--sandbox-expose-path-ro doesn't handle accents #44

Closed hadess closed 3 years ago

hadess commented 3 years ago

This works:

$ flatpak-spawn  --env=GIO_USE_VFS=local --env=G_MESSAGES_DEBUG=all --sandbox-expose-path=/home/hadess/.var/app/org.gnome.Books/cache/gnome-desktop-thumbnailer/gstreamer-1.0 --env=GST_REGISTRY_1_0=/home/hadess/.var/app/org.gnome.Books/cache/gnome-desktop-thumbnailer/gstreamer-1.0/gstreamer-1.0.registry --watch-bus --sandbox --no-network --sandbox-expose-path=/home/hadess/.var/app/org.gnome.Books/sandbox/gnome-desktop-thumbnailer-9NAMZ0 --sandbox-expose-path-ro="/home/hadess/Documents/e-Books tests/Pepper___Carrot_-_épisodes_13_-_webp.cbz" ls

but this fails:

$ flatpak-spawn --clear-env --env=LANG=en_GB.UTF-8  --env=GIO_USE_VFS=local --env=G_MESSAGES_DEBUG=all --sandbox-expose-path=/home/hadess/.var/app/org.gnome.Books/cache/gnome-desktop-thumbnailer/gstreamer-1.0 --env=GST_REGISTRY_1_0=/home/hadess/.var/app/org.gnome.Books/cache/gnome-desktop-thumbnailer/gstreamer-1.0/gstreamer-1.0.registry --watch-bus --sandbox --no-network --sandbox-expose-path=/home/hadess/.var/app/org.gnome.Books/sandbox/gnome-desktop-thumbnailer-9NAMZ0 --sandbox-expose-path-ro="/home/hadess/Documents/e-Books tests/Pepper___Carrot_-_épisodes_13_-_webp.cbz" ls
error: Invalid byte sequence in conversion input
hadess commented 3 years ago

I don't know exactly who gets booted off the bus, but those should be array of arrays of bytes, not strings. From the Flatpak Portal XML:

             <term>sandbox-expose as</term>
             <term>sandbox-expose-ro as</term>
alexlarsson commented 3 years ago

Did you figure out which process is failing when iconv:ing the string?

alexlarsson commented 3 years ago

But yeah, not great that these are strings...

alexlarsson commented 3 years ago

We could tweak the portal to accept both (as this is in a stuffed in a variant), but it would need version checks on the user side...

hadess commented 3 years ago

Did you figure out which process is failing when iconv:ing the string?

Couldn't figure it out. Took me a long while to find why it was failing in the first place...

smcv commented 3 years ago

Pepper___Carrot_-_épisodes_13_-_webp.cbz

What bytes are those, on-disk?

I don't know exactly who gets booted off the bus

Perhaps nobody. Invalid byte sequence in conversion input looks like an error message from iconv, not from D-Bus.

hadess commented 3 years ago

That's the URI:

file:///home/hadess/Documents/e-Books%20tests/Pepper___Carrot_-_%C3%A9pisodes_13_-_webp.cbz
hadess commented 3 years ago

Perhaps nobody. Invalid byte sequence in conversion input looks like an error message from iconv, not from D-Bus.

I think the error is probably from when somebody's trying to print an error, which means already too late.

hadess commented 3 years ago

Finally root caused it: https://github.com/flatpak/flatpak/pull/4138