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

Crash after theme selection #167

Closed
Emuzex opened this issue May 15, 2022 · 25 comments
Closed

Crash after theme selection #167

Emuzex opened this issue May 15, 2022 · 25 comments
Labels
bug Something isn't working linux Linux-related

Comments

@Emuzex
Copy link

Emuzex commented May 15, 2022

After install i started gittyup, then i picked the dark theme. The program crashed instantly and now doesnt start.
Installed via yay

Console output after start gittup

Theme dir: QDir ("/home/emuzex/.cache/yay/gittyup/src/gittyup/conf", nameFilters = {""}, QDir :: SortFlags (Name | IgnoreCase), QDir :: Filters (Dirs | Files | Drives | AllEntries))
Theme dir: QDir ("/home/emuzex/.cache/yay/gittyup/src/gittyup/conf", nameFilters = {"
"}, QDir :: SortFlags (Name | IgnoreCase), QDir :: Filters (Dirs | Files | Drives | AllEntries))
PANIC: unprotected error in call to Lua API (cannot open /home/emuzex/.cache/yay/gittyup/src/gittyup/conf/System.lua: No such file or directory)
zsh: IOT instruction (core dumped) gittyup

System:
OS: Manjaro Linux x86_64
Host: ASUS TUF Gaming A15 FA506IU_FA506IU 1.0
Kernel: 5.15.38-1-MANJARO
CPU: AMD Ryzen 9 4900H with Radeon Graphics (16) @ 3.300GHz
GPU: NVIDIA GeForce GTX 1660 Ti Mobile
GPU: AMD ATI 06:00.0 Renoir
Memory: 31582MiB

@Murmele
Copy link
Owner

Murmele commented May 16, 2022

Hi,

Currently the aur package is provided by someone outside of the project.

The error was reported also here: https://aur.archlinux.org/packages/gittyup

Officially we support only the flatpak package: https://flathub.org/apps/details/com.github.Murmele.Gittyup

@Emuzex
Copy link
Author

Emuzex commented May 16, 2022

Thank u for fast response.

@alerque
Copy link
Contributor

alerque commented May 16, 2022

I am the AUR packager. I'm happy to fix the packaging, but I believe this is actually a legitimate upstream issue and needs fixing here in the project.

Somewhere in the build system (cmake + ninja build) an assumption is being made that a full file path as detected during build will be the same after install (ninja install). This is a bogus assumption that will not be true for many/most packaging systems.

@Murmele
Copy link
Owner

Murmele commented May 17, 2022

Hi @alerque, good to know. I'm working currently on using libgit2 upstream instead of a custom one. So I will notify you as soon as this will be merged (#153).

I will check out where the lua path is set wrongly

@alerque
Copy link
Contributor

alerque commented May 17, 2022

Thanks. I'll keep an eye out and test, and if I get a chance try to root out the issue myself. Also if I can't find the source I might temporarily monkey patch the installed package files by search/replacing the build path to the permanent one—at least until this is fixed for all builds by default. Note that similar issues have come up with some Lua Rocks packages that try to detect their own location and then hard code it into themselves. Just to say you may be looking for something even upstream in a Lua package.

(Also great to hear that you are moving towards the official libgit2 upstream!)

@alerque
Copy link
Contributor

alerque commented May 17, 2022

Just a follow up some initial searching suggests this isn't something that can be monkey patched because the faulty path isn't anything in plain text in Lua files it is in a binary somewhere.

@ReubenM
Copy link

ReubenM commented May 17, 2022

@alerque I believe you could monkey patch the conf path set in src/conf/CMakeLists.txt line 13

target_compile_definitions(conf PRIVATE CONF_DIR="${CMAKE_SOURCE_DIR}/conf"

@alerque
Copy link
Contributor

alerque commented May 17, 2022

@ReubenM Interesting find. Definitely a bug in the build if CMAKE_SOURCE_DIR is ending up baked into the final installation binaries, but yes we might be able to patch that before build. Did you try it by the way? It's possible that will break other things during the build process.

@ReubenM
Copy link

ReubenM commented May 17, 2022

@alerque Haven't tried building it patched yet, but that appears to be the source of the issue

@alerque
Copy link
Contributor

alerque commented May 17, 2022

I tried patching that line and still don't get a working build. I do get a build, but if the build time source paths are not available at run time (as is the case for an installed program) it still crashes

prepare() {
  sed -i -e '/CONF_DIR/{s!SOURCE!BINARY!;s!/conf!!}' src/conf/CMakeLists.txt
}

@exactly-one-kas exactly-one-kas added bug Something isn't working linux Linux-related labels May 28, 2022
@Murmele
Copy link
Owner

Murmele commented May 30, 2022

@alerque maybe you can have a look through the FLATPAK if's, maybe you find something there

grafik

Destination is set to: Resources

@Murmele
Copy link
Owner

Murmele commented May 30, 2022

@Emuzex Can you have a look into /usr/lib/gittyup
Is there any Resources folder? And maybe the lua plugins

@Murmele
Copy link
Owner

Murmele commented May 30, 2022

sed -i -e '/CONF_DIR/{s!SOURCE!BINARY!;s!/conf!!}' src/conf/CMakeLists.txt

Can you try to set it to {CMAKE_BINARY_DIR}/Resources
and maybe also the L10N_DIR as it is done for the flatpak package?

It uses those definitions only if Resources is not found.
grafik

@alerque
Copy link
Contributor

alerque commented Jun 10, 2022

Edit: Scratch the first part of my earlier comment here. Having recompiled this a few times the error is still showing up with the /build/... path, not whatever I change the CONF_DIR value to be so we're not ever hitting that variable's value.


Having a look at where the System.lua file actually is, it looks like it is in .../Resources/themes/.

$ pacman -Ql gittyup | grep System.lua
gittyup /usr/lib/gittyup/Resources/themes/System.lua

I could keep trying to patch it, but I think something is seriously off about this path handling. A variable named "CONF_DIR" shouldn't have a hard coded path to a theme directory. Lua includes shouldn't request just require('System') but require('themes.system'), while also having added a pattern for the app's resource dir to the lua package.path.

@Murmele
Copy link
Owner

Murmele commented Jun 10, 2022

$ pacman -Ql gittyup | grep System.lua
gittyup /usr/lib/gittyup/Resources/themes/System.lua

The binary is in /usr/lib/gittyup or?

@alerque
Copy link
Contributor

alerque commented Jun 10, 2022

The binary is installed as /usr/bin/gittyup, per FHS and Arch packaging guidelines.

@Murmele
Copy link
Owner

Murmele commented Jun 10, 2022

Ah ok you are moving the binary:
install -Dm0755 "$_bin" "$pkgdir/usr/bin/$pkgname"

That means cd("Resources") will not work anymore. Then it will be searched in CONF_DIR. Can you try to copy the Resources folder manually to the correct place?

@Murmele
Copy link
Owner

Murmele commented Jun 10, 2022

What is the correct location those configuration files? /usr/share?

@alerque
Copy link
Contributor

alerque commented Jun 10, 2022

Yes, I think ideally the resources should end up in /usr/share/gittyup/, perhaps even without the 'Resources' segment of the path. At the moment the installer puts them in /usr/lib/gittyup/Resources along with the other stuff (the executables, plugins, lib directory, etc should probably stay in /usr/lib;; the include directory also in there should almost certainly either not be packaged or moved to /usr/include).

@Murmele
Copy link
Owner

Murmele commented Jun 10, 2022

I can introduce a DATA_INSTALL_DIR variable and use it instead of the CMAKE_SOURCE_DIR?

@exactly-one-kas maybe you have also an idea

@alerque
Copy link
Contributor

alerque commented Jun 10, 2022

DATA_INSTALL_DIR sounds like a much better plan than CMAKE_SOURCE_DIR!

@alerque
Copy link
Contributor

alerque commented Jun 10, 2022

Looking at other vars, maybe CMAKE_INSTALL_DATADIR would be a better naming scheme (see existing CMAKE_INSTALL_PREFIX and CMAKE_INSTALL_MANDIR).

@alerque
Copy link
Contributor

alerque commented Jun 10, 2022

...on second thought, the CMAKE_INSTALL_PREFIX is almost certainly a heterodox usage, that should be just /usr instead of /usr/lib/gittyup like it needs to be right now. And then things like the MANDIR (and proposed DATADIR) should probably use the prefix plus their own bit of path. At least that's how these vars would be expected to behave in autotools builds, I'm not sure about the cmake idiomatic usage.

@Murmele Murmele mentioned this issue Jun 10, 2022
3 tasks
@Murmele
Copy link
Owner

Murmele commented Jun 10, 2022

I created a pull request. Let's discuss everything there

@Murmele
Copy link
Owner

Murmele commented Aug 8, 2022

I think we can close this, because this is related to #217

@Murmele Murmele closed this as completed Aug 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working linux Linux-related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants