SBOPKGLINT(1)

NAME
sbopkglint - check Slackware binary packages for common errrors.

SYNOPSIS
sbopkglint [-k] [-i] [-s] [-c | --color] [-m | --mono] [package.t?z ...]

DESCRIPTION
sbopkglint installs a Slackware package to a temporary directory, then examines the contents. It finds lots of common problems that aren't always noticed by SBo script maintainers or the admins.

This is for built packages. If you want to lint your build scripts, use sbolint(1) instead.

With no package arguments, it looks for a SlackBuild in the current directory, extracts the PRINT_PACKAGE_NAME information, and tries to find a package in $OUTPUT (/tmp by default). If found, it checks that package. It's up to you to know whether the package needs to be rebuilt (e.g. if you've edited the SlackBuild since the package was built).

With arguments, it checks the given packages. These must be supported Slackware package files (.tgz, .txz, .tlz, etc). There's no requirement that these have to be SBo packages, but a couple of the tests (e.g. the check for $PRGNAM.SlackBuild in the doc dir) might not apply to non-SBo builds.

Diagnostics will be logged to stdout and stderr. Exit status will be 0 if all tests passed, non-zero otherwise.

This script must run as root. If you run it as a normal user, it tries to re-execute itself via sudo(8) before installing any packages. If you dislike sudo, you can always run it as root.

Note that sbopkglint is intended to help you, not control you. If your build fails the tests, and you're 100% sure it's correct, please contact the maintainer (urchlay@slackware.uk) and explain the situation. Most likely, sbopkglint will be modified to accomodate your code, unless something really is wrong with it.

OPTIONS
Bundling options is supported, e.g. -ki is the same as -k -i.

-k, --keep
    Keep the temporary package install directory instead of deleting it on exit.

-i, --install-ok
    Disable the "useless-looking install instructions" test. This is intended for SBo admins mass-linting a ton of packages. INSTALL in the doc dir is something that exists in thousands of existing builds, and it's not a major problem. New builds and updates should be linted without this option, however.

-s, --slackbuild-missing-ok
    Disable the check for /usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild. For use with non-SBo packages (including core Slackware packages).

-c, --color
    Colorize the output (green OK, red FAILED, etc). Default is to use color only when stdout is a terminal.

-m, --mono
    Do not colorize the output, even if stdout is a terminal.

--doc, --help
    View this documentation using perldoc(1), which generally uses your pager (e.g. less(1) or more(1)) to display it.

--man
    Convert this documentation to a man page, on stdout.

-v, --version
    Print the sbopkglint version number on stdout and exit.

EXIT STATUS
0 (success) if all tests passed for all packages, non-zero if there were any test failures (or if installpkg failed for some reason).

FILES

sbolint.d/*.t.sh
    These are the actual tests. They're installed to PREFIX/share/sbo-maintainer-tools, and they're sourced by sbopkglint at runtime. Each test script begins with (hopefully) useful comments that go into more detail than the documentation here.

TESTS

  pre-doinst
This test is done before doinst.sh is run, unlike the rest of the tests. It checks for the existence of various files that should not be in the package, but are OK if generated by doinst.sh, e.g. /usr/info/dir. It also checks for the existence of symlinks in the package (these also must be created by doinst.sh, not included in the package archive).

  basic-sanity

-   Top-level directories inside the package must be recognized ones, such as /bin /etc /usr /opt. Packages shouldn't be installing files in /tmp, /dev, or /home... and they really shouldn't be inventing new top-level directories.

-   The documentation directory must exist and be correctly named, as /usr/doc/$PRGNAM-$VERSION.

-   The documentation directory must contain $PRGNAM.SlackBuild. This check can be disabled with the -s option.

-   The directories /usr/local, /usr/share/doc, /usr/share/man, /usr/etc are not allowed in SBo packages.

-   Some directories (e.g. /usr/bin) may not contain subdirectories.

-   Some directories (e.g. /usr/share) must *only* contain subdirectories.

-   All files in /bin, /usr/bin, /sbin, /usr/sbin must be executable (have at least one +x bit set).

-   Some directories (e.g. /usr/man, /usr/share/applications) must not contain files with executable permissions. /usr/doc is not in this list; neither is /etc (too many existing packages install +x files there).

-   Broken symlinks may not exist.

-   Absolute symlinks may not exist (they should be converted to relative symlinks). This may seem like nitpicking, but packages may be installed somewhere besides / (the root dir) with the -root option to installpkg. If /usr/bin/foo is a link to /usr/bin/bar, it should be a link to just bar.

  docs

-   Documentation must be installed to /usr/doc/$PRGNAM-$VERSION. If there's any other directory under /usr/doc, it's incorrect. Some builds use mis-named doc directories (if it hasn't been fixed by now, an example is gcc5, which installs docs to /usr/doc/gcc-$VERSION when it should be gcc5-$VERSION).

-   Documentation files must be readable by everyone, and owned by root:root.

-   Doc dir shouldn't contain empty files (0 bytes in length).

-   Doc dir shouldn't contain install instructions. Specifically, files named INSTALL, INSTALL.*, or install.txt are flagged (it's impossible to make this test 100% perfect). This check can be disabled with the -i option.

-   Any *.pdf files found in the doc dir are checked with pdfinfo to make sure they really are PDF files, and not corrupt/damaged.

  noarch

-   If a package has its architecture set to "noarch", it must not contain any ELF binaries/libraries.

  arch

-   If a package has its architecture set to i?86 or x86_64, all ELF binaries/libraries must be for the correct arch (no 32-bit code in 64-bit packages, and vice versa).

-   If a package is i?86, it must not contain /usr/lib64.

-   If a package is x86_64 and contains shared libraries, they must be in /lib64 or /usr/lib64 (not /lib or /usr/lib).

  lafiles

-   Packages are no longer allowed to contain libtool archive files (.la) in /lib, /lib64, /usr/lib, or /usr/lib64. However, subdirectories such as /usr/lib64/someprogram/ are not checked, since some applications which use plugins actually use the .la files.

  manpages

-   All man pages must be readable by everyone, and owned by root:root.

-   All man pages must be gzipped.

-   All man pages must be in /usr/man/man[1-9n] or /usr/man/<lang>/man[1-9n].

-   Man page directories must be mode 755, owned by root:root.

-   The section numbers in man page filenames must match the section number in the directory name (e.g. /usr/man/man1/ls.1.gz is OK, /usr/man/man1/tetris.6.gz is an error).

-   Man pages must actually be man pages (troff markup).

  desktop

-   If there are .desktop files, doinst.sh must run update-desktop-database.

-   .desktop files must be mode 644, owned by root:root. Slackware's KDE packages actually break this rule (they install executable .desktop files), but SBo packages are not allowed to.

-   Only .desktop files are allowed in /usr/share/applications.

-   .desktop files must be valid, according to the desktop-file-validate command. Only actual errors count; warnings don't cause this test to fail.

  newconfig

-   Any files (outside of /usr/doc) with names ending in .new are flagged. This might be a bit too restrictive (possibly only check /etc and /usr/share?)

  doinst

-   If there are icons in /usr/share/icons, .desktop files in /usr/share/applications, or glib2 schemas in /usr/share/glib-2.0/schemas, there must be a doinst.sh with appropriate command(s), e.g. update-desktop-database, gtk-update-icon-cache, glib-compile-schemas.

  icons

-   Files in /usr/share/pixmaps and /usr/share/icons/hicolor must be known image file types (PNG, SVG, JPEG, etc). Their filename extensions must match the image type (e.g. file.png must actually be a PNG and not some other MIME type).

-   Image files in /usr/share/icons/hicolor/<size>x<size>/* must actually be the correct pixel size.

  usr_info

-   Files in /usr/info must be valid GNU TexInfo files. Normally these are gzipped; non-gzipped files will be noted, but some packages require .info files to be uncompressed because they e.g. display them in a GUI (so this is not an error).

-   If there are info files, there must be a doinst.sh which uses install-info to add them to /usr/info/dir.

-   Ideally, there should also be a douninst.sh which recreates /usr/info/dir after the package's .info files are removed. Since douninst.sh is still pretty new (first introduced with Slackware 15.0), and since we have thousands of builds with .info files that don't use it, this isn't an error. Lack of douninst.sh will be noted.

  python

-   If a Python module is installed under the name UNKNOWN (e.g. /usr/lib64/python3.9/site-packages/UNKNOWN-1.2.3/), that module was built incorrectly and is non-functional, so it'll be flagged as an error.

  tmp_path

-   No file in the package may have $TMP/package-* included in the file. This includes both text and binary files.

    For this check to work properly, the TMP environment variable used to build the package should also be set when running sbopkglint. If you didn't set TMP, the default is /tmp/SBo, which is the same as the default TMP in all SBo SlackBuild scripts.

  static_libs
If there are static libraries in /usr/lib or /usr/lib64:

-   *.a files are checked to make sure they really are static libraries.

-   Permissions must be 0644 or 044, owner root:root.

-   If a libfoo.a file has a corresponding libfoo.so, a note is printed, suggesting removal of the .a file. This is not an error, just food for thought.

BUGS
Probably many. This is still a work in progress.

One known problem is that the same file can fail multiple tests. E.g. if you have a man page that's installed executable, it will fail both the basic-sanity test and the manpages test. This isn't really a huge problem, so it might not be fixed any time soon.

AUTHOR
B. Watson <urchlay@slackware.uk>, aka Urchlay on Libera IRC.

SEE ALSO
sbolint(1), sbodl, sbofixinfo(1), sbopkg(8), sboinstall(1)