shutter-project / shutter

Screenshot tool for Linux
https://shutter-project.org/
GNU General Public License v3.0
501 stars 35 forks source link

Cannot run binary bin/shutter from cloned repository using symlink #653

Closed hsandt closed 3 months ago

hsandt commented 4 months ago

Brief summary of issue

In order to run a patched version of shutter (e.g. a PR branch), I replaced my shutter package install with a symlink from ~/.local/bin/shutter to shutter-repo/bin/shutter.

However, when running it via the symlink, it fails with a long error message (which can be found in other issues but they are totally difference contexts, so only the symptoms seem common).

Running shutter via full path works fine.

A hard link also fails to run with the same error message.

When creating a .desktop, I must execute shutter from full path which is cumbersome.

Otherwise, I could copy the whole shutter file to my ~/.local/bin but I'd lose the point of just having to pull new commits on my repo and automatically get the latest version of shutter in my PATH (I'd have to remember to copy shutter file every time).

Steps to reproduce the issue

  1. Clone the shutter repo
  2. Create symlink in some folder in your PATH (e.g. ~/.local/bin, make sure it is in your PATH) to shutter-repo/bin/shutter. If you already have shutter installed via package or another symlink shutter, to avoid name conflict, you can name that symlink shutter-repo instead
  3. Run shutter (or shutter-repo if you named it like that) using the symlink, and notice the error
  4. Run shutter-repo/bin/shutter with full path and notice it works

Note: make sure to close any previous instance of Shutter to avoid reusing the existing one. More exactly, when opening shutter works, it will use the previous instance, but when it fails, it will fail anyway.

Error output

It's very long and similar to the one in https://github.com/shutter-project/shutter/issues/567 so I'll add skipping ellipsis at some points to make it shorter. I suspect a common core error causes the same chain of error.

Subroutine Pango::Layout::set_text redefined at /usr/share/perl5/Gtk3.pm line 2299.
    require Gtk3.pm called at ./shutter line 72
    Shutter::App::BEGIN() called at /usr/share/perl5/Gtk3.pm line 2299
    eval {...} called at /usr/share/perl5/Gtk3.pm line 2299
Subroutine Pango::Layout::set_markup redefined at /usr/share/perl5/Gtk3.pm line 2305.
    require Gtk3.pm called at ./shutter line 72
    Shutter::App::BEGIN() called at /usr/share/perl5/Gtk3.pm line 2305
    eval {...} called at /usr/share/perl5/Gtk3.pm line 2305
GLib-GObject-CRITICAL **: g_boxed_type_register_static: assertion 'g_type_from_name (name) == 0' failed at /usr/lib/x86_64-linux-gnu/perl5/5.34/Glib/Object/Introspection.pm line 110.
 at /usr/share/perl5/Gtk3.pm line 489.
    Gtk3::import("Gtk3", "-init") called at ./shutter line 72
    Shutter::App::BEGIN() called at ./shutter line 72
    eval {...} called at ./shutter line 72
GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed at /usr/lib/x86_64-linux-gnu/perl5/5.34/Glib/Object/Introspection.pm line 110.
 at /usr/share/perl5/Gtk3.pm line 489.
    Gtk3::import("Gtk3", "-init") called at ./shutter line 72
    Shutter::App::BEGIN() called at ./shutter line 72
    eval {...} called at ./shutter line 72
GLib-GObject-CRITICAL **: g_boxed_type_register_static: assertion 'g_type_from_name (name) == 0' failed at /usr/lib/x86_64-linux-gnu/perl5/5.34/Glib/Object/Introspection.pm line 110.
 at /usr/share/perl5/Gtk3.pm line 489.
    Gtk3::import("Gtk3", "-init") called at ./shutter line 72
    Shutter::App::BEGIN() called at ./shutter line 72
    eval {...} called at ./shutter line 72
GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed at /usr/lib/x86_64-linux-gnu/perl5/5.34/Glib/Object/Introspection.pm line 110.
 at /usr/share/perl5/Gtk3.pm line 489.
    Gtk3::import("Gtk3", "-init") called at ./shutter line 72
    Shutter::App::BEGIN() called at ./shutter line 72
    eval {...} called at ./shutter line 72
GLib-GObject-CRITICAL **: g_boxed_type_register_static: assertion 'g_type_from_name (name) == 0' failed at /usr/lib/x86_64-linux-gnu/perl5/5.34/Glib/Object/Introspection.pm line 110.
 at /usr/share/perl5/Gtk3.pm line 489.
    Gtk3::import("Gtk3", "-init") called at ./shutter line 72
    Shutter::App::BEGIN() called at ./shutter line 72
    eval {...} called at ./shutter line 72
GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed at /usr/lib/x86_64-linux-gnu/perl5/5.34/Glib/Object/Introspection.pm line 110.
 at /usr/share/perl5/Gtk3.pm line 489.
    Gtk3::import("Gtk3", "-init") called at ./shutter line 72
    Shutter::App::BEGIN() called at ./shutter line 72
    eval {...} called at ./shutter line 72
Variable "$progname_active" will not stay shared at ./shutter line 2773.
Variable "$progname" will not stay shared at ./shutter line 2774.
Variable "$im_colors_active" will not stay shared at ./shutter line 2782.
Variable "$combobox_im_colors" will not stay shared at ./shutter line 2783.
...
Variable "%session_screens" will not stay shared at ./shutter line 10852.
Variable "%session_screens" will not stay shared at ./shutter line 10859.
Variable "%session_screens" will not stay shared at ./shutter line 10866.
Variable "%session_screens" will not stay shared at ./shutter line 10873.
Variable "$window" will not stay shared at ./shutter line 10881.
Variable "$nav_toolbar" will not stay shared at ./shutter line 10891.
Name "Gtk3::Gdk::SELECTION_CLIPBOARD" used only once: possible typo at ./shutter line 298.
WARNING: gnome-web-photo is missing --> screenshots of websites will be disabled!

 at ./shutter line 9140.
    Shutter::App::fct_init_depend() called at ./shutter line 196
Useless use of hash element in void context at /usr/share/perl5/Shutter/App/Common.pm line 77.
    require Shutter/App/Common.pm called at ./shutter line 207
Useless use of hash element in void context at /usr/share/perl5/Shutter/App/Common.pm line 80.
    require Shutter/App/Common.pm called at ./shutter line 207
Subroutine lookup redefined at /usr/share/perl5/Shutter/Draw/DrawingTool.pm line 28.
    require Shutter/Draw/DrawingTool.pm called at ./shutter line 229
Variable "$self" will not stay shared at /usr/share/perl5/Shutter/Draw/DrawingTool.pm line 671.
    require Shutter/Draw/DrawingTool.pm called at ./shutter line 229
Variable "$self" will not stay shared at /usr/share/perl5/Shutter/Screenshot/SelectorAdvanced.pm line 840.
    require Shutter/Screenshot/SelectorAdvanced.pm called at ./shutter line 234
GLib-CRITICAL **: g_variant_type_checked_: assertion 'g_variant_type_string_is_valid (type_string)' failed at /usr/lib/x86_64-linux-gnu/perl5/5.34/Glib/Object/Introspection.pm line 67, <DATA> line 19.
 at ./shutter line 321, <DATA> line 19.
    Shutter::App::STARTUP(Shutter::App=HASH(0x55d888aade68)) called at /usr/lib/x86_64-linux-gnu/perl5/5.34/Glib/Object/Introspection.pm line 67
    Glib::Object::Introspection::__ANON__(Shutter::App=HASH(0x55d888aade68)) called at ./shutter line 10995
...
GLib-CRITICAL **: g_variant_type_copy: assertion 'g_variant_type_check (type)' failed at /usr/lib/x86_64-linux-gnu/perl5/5.34/Glib/Object/Introspection.pm line 67, <DATA> line 19.
 at ./shutter line 436, <DATA> line 19.
    Shutter::App::STARTUP(Shutter::App=HASH(0x55d888aade68)) called at /usr/lib/x86_64-linux-gnu/perl5/5.34/Glib/Object/Introspection.pm line 67
    Glib::Object::Introspection::__ANON__(Shutter::App=HASH(0x55d888aade68)) called at ./shutter line 10995
Undefined subroutine &Shutter::App::Directories::create_hidden_home_dir_if_not_exist called at ./shutter line 443, <DATA> line 19.
    Shutter::App::STARTUP(Shutter::App=HASH(0x55d888aade68)) called at /usr/lib/x86_64-linux-gnu/perl5/5.34/Glib/Object/Introspection.pm line 67
    Glib::Object::Introspection::__ANON__(Shutter::App=HASH(0x55d888aade68)) called at ./shutter line 10995
GLib-GObject-CRITICAL **: g_boxed_free: assertion 'boxed != NULL' failed, <DATA> line 19 during global destruction.
 at ./shutter line 0, <DATA> line 19.
    eval {...} called at ./shutter line 0
...
GLib-GObject-CRITICAL **: g_boxed_free: assertion 'boxed != NULL' failed, <DATA> line 19 during global destruction.
 at ./shutter line 0, <DATA> line 19.
    eval {...} called at ./shutter line 0
GLib-GObject-CRITICAL **: g_boxed_free: assertion 'boxed != NULL' failed, <DATA> line 19 during global destruction.
 at ./shutter line 0, <DATA> line 19.
    eval {...} called at ./shutter line 0

Extra information, such as Shutter version, display server in use (Xorg or Wayland), operating system and ideas for how to solve:

I was using Shutter 0.99.2 and now testing 0.99.4 + patch (PR: https://github.com/shutter-project/shutter/pull/642) Ubuntu 22.02 on Xorg

DarthGandalf commented 4 months ago

That's expected. Shutter needs to find its data, and it uses path relative to the executable.

What you can do is to add the directory with .../shutter-repo/bin/shutter to your PATH variable (export PATH="$PATH:/path/to/shutter-repo/bin"), then it should work, and you won't need to copy files like that.