kensanata / bitlbee-mastodon

A Mastodon plugin for Bitlbee
https://alexschroeder.ch/software/Bitlbee_Mastodon
GNU General Public License v2.0
30 stars 7 forks source link

(debian) help page not installed, but files are in correct places #6

Closed ghost closed 4 years ago

ghost commented 6 years ago

The readme.md now contains:

If you're installing this plugin in a system where you didn't build your own Bitlbee but installed revision 3.5.1 (e.g. on a Debian system around the end of 2017), you will run into a problem: the plugin will get installed into /usr/lib/bitlbee (plugindir) but the documentation wants to install into /usr/local/share/bitlbee instead of /usr/share/bitlbee (datadir). As you can tell from /usr/lib/pkgconfig/bitlbee.pc, there is no datadir for you. In this situation, try ./configure --prefix=/usr and build and install again.

That text seems to be incorrect. That is, on debian stable (stretch) the file /usr/share/bitlbee/mastodon-help.txt is created even without changing the prefix. So I'm expecting it to work. After sudo make install I did systemctl restart bitlbee, then launched into irssi and ran help mastodon. It displayed the general top-level bitlbee help page (same as if I type help anynonsensehere). If I type help mregister, that too just gives the top-level help page with nothing that is particular to mastodon.

If I simply type mregister I get "Unknown command: mregister. Please use help commands to get a list of available commands."

It's as if no plugin was installed. Yet there exists /usr/lib/bitlbee/mastodon.(so|la)

kensanata commented 6 years ago

That text seems to be incorrect. That is, on debian stable (stretch) the file /usr/share/bitlbee/mastodon-help.txt is created even without changing the prefix. So I'm expecting it to work. After sudo make install I did systemctl restart bitlbee, then launched into irssi and ran help mastodon. It displayed the general top-level bitlbee help page (same as if I type help anynonsensehere).

Hm. What change would you propose? On my system, that’s what I see. If I don’t set the prefix, make install will say that it can’t find bitlbee’s help.text file in /usr/local/share/bitlbee and refuse to install mastodon-help.txt.

stettberger commented 6 years ago

@libBletchley I see the same problem here. Are you using bitlbee-libpurple?

ghost commented 6 years ago

@stettberger

I see the same problem here. Are you using bitlbee-libpurple?

No, that's not installed. Should it be?

@kensanata

Hm. What change would you propose?

I don't know what the fix is, because I don't understand why I even have a problem. Everything appears to be in the right place AFAIK. So it's not clear why it's not working.

On my system, that’s what I see. If I don’t set the prefix, make install will say that it can’t find bitlbee’s help.text file in /usr/local/share/bitlbee and refuse to install mastodon-help.txt.

That didn't happen in my case. I got no error that I can recall, and no attempt to write to /usr/local/share/bitlbee (which does not exist on my system). The installer seems to have actually found the proper path (/usr/share/bitlbee). So I don't know why the plugin is not getting loaded.

kensanata commented 6 years ago

Some questions:

  1. You didn't explicitly say, but is bitlbee's help.txt in the same directory and with the same permissions as mastodon-help.txt?
  2. Does the log say "Error opening helpfile: ..." anywhere? That's what I would expect.
  3. Apparently your bitlbee doesn't use the plugindir the plugin expected it to. Can you discover the value of PLUGINDIR in config.h for bitlbee itself and compare that with where the plugin ended up in?
ghost commented 6 years ago

@kensanata

is bitlbee's help.txt in the same directory and with the same permissions as mastodon-help.txt?

# find /usr/share/bitlbee/
/usr/share/bitlbee/
/usr/share/bitlbee/mastodon-help.txt
/usr/share/bitlbee/help.txt

Does the log say "Error opening helpfile: ..." anywhere?

# ls /var/log/*bitlbee*
ls: cannot access '/var/log/*bitlbee*': No such file or directory

It's unclear from /etc/bitlbee/bitlbee.conf how to turn on logging.

Can you discover the value of PLUGINDIR in config.h for bitlbee itself and compare that with where the plugin ended up in?

