Skip to content

Instantly share code, notes, and snippets.

@jperkin
jperkin / pkg_add_nfs.md
Last active April 17, 2024 16:28
pkg_add issue with macOS NFS

Problem

pkgsrc builds on macOS have historically been significantly more unreliable than all other operating systems.

In my most recent builds there were over 400 instances of the error:

pkg_add: no pkg found for '<pkgname>', sorry.
@jperkin
jperkin / userland-dtrace-so.md
Created February 27, 2024 17:28
userland dtrace from shared library

Userland arguments work for functions from the main object, but not those in shared libraries.

An example from the main smbd program is ok:

$ dtrace -lvn 'pid$target:smbd:samba_cmdline_init:entry' -p 76224 
   ID   PROVIDER            MODULE                          FUNCTION NAME
96158   pid76224              smbd                samba_cmdline_init entry

        Probe Description Attributes
--- pkg_io.o ---
pkg_io.c:81:20: error: incomplete definition of type 'struct url'
if (strcasecmp(url->scheme, SCHEME_HTTP) == 0 ||
~~~^
./lib.h:342:8: note: forward declaration of 'struct url'
struct url *find_best_package(const char *, const char *, int);
^
pkg_io.c:82:20: error: incomplete definition of type 'struct url'
strcasecmp(url->scheme, SCHEME_FTP) == 0)
~~~^
botan-1.10.17nb2/install.log:ERROR: /opt/pkg/lib/libiconv.so.2: libiconv-1.17 is not a runtime dependency
botan-1.10.17nb2/install.log:ERROR: /opt/pkg/lib/libintl.so.8: gettext-lib-0.22.3 is not a runtime dependency
botan-2.19.3nb3/install.log:ERROR: /opt/pkg/lib/libiconv.so.2: libiconv-1.17 is not a runtime dependency
botan-2.19.3nb3/install.log:ERROR: /opt/pkg/lib/libintl.so.8: gettext-lib-0.22.3 is not a runtime dependency
botan3-3.2.0nb1/install.log:ERROR: /opt/pkg/lib/libiconv.so.2: libiconv-1.17 is not a runtime dependency
botan3-3.2.0nb1/install.log:ERROR: /opt/pkg/lib/libintl.so.8: gettext-lib-0.22.3 is not a runtime dependency
cgoban-1.9.14/install.log:ERROR: /opt/pkg/lib/libICE.so.6: libICE-1.1.1 is not a runtime dependency
cgoban-1.9.14/install.log:ERROR: /opt/pkg/lib/libSM.so.6: libSM-1.2.4 is not a runtime dependency
cmark-0.30.3nb1/install.log:ERROR: /opt/pkg/lib/libiconv.so.2: libiconv-1.17 is not a runtime dependency
cmark-0.30.3nb1/install.log:ERROR: /opt/pkg/lib/libintl.so.8: gettext-lib-0.2
Index: mk/buildlink3/bsd.buildlink3.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/buildlink3/bsd.buildlink3.mk,v
retrieving revision 1.261
diff -u -r1.261 bsd.buildlink3.mk
--- mk/buildlink3/bsd.buildlink3.mk 27 Jun 2023 10:40:09 -0000 1.261
+++ mk/buildlink3/bsd.buildlink3.mk 20 Nov 2023 13:02:42 -0000
@@ -226,9 +226,41 @@
. endfor
.endfor

Before:

$ bmake _check-shlibs                                                                                                         
=> Checking for missing run-time search paths in nodejs-21.2.0                                                                 
$

This is wrong. node is linked against gettext-lib and iconv, neither of which are deps, but are pulled in implicitly by others.

#!/bin/sh
#
# Look for any known-to-hang processes that have been running for longer than
# 2 hours, these are not caught by the ulimit -t set by pbulk as they are not
# using any CPU time.
#
# Run from cron and redirect output to a log
#
if [ "$1" = "-n" ]; then

Original file with CTF:

$ ls -l test.ctf
-rwxr-xr-x   1 root     root       13128 Oct  3 14:16 test.ctf
$ dtrace -lvn 'pid$target:a.out:foo:entry' -c ./test.ctf
diff --git a/tools/codemap.mjs b/tools/codemap.mjs
index 985e721c34..1e1d2c55f8 100644
--- a/tools/codemap.mjs
+++ b/tools/codemap.mjs
@@ -67,7 +67,8 @@ export class CodeMap {
constructor(useBigInt=false) {
this.useBigInt = useBigInt;
- this.kPageSize = useBigInt ? BigInt(kPageSize) : kPageSize;
+ this.parseAddr = useBigInt ? BigInt : parseInt;
@jperkin
jperkin / README.md
Created September 8, 2023 11:09
pkg_admin check fixes

The current implementation of pkg_admin check has a few issues:

  • It always exits 0 regardless of whether there were errors
  • Errors are printed to stdout
  • By default progress dots are printed, making the output rather unreadable.
  • Even in quiet mode (-q) it prints a summary at the end.

Example: