Bug 247562

Summary: dhclient: service script does not create missing piddir
Product: Base System Reporter: Walter von Entferndt <walter.von.entferndt>
Component: miscAssignee: freebsd-bugs (Nobody) <bugs>
Status: New ---    
Severity: Affects Many People CC: jbeich
Priority: --- Keywords: patch
Version: 12.1-RELEASE   
Hardware: Any   
OS: Any   
Description Flags
patch for /etc/rc.d/dhclient (FreeBSD-12.1-RELEASE) none

Description Walter von Entferndt 2020-06-26 13:15:45 UTC
Created attachment 215957 [details]
patch for /etc/rc.d/dhclient (FreeBSD-12.1-RELEASE)

I consider it good practice to have /var/run on a small tmpfs.  The side effect is that this is empty after every reboot.  The advantage is that this unveils bugs otherwise undetected.

Like some port's service scripts, dhclient's /etc/rc.d/dhclient does not check for the existence of it's piddir, and fails to work correctly if it does not exist.

Many users who run into this bug will create the missing directory manually and not report it...

1. since I encountered this kind of bug from time to time, I'd like to suggest to add to rc.subr the functionality to create $required_dirs and set $xxx_dir_mode and $xxx_dir_owner (should understand owner:group syntax).
2. /etc/rc should check /var on startup against the mtree file and create missing directories.

The patch appended is against 12.1-RELEASE, and was produced with "patch -U 7" from the root directory.