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

Unexpected swaks --help failure behaviour when perl-doc is missing #106

Open
polarathene opened this issue Dec 5, 2024 · 2 comments
Open

Comments

@polarathene
Copy link

Running the command seems to output the source for /usr/local/bin/swaks (where it was installed):

$ swaks --help

#!/usr/bin/env perl

# use 'swaks --help' to view documentation for this program
#
#      Homepage: http://jetmore.org/john/code/swaks/
#   Online Docs: http://jetmore.org/john/code/swaks/latest/doc/ref.txt
#                http://jetmore.org/john/code/swaks/faq.html
# Announce List: send mail to updates-swaks@jetmore.net
#   Project RSS: http://jetmore.org/john/blog/c/swaks/feed/
#       Twitter: http://www.twitter.com/SwaksSMTP

use strict;
use Pod::Usage;
use File::Spec::Functions qw(splitdir);

binmode(STDOUT);
binmode(STDERR);

$|            = 1;
my($p_name)   = (splitdir($0))[-1] =~ m|^(.+?)(\.pl)?$|;
my $p_version = build_version("20240103.0", '$Id$');
my $p_usage   = "Usage: $p_name [--help|--version] (see --help for details)";
my $p_cp      = <<'EOM';

After exiting the pager output of that perl source code for swaks, it'll output the more helpful message:

You need to install the perl-doc package to use this program.

I don't know Perl but I assume this behaviour is triggered here?:

swaks/swaks

Lines 44 to 47 in 8a05259

# before we do anything else, check for --help and --version
if (get_arg('help', \%O)) {
pod2usage(-verbose => 2, -exit => 0);
}

Perhaps you can avoid the failure scenario with displaying source code, so that only the message regarding perl-doc or similar is output?

@jetmore
Copy link
Owner

jetmore commented Dec 6, 2024

I came here to say this sounds like a bug with the docker-mailserver packaging, but it looks like you handled that already. I agree that this could be made nicer, thanks for reporting

@polarathene
Copy link
Author

but it looks like you handled that already. I agree that this could be made nicer, thanks for reporting

Yes, we get most of the perl packages for swaks implicitly via other software like Postfix IIRC. It was only yesterday I had the docker-mailserver container running and I needed to check something with swaks and tried --help for the first time 😅

So I resolved that issue and thought the swaks --help UX could be improved, as that was a little jarring to encounter 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants