Bug 262496 - devel/xdg-utils: xdg-open opens *.cpp and *.h files with RStudio
Summary: devel/xdg-utils: xdg-open opens *.cpp and *.h files with RStudio
Status: Closed Works As Intended
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-desktop (Team)
URL: https://gitlab.freedesktop.org/xdg/xd...
Keywords:
Depends on:
Blocks:
 
Reported: 2022-03-12 08:10 UTC by Yuri Victorovich
Modified: 2022-04-11 18:10 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (desktop)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yuri Victorovich freebsd_committer freebsd_triage 2022-03-12 08:10:20 UTC
I have RStudio installed, and 'xdg-open x.cpp' opens x.cpp with RStudio despite its MIME file /usr/local/share/mime/packages/rstudio.xml doesn't say that RStudio can open *.cpp files.

Sometimes *.r files are opened with vscode when it is installed in addition to RStudio, even though vscode doesn't install any MIME files.

Something is wrong with xdg-open.
Comment 1 Yuri Victorovich freebsd_committer freebsd_triage 2022-03-13 20:32:51 UTC
Add upstream bug report.
Comment 2 Adriaan de Groot freebsd_committer freebsd_triage 2022-04-11 17:49:16 UTC
That upstream report contains no information (just a link to this PR) so it's not going to get much attention. Frankly, I'm surprised it wasn't just closed as "not-actionable here".

`xdg-open` is a shell script. Please run it with shell-tracing enabled, e.g.:

```
sh -x /usr/local/bin/xdg-open x.cpp
```

For me, the trace is short, and all xdg-open ends up doing is calling kde-open5, so *if* I could reproduce this, I'd have to look at -- and re-file the PR -- against kde-open5, not xdg-open.

[[ What kind of configuration options / build machine parameters are suggested for RStudio? I can't build it with poudriere because it always crashes with too many open files. ]]
Comment 3 Adriaan de Groot freebsd_committer freebsd_triage 2022-04-11 18:08:08 UTC
[[ I See that devel/RStudio/Makefile has a comment about the too-many-files; I can follow that. ]]

Rstudio **does** register something for C and C++ files, though: after installation RStudio is presented in KDE settings as one of the options for C++ headers. Since it's at the end of the list, something else gets it first.
Comment 4 Adriaan de Groot freebsd_committer freebsd_triage 2022-04-11 18:10:49 UTC
- devel/RStudio installs /usr/local/share/applications/rstudio.desktop . It also installs /usr/local/share/applications/rstudio.desktop.bak, which seems less-than-useful.
- In /usr/local/share/applications/rstudio.desktop, it claims C and C++ headers and sources:

```
MimeType=text/x-r-source;text/x-r;text/x-R;text/x-r-doc;text/x-r-sweave;text/x-quarto-markdown;text/x-r-markdown;text/x-r-html;text/x-r-presentation;application/x-r-data;application/x-r-project;application/x-rdp-rsp;text/x-r-history;text/x-r-profile;text/x-tex;text/x-markdown;text/css;text/javascript;text/x-chdr;text/x-csrc;text/x-c++hdr;text/x-c++src;
```

There is nothing wrong with xdg-open.