Re: svgalib build fail with portmaster

From: <se_at_freebsd.org>
Date: Wed, 20 Jul 2022 15:34:19 UTC
Am 20.07.22 um 14:05 schrieb Andy Farkas:
> 
> If I use portmaster to re-build all of my ports it fails at svgalib:

Yes, that port is unmaintained (MAINTAINER=ports@freebsd.org) and
*severely* broken.

I have just spent half an hour trying to identify where the breakage
originates, will look a bit more after writing this reply  ...

This is not an issue in portmaster, but portmaster detects it if you
use the -b option (or the equivalent setting in portmaster.rc).

The issue is that "make all" in the port directory deletes quite a
number of installed files from the system!

No port is allowed to install or remove files outside its work directory
or the TMPDIR (i.e. /tmp) during "make all" - but this port does just
that!

> %%%
> # portmaster -adf
> ...
> gmake[2]: Leaving directory 
> '/usr/ports/work/usr/ports/graphics/svgalib/work/svgalib-1.4.3/doc'
> 
> Now run 'make demoprogs' to make the test and demo programs in demos/ and 
> threedkit/.
> gmake[1]: Leaving directory 
> '/usr/ports/work/usr/ports/graphics/svgalib/work/svgalib-1.4.3'
> cd /usr/ports/work/usr/ports/graphics/svgalib/work/svgalib-1.4.3/include/linux 
> &&  install  -m 0644 keyboard.h kd.h 
> /usr/ports/work/usr/ports/graphics/svgalib/work/stage/usr/local/include/linux
> ====> Compressing man pages (compress-man)
> 
> ===>>> Creating a backup package for old version svgalib-1.4.3_7
> Creating package for svgalib-1.4.3_7
> pkg-static: file '/usr/local/bin/dumpreg' is missing
> pkg-static: package creation failed
> 
> ===>>> Package creation failed for svgalib-1.4.3_7!
> 
> ===>>> Ignore this error  [i]
> ===>>> Abort update       [a]
> ===>>> Retry              [r]
> 
> ===>>> How would you like to proceed? [i]
> %%%

You can just type "i" to ignore the failure to create a backup of the
old version before it is removed.

> But if I do it manually it works:
> 
> %%%
> root:~ # cd /usr/ports/graphics/svgalib/
> root:/usr/ports/graphics/svgalib # make clean ; make all ; make install

You must not install a port *update* without prior "make deinstall", and
BTW: its best to not chain multiple make commands with ";" in the way you
show them. Use either && to connect them, or just use multiple targets:

# make clean all deinstall install

> ...

If you had run "make deinstall here, you'd have got the following output:

# make deinstall
===>  Deinstalling for svgalib
===>   Deinstalling svgalib-1.4.3_7
Updating database digests format: 100%
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 1 packages (of 0 packages 
in the universe):

Installed packages to be REMOVED:
	svgalib: 1.4.3_7

Number of packages to be removed: 1

The operation will free 2 MiB.
[1/1] Deinstalling svgalib-1.4.3_7...
[1/1] Deleting files for svgalib-1.4.3_7:   0%
svgalib-1.4.3_7: missing file /usr/local/bin/dumpreg
[1/1] Deleting files for svgalib-1.4.3_7:   0%
svgalib-1.4.3_7: missing file /usr/local/bin/restorefont
[1/1] Deleting files for svgalib-1.4.3_7:   0%
svgalib-1.4.3_7: missing file /usr/local/bin/restorepalette
[1/1] Deleting files for svgalib-1.4.3_7:   1%
svgalib-1.4.3_7: missing file /usr/local/bin/restoretextmode
[1/1] Deleting files for svgalib-1.4.3_7:   1%
svgalib-1.4.3_7: missing file /usr/local/bin/savetextmode
[1/1] Deleting files for svgalib-1.4.3_7:   2%
svgalib-1.4.3_7: missing file /usr/local/bin/textmode
[1/1] Deleting files for svgalib-1.4.3_7:   4%
svgalib-1.4.3_7: missing file /usr/local/include/vga.h
[1/1] Deleting files for svgalib-1.4.3_7:   5%
svgalib-1.4.3_7: missing file /usr/local/include/vgagl.h
[1/1] Deleting files for svgalib-1.4.3_7:   5%
svgalib-1.4.3_7: missing file /usr/local/include/vgajoystick.h
[1/1] Deleting files for svgalib-1.4.3_7:   6%
svgalib-1.4.3_7: missing file /usr/local/include/vgakeyboard.h
[1/1] Deleting files for svgalib-1.4.3_7:   6%
svgalib-1.4.3_7: missing file /usr/local/include/vgamouse.h
[1/1] Deleting files for svgalib-1.4.3_7:   6%
svgalib-1.4.3_7: missing file /usr/local/lib/libvga.a
[1/1] Deleting files for svgalib-1.4.3_7:   7%
svgalib-1.4.3_7: missing file /usr/local/lib/libvga.so
[1/1] Deleting files for svgalib-1.4.3_7:   7%
svgalib-1.4.3_7: missing file /usr/local/lib/libvga.so.1
[1/1] Deleting files for svgalib-1.4.3_7:   7%
svgalib-1.4.3_7: missing file /usr/local/lib/libvgagl.a
[1/1] Deleting files for svgalib-1.4.3_7:   8%
svgalib-1.4.3_7: missing file /usr/local/lib/libvgagl.so
[1/1] Deleting files for svgalib-1.4.3_7:   8%
svgalib-1.4.3_7: missing file /usr/local/lib/libvgagl.so.1
[1/1] Deleting files for svgalib-1.4.3_7: 100%

All the files the port installs have been removed from /usr/local/bin and
/usr/local/lib by "make all". There is nothing left to delete (and nothing
to backup, and that's what portmaster is complaining about).

> ===>  Installing for svgalib-1.4.3_7
> ...
> ===>  Checking if svgalib is already installed
> ...
> ===>   Registering installation for svgalib-1.4.3_7
> ...
> Installing svgalib-1.4.3_7...
> ...
> ===>   NOTICE:
> The svgalib port currently does not have a maintainer. As a result, it is
> more likely to have unresolved issues, not be up-to-date, or even be removed in
> the future. To volunteer to maintain this port, please create an issue at:
> 
> https://bugs.freebsd.org/bugzilla
> 
> More information about port maintainership is available at:
> 
> https://docs.freebsd.org/en/articles/contributing/#ports-contributing
> 
> root@mater:/usr/ports/graphics/svgalib #
> %%%
> 
> 
> What am I doing wrong?

Well, trying to install and use svgalib might be considered wrong-doing in
this millenium ;-)

But no, you just detected this unacceptable behavior of the svgalib Makefile
(it is not an issue in the port, but in one of the Makefiles in the svgalib
sources).

I'll commit an update to the svgalib port when I succeed in locating the
line that issues the "rm -f" command that deletes those files.

I cn see "unlink" system calls being issued to remove them and I see the
PID of the rm command (or rather several invocations of "rm"), but I have
not identified from where these commands are run.

Regards, STefan