ice-wm / icewm

IceWM releases only, see Wiki
https://github.com/ice-wm/icewm/releases
Other
289 stars 16 forks source link

OpenBSD: icewm -i list doesn't work by default because of tar implementation #179

Open exceptbees opened 2 days ago

exceptbees commented 2 days ago

OpenBSD tar(1) strips off the trailing slash from directory names when listing archive contents, see more on that in the mailing list and the system's tar.c.

Compare:

$ lzip -cd icewm-extra.tar.lz | tar -tf - | head -1 
icewm-extra/18k

vs.

$ lzip -cd icewm-extra.tar.lz | gtar -tf - | head -1
icewm-extra/18k/

So icewm -i list only shows the list of themes if gtaris installed and exits silently if it's not. Would be nice to have it work with the platform's default tar.

P.S. Tested the archive with NetBSD's tar(1), and it does display trailing slashes in directory names. Don't have a FreeBSD system, so can't check.

gijsbers commented 2 days ago

Yes. The function get_tar() in icewm/src/theminst.cc first looks for gtar on BSDs. Wasn't that installed on your OpenBSD? If it was, it should have worked, no?

exceptbees commented 2 days ago

gtar is not installed on OpenBSD by default, while tar is part of the system, so it doesn't work unless I explicitly intall gtar.

The man page only says that the option

requires the presence of the lzip, tar and wget or curl commands.

And as I undertand from the code, it was intended to work even with BSD's tar, because function get_tar()falls back to tar when it doesn't find gtar.

However, the while cicle in lines 165-175 relies on trailing slashes in the output of tar -tf - to find themes' names. OpenBSD's tar strips those slashes off, which makes icewm -i list print nothing.

Again, this is specific to how tar works on OpenBSD. NetBSD's one works fine.

exceptbees commented 1 day ago

Thanks for the fix!

I've built icewm 3.6.0 applying the patch from the commit above. It now works with OpenBSD's tar, with a minor difference in the output.

When tar is used, the list is a column with extra spaces and an extra newline after the last theme:

$ icewm -i list  
18k            
 708090     
 Aalglatt  
 Anon       
[...snip...]
 yak
 yamm
 yellowmotif

$

With gtar installed, it's all in one row:

$ icewm -i list   
18k 708090 Aalglatt Anon Arc-Dark Area51 BerryXP BlueObscure Chicago CoolSteel Crux-Teal ElbergBlue ElbergGreen ElbergRed Flames95 FrostyG GlamICE IceBlueCurve IceBlueOkayish IceCrack2 IceGnome2 K-ath-Leen LightBox Natural No.15 OpenLook-shaped SilverXP SkyBox Slashdot Urbicande WhistlerX Wigren XPBlue XPSilver aesthetech aesthetech-big aeteria aquablue axxlite blueCrux blueHeart bluePlastic bluemetal2 daniel3 daniel4 daniel5 device dotFLAT dusk easy fake95 faux95 gnomeish gradient1 green gtk2 jaywalk jim-mac kaos kde2 liQuid mavvert metal metal-big metal-small mozmodern nice nice2 paranoia pkde pkde2 shiceMavvert slashdot small sortofaqua spiffICE tile tin tubes twilite unusualscars warp3 warp3x warp4 win95-dark xp xp-new yak yamm yellowmotif