security/nss build failure under poudriere, "symlink creation race", head -r363590 FreeBSD and head -r543636 ports

Mark Millard marklmi at yahoo.com
Thu Jul 30 05:05:48 UTC 2020


While building ports for a cortexA53 (aarch64) on a cortexA57
system via poudriere-devel use I got:

gmake[5]: Leaving directory '/wrkdirs/usr/ports/security/nss/work/nss-3.55/nss/lib/ckfw/builtins'
gmake[4]: *** [../../coreconf/rules.mk:387: ../../../dist/public/nss/nssckmdt.h] Abort trap (core dumped)
gmake[4]: *** Deleting file '../../../dist/public/nss/nssckmdt.h'

gdb reports that:

Core was generated by `../../coreconf/nsinstall/FreeBSD13.0_OPT.OBJ/nsinstall -R -m 444 nssckmdt.h ../.'

(gdb) bt
#0  thr_kill () at thr_kill.S:4
#1  0x00000000404adc70 in __raise (s=6) at /usr/src/lib/libc/gen/raise.c:52
#2  0x0000000040428a74 in abort () at /usr/src/lib/libc/stdlib/abort.c:67
#3  0x0000000000212a50 in fail (format=<optimized out>) at pathsub.c:53
#4  0x0000000000212438 in main (argc=<optimized out>, argv=<optimized out>) at nsinstall.c:330

(gdb) up 4
#4  0x0000000000212438 in main (argc=<optimized out>, argv=<optimized out>) at nsinstall.c:330
330	                    fail("symlink was attempted in working directory %s "
(gdb) list
325			exists = 0;
326		    }
327		    if (!exists && symlink(name, toname) < 0) {
328			if (errno == EEXIST) {
329			    fprintf(stderr, "symlink creation race: %s\n", toname);
330	                    fail("symlink was attempted in working directory %s "
331	                         "from %s to %s.\n", cwd, name, toname);
332			    goto retry;
333			}
334			diagnosePath(toname);

(gdb) print cwd
$1 = 0x40a18000 "/wrkdirs/usr/ports/security/nss/work/nss-3.55/nss/lib/ckfw"
(gdb) print name
$2 = 0x40a18800 "../../../nss/lib/ckfw/nssckmdt.h"
(gdb) print toname
$3 = 0x40a1b000 "/wrkdirs/usr/ports/security/nss/work/nss-3.55/dist/public/nss/nssckmdt.h"

More specifically the code (with more context) is:

retry:
        exists = (lstat(toname, &tosb) == 0);
. . .
            /* Check for a pre-existing symlink with identical content. */
            if (exists &&
                (!S_ISLNK(tosb.st_mode) ||
                 readlink(toname, buf, sizeof buf) != len ||
                 strncmp(buf, name, len) != 0)) {
                int rmrv;
                rmrv = (S_ISDIR(tosb.st_mode) ? rmdir : unlink)(toname);
                if (rmrv < 0) {
                    fail("destination exists, cannot remove %s", toname);
                }
                exists = 0;
            }
            if (!exists && symlink(name, toname) < 0) {
                if (errno == EEXIST) {
                    fprintf(stderr, "symlink creation race: %s\n", toname);
                    fail("symlink was attempted in working directory %s "
                         "from %s to %s.\n", cwd, name, toname);
                    goto retry;
                }
                diagnosePath(toname);
                fail("cannot make symbolic link %s", toname);
            }
. . .

The "goto retry" is odd given the "fail" use and:

void
fail(char *format, ...)
{
. . .
    abort();
    exit(1);
}



The poudriere bulk is still going, building other things.
So it will be some time before I find out if this repeats
for the next bulk run.

===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)



More information about the freebsd-ports mailing list