Dear folks,

I'm unsure if the following constitutes a bug or if it's due to my local configuration, so I mailed to openbsd-misc instead of openbsd-bugs:

I'm running a SPARCclassic (sparc platform) with OpenBSD 6.0-current (builddate: 1467664848) served diskless via NFS. To keep things easy I don't use different mount points for /usr, /var and others but only one for the whole FS plus an extra file for swap space.

The last OpenBSD version I tested with this machine was 5.8-stable. During bootup of the mentioned 6.0-current root FS I noticed a long delay accompanied by the new (compared to 5.8) message "reordering libraries: ". I first assumed this might be done for the first boot only (like creating SSH keys), so I rebooted the machine only to recognize that it's a persistent action. Searching for the mentioned string I found out it originates from the reorder_libs() function in `/etc/rc`.

From the comments in reorder_libs() I see that this is actually not intented to run if `/usr/lib` is on a NFS mounted file system - i.e. this shouldn't happen in my case. But it looks like the detection does not work as intended. The problem seems to be the first of the following lines (line 2 and following from reorder_libs() (see [1] for the whole `/etc/rc` file)):

```
local _dkdev=/dev/$(stat -L -f '%Sd' /usr/lib)
local _mp=$(mount | grep "^$_dkdev")

# Skip if /usr/lib is on a nfs mounted filesystem.
[[ $_mp == *' type nfs '* ]] && return
```

[1]: http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/etc/rc?rev=1.485&content-type=text/x-cvsweb-markup

Running the command substitution alone after the machine has finished booting - which takes a considerable extra amount of time as the SPARCclassic is a slow machine and its root FS is mounted via NFS - gives the following in my case:

```
# stat -L -f '%Sd' /usr/lib
??
# echo $?
0
```

The only mounted file systems are:

```
# mount
192.168.178.9:/srv/nfs/sc-1/root on / type nfs (v3, udp, rdirsize=4096, timeo=100, retrans=101) 192.168.178.9:/srv/nfs/openbsd/snapshots/1467664848/sparc/sc-1/swap on /swap type nfs (v3, udp, timeo=100, retrans=101)
```

So searching for "^/dev/??" in the output of `mount` doesn't succeed and the re-linking of the libraries is done anyhow. I'm not sure if the output of the `stat` command is due to my local configuration but came up with a different solution instead of the line mentioned above:

```
local _dkdev=$(df /usr/lib | tail -1 | cut -d ' ' -f 1)
```

This should give either the device (I cannot check this as I currently don't have a machine running OpenBSD from disk, but the first column should contain the device in this case AFAIK) or the NFS share where `/usr/lib` is located, although it now needs three commands/subshells. With the NFS share in the _dkdev variable the _mp variable will get the correct line from the output of `mount`, the check if `/usr/lib` is on a NFS mounted file system will succeed and the re-linking of the libs will be skipped as intended.

Best regards
Frank Scheiner

Reply via email to