cowsay-org / cowsay

apjanke's fork of the classic cowsay project
http://cowsay.diamonds
GNU General Public License v3.0
83 stars 15 forks source link

Roughness around new `make install` and empty dirs #50

Closed apjanke closed 2 months ago

apjanke commented 2 months ago

Noticed a couple rough edges since merging #26:

cowsay -l uninitialized value

[~] $ cowsay --version
/usr/local/bin/cowsay version 3.8.3-SNAPSHOT calling Getopt::Std::getopts (version 1.13),
running under Perl version 5.38.2.
[~] $ cowsay -l
Listing cowfiles in pretty format
Cow files in /usr/local/share/cowsay/site-cows:
Use of uninitialized value $tail in join or string at /usr/local/opt/perl/lib/perl5/5.38/Text/Wrap.pm line 34.

Cow files in /usr/local/share/cowsay/cows:
alpaca beavis.zen blowfish bong bud-frogs bunny cheese cower cupcake daemon

I think that's because now the site-cows directory exists, but has no *.(cow|pm) files in it, and the list_cowfiles_pretty() code is not correctly handling the empty-list case.

"<prefix>/share/cowsay not a directory" in make uninstall

If I do a make install then make uninstall:

rm -f /usr/local/share/cowsay/cows/www.cow
rmdir /usr/local/share/cowsay/site-cows
rmdir /usr/local/etc/cowsay/cowpath.d
rmdir /usr/local/share/cowsay/cows
rmdir /usr/local/share/cowsay
rmdir: /usr/local/share/cowsay: Not a directory
rmdir /usr/local/etc/cowsay
[cowsay] $

That looks like a problem with our Homebrew cowsay-org formula packaging. That /usr/local/share/cowsay is a symlink on my Homebrew-managed system, not a directory. Looks like a leftover from an old brew-driven installation.

[cowsay] $ ls -l /usr/local/share/cowsay
lrwxr-xr-x  1 janke  admin  39 Aug 20 08:59 /usr/local/share/cowsay -> ../Cellar/cowsay-org/3.8.2/share/cowsay
[cowsay] $

Not sure what sequence of events led to that. I'm guessing it's because I did a make install from source while there was a brewed installation already present. Maybe we should detect that, and have make install bail if there are file collisions?

Says "Listing cowfiles in pretty format" in cowsay -l

[cowsay] $ cowsay -l
Listing cowfiles in pretty format
Cow files in /usr/local/share/cowsay/site-cows:

That "Listing cowfiles in pretty format" looks like debugging output that probably shouldn't be there.

apjanke commented 2 months ago

Yeah, that "Listing cowfiles in pretty format" was just some debugging output I forgot to remove. Removed in https://github.com/cowsay-org/cowsay/commit/9f630c455654d5d8aa89187ab671422e429d48d8.

apjanke commented 2 months ago

Fixed the "uninitialized value" error for empty cowdirs in https://github.com/cowsay-org/cowsay/commit/225cc792dc098346234c590f302b2f80372f8ac3.

apjanke commented 2 months ago

Yeah, looks like that '"/share/cowsay not a directory" in make uninstall' was just due to a broken brewed cowsay-org installation that didn't get uninstalled cleanly. Nothing to do here, I think. (I don't think it's right for our make uninstall to remove symlinks or other custom installation things that it didn't set up in the first place, so not going to add handling for it in the Makefile.)

That's it for this ticket. Closing as Fixed. Fixes will go out in 3.8.3.