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
The core function Directory::GetFiles2 (documentserver-generate-allfonts) does not handle symbolic links #1859
Comments
Thanks for the very detailed report, I can confirm this issue, I've created issue 58490 in our private issue tracker Also, this problem is reproducible in DocumentServer, so I'll move it to its repo since it's our base product |
Hello there! I'm sorry for disturbance, but this issue is quite troublesome for us NixOS users. So, if I may ask, what's the state of the issue as of today? |
@heinwol I discovered this issue while researching why ONLYOFFICE doesn't have access to the system-wide fonts on NixOS. However, this issue is not the root cause. ONLYOFFICE traverses /usr/share/fonts to find fonts, but NixOS doesn't store fonts there. Like other Linux distros, NixOS uses NixOS uses fontconfig exclusively and does not provide the /usr/share/fonts directory. If ONLYOFFICE supports fontconfig in the future, then it will be able to find the system-wide fonts on NixOS (and other Linux distros as well). In the meantime, I wrote a NixOS module which runs ONLYOFFICE in a FHS environment so that it can find the system fonts. See https://github.com/emmanuelrosa/erosanix/blob/6a2a83b2f0a6a3646bbe3f079a5fa1aad7e71d9f/modules/onlyoffice.nix One thing I know that doesn't work is opening files from outside of ONLYOFFICE, such as with a file browser. But if you launch ONLYOFFICE from the "application menu" then it works. |
Hello, please fix this. Terrible to not use fontconfig, it is standard for good reasons. |
+1 |
I've considered submitting a PR, but the ONLYOFFICE code base is too massive for me to build. Instead, I'll add more detail.
That's the Linux code which currently calls GetFiles2() with various font directories. The best example of how to implement a font search on Linux using fontconfig is the utility One issue I can think of is that I don't know how such a change would affect Flatpak. Currently, |
+1 |
Hello, I reminded the developers about this, if there are no difficulties, then you will waiting the fix in the next release. |
This issue is unique.
Operating System
Linux (DEB package)
Version information
7.1
Expected Behavior
I expected to be able to use my system fonts when creating/viewing a document.
Actual Behavior
I use NixOS, a Linux distribution, as my operating system. We have a package for ONLYOFFICE, using the dep package. On NixOS ONLYOFFICE cannot find any installed system fonts.
Based on my source code research, ONLYOFFICE reads system fonts from
/usr/share/fonts
. However, it does not handle the case when/usr/share/fonts
, or any files within, are symbolic links (symlinks).NixOS doesn't have
/usr/share/fonts
, but I have a fix which creates it as a symlink which points to a directory which contains symlinks to each system font file. I don't want to get distracted on why symlinks are being used. Let's just say, that's how NixOS works.The root of the issue is this code in the core repo.
GetFiles2()
is used when reading/usr/share/fonts
, however the "if block" which checks thed_type
does not check if the file is a symlink. Therefore, if the font directory or the font files are symlinks, which is 100% valid on Linux, ONLYOFFICE ignores those files/directories.Reproduction Steps
/usr/share/fonts
Additional information
The code in question is this:
You can use
stat(()
withS_ISREG()
to handle symlinks, sincestat()
will operate on the file the symlink points to. You may even be able to simply change one line of code:else if (DT_UNKNOWN == dirp->d_type || DT_LNK == dirp->d_type )
The text was updated successfully, but these errors were encountered: