Open/Edit in (d)vm bug

I wanted to report this for a long time.
It is not possible to open/edit empty file in any external vm.

Reproduce:

  1. create empty file.
  2. try to open/edit via context menu in other (d)vm (haven’t tried via temrinal)

It is possible, if you create a handler in the target for empty
files. Otherwise the target will be started but will close down,
because it doesn’t know what to do with the zero length file.
Alternatively, give the empty file a suitable extension.
Notabug.

I’ve sometimes built a menu item for clients that prompts for a
filename: if existing, that file is opened for writing in a disposable;
if not, opens a new file in the disposable. That “new” file may be empty
but is rarely of zero length, depending on the application.

I never presume to speak for the Qubes team.
When I comment in the Forum I speak for myself.

Did you actually try yourself that? Creating empty document in thunar? Because I already tried prior to posting with 1.txt or any other extension and only then came to OP.

I have done this often, although not in thunar. I cant imagine that
will make any difference.
What matters is that the receiving qube is configured correctly to
handle the empty files.
Otherwise this is know different from attempting to open an xls file in
a qube where no handler is installed.

I never presume to speak for the Qubes team.
When I comment in the Forum I speak for myself.

So it’s not about the extension then? Because, the moment 1.txt is not empty, it can be opened. And if it’s about “empty” handler, how come I can open any empty file in its native qube then, regardless of the qube type and file extension? In all of these cases it’s about text files and editors, if in doubt.

I know you were skeptikal about this on another topic but it’s probably not (only) about the extension, it’s more about the mime type?

Edit, wrong assertion:

Summary

Unfortunately, the mime type is not consistent…

user@disp4678:~$ touch empty.txt
user@disp4678:~$ xdg-mime query filetype empty.txt 
text/plain
user@disp4678:~$ file --mime-type -b empty.txt 
inode/x-empty

Are you not comparing the file extension to the content of the file?

I don’t think you can expect and empty file to have the mime type text, just because the filename ends with txt.

1 Like

You’re right, my mistake!

1 Like

In my experience, LibreOffice will suck up empty files just fine,
following the file extension - i.e empty.txt is opened as a blank text
file, empty.doc as an empty doc file, etc etc.
Other extensions depend on what programs you have configured - some will
open and report the file is empty, others will not.

I never presume to speak for the Qubes team.
When I comment in the Forum I speak for myself.

It’s mousepad. It opens empty file when present physically in (disp)vm, it doesn’t when trying mousepad in external (disp)vm from the very same (dvm) template…

It works, check your configuration. It works with completely empty file with no extension at all too. Any vm, including dvms based off of the same template.

Tested with thunar and mousepad.


Besides that I have little idea how to help you troubleshoot things. If you’re solid on the fact that your vm opens empty files with mousepad just fine, maybe some script sets this settings after starting the vm, but doesn’t affect vms ran by qubes that try to open an empty file?

If you try to copy an empty file to a different vm and open it, will it work?

Thanks. Were those Fedora vm’s? Mine are. I have no idea what configuration to check. What configuration do I have in a dispvm where it will open physically present empty file, that other dispvm based on the same dvm template invoked doesn’t have??? It doesn’t even make sense when i look at it like this

Works over here (Qubes 4.2.4 and Fedora 41 templates) in both variants:

  1. Open mousepad in AppVM, save empty file (with or wothout extension). → Open in disposable. → Opens in dvm with mousepad.
  2. Open thunar in AppVM, create empty file from context menu (with or without extension). → Open in disposable. → Opens in dvm with mouespad.

Caveat: In XFCE settings of that AppVM → Default Applications → 2nd tab: Utilities → File Manager → set to “qvm-open-in-dvm”.

1 Like

Yep.

I was thinking maybe you have some script that sets default application for this mime type correctly some time after boot on purpose (or not) that just doesn’t run quickly enough to apply the change before qubes tries to open the file. This is a WILD guess tho

Another option is the way you open the file in thunar somehow differs from qvm-open-in-vm and qvm-open-in-dvm in such a way that they end up handling the same empty file as different mime types (i.e. xdg-mime and file --mime-type in this example), and you have only one of them set to open with mousepad.

p.s. upon checking I only have text/plain type set to mousepad, not inode/x-empty.

p.p.s. Have you tried doing it from command line? Maybe it spits out something useful