# aptitude source bitlbee
...
# cd bitlbee-3.5.1
# grep -i PLUGINDIR conf*
conf.c: conf->plugindir = g_strdup(PLUGINDIR);
conf.c: g_free(conf->plugindir);
conf.c:                 } else if (g_strcasecmp(ini->key, "plugindir") == 0) {
conf.c:                         g_free(conf->plugindir);
conf.c:                         conf->plugindir = g_strdup(ini->value);
conf.h: char *plugindir;
configure:plugindir='$prefix/lib/bitlbee/'
configure:--plugindir=...                                               $plugindir
configure:plugindir=$(eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g')
configure:PLUGINDIR=$plugindir
configure:#define PLUGINDIR "$plugindir"
configure:      plugindir=""
configure:plugindir=$plugindir

# find /usr/lib/bitlbee/
/usr/lib/bitlbee/
/usr/lib/bitlbee/mastodon.la
/usr/lib/bitlbee/mastodon.so

Looks like the plugins are where they are expected to be, although I suppose the debian project could have messed with $prefix.

kensanata commented 6 years ago

I guess you could stop the Bitlbee service and start it manually without daemonizing it. Then you should definitely see all the output.

ghost commented 6 years ago

@kensanata

I guess you could stop the Bitlbee service and start it manually without daemonizing it. Then you should definitely see all the output.

It's rather brain-dead the way they designed the bitlbee CLI. Turning on verbosity (-v) requires the option to inhibit forking (-n), and then the -n option requires daemon mode. So by extension, verbosity requires daemon mode.

So I tried: sudo -u bitlbee bitlbee as well as sudo -u bitlbee bitlbee -Dnv. Neither of them produced any interesting output.

kensanata commented 6 years ago

I guess the next step would be gdb and stepping through the function looking for plugins in plugindir? :(

kensanata commented 6 years ago

This problem remains unresolved?

ghost commented 6 years ago

I don't have gdb installed, but if I run sudo -u bitlbee strace -e trace=file bitlbee -Dnv, among the output is:

stat("/usr/lib/bitlbee/mastodon.so", {st_mode=S_IFREG|0755, st_size=252776, ...}) = 0
open("/usr/lib/bitlbee/mastodon.so", O_RDONLY|O_CLOEXEC) = 7
open("/usr/share/bitlbee/help.txt", O_RDONLY) = 6

So we know the plugin is being found and read, as well as the help.txt file, but not the mastodon-help.txt file that's in the same directory as help.txt.

kensanata commented 6 years ago

It remains a mystery. :(

kensanata commented 6 years ago

My laptop runs PureOS which is a Debian derivative and installing help worked just fine. Then again, sudo system restart bitlbee or sudo systemctl restart bitlbee.service both seem to be unable to restart Bitlbee. ps aux | grep bitlbee keeps showing a bitlbee -I which I have to kill myself before a new bitlbee -F -n shows up and the new help is available. Weird.

ghost commented 6 years ago

If I execute this in irssi: /msg -Bitlbee &bitlbee plugins, I get:

"bitlbee-mastodon 0.1.0"

So it's getting loaded enough to be listed as a plugin. Yet these commands still simply show bitlbee generic help: /msg -Bitlbee &bitlbee help mastodon, /msg -Bitlbee &bitlbee help mregister

kensanata commented 6 years ago

Looks like the binary file for the library was found but the text file with the additional help entries was not...

ghost commented 6 years ago

If I run /msg -Bitlbee &bitlbee mregister the output is:

Unknown command: mregister. Please use help commands to get a list of available commands.

So the binary is only loaded enough to be listed as a plugin, but not enough to function.

kensanata commented 6 years ago

Actually "mregister" is just the name of the page explaining how to register. The bitlbee wiki page has a copy of the relevant content. Management summary:

account add mastodon kensanata
account mastodon set base_url https://octodon.social/api/v1
account mastodon on

As for the location of the help file, this is what I see:

$ ls /usr/share/bitlbee/
discord-help.txt  help.txt  mastodon-help.txt

Thus, help.txt by bitlbee and mastodon-help.txt but bitlbee-mastodon are in the same directory. How does that look on your system?

ghost commented 6 years ago

I have help.txt and mastodon-help.txt in that directory, both root owned w/perms 644.

When you say "by bitlbee", are you saying the owner of that file is bitlbee?

kensanata commented 6 years ago

No, I just wanted to say that installing bitlbee will install help.txt and installing the bitlbee-mastodon plugin will install mastodon-help.txt. I still don't know why bitlbee's help pages are available and bitlbee-mastodon's help pages are not.

kensanata commented 6 years ago

When I look at mastodon_help_init it would seem to me that it can either return with a log message saying "Error finding the directory of helpfile ..." or it will run help_init which run open which you should have seen in your trace. The entire thing remains a mystery.

ghost commented 6 years ago

it works! And maybe it worked all along.. the broken help and the unknown cmd reply to mregister lead me to think the plugin was not loaded.

The help is still missing, but it seems I can rely on the wiki.

titanofold commented 4 years ago

I'm on Gentoo. The help text is not working here, either.

The plugin does work.

EDIT: Actually, help does work...after the plugin is loaded, apparently. Before turning the account on, though, all I got back is the general help.

kensanata commented 4 years ago

Hm, interesting. I guess it makes sense, though: the plugin can only modify the help function once it's loaded, right? Looks like all I need to do is document that fact?

titanofold commented 4 years ago

Hm, interesting. I guess it makes sense, though: the plugin can only modify the help function once it's loaded, right?

Right. It is not enough for it be installed. It also has to be invoked (account on).

Looks like all I need to do is document that fact?

Yes.

kensanata commented 4 years ago

86e23d4 adds the necessary info. See README. I hope that allows us to close this issue?

titanofold commented 4 years ago

Looks good to me. I think we'd be able to close it.