Bug 247562 - dhclient: service script does not create missing piddir
Summary: dhclient: service script does not create missing piddir
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 12.1-RELEASE
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-bugs (Nobody)
Keywords: patch
Depends on:
Reported: 2020-06-26 13:15 UTC by Walter von Entferndt
Modified: 2020-11-08 18:03 UTC (History)
1 user (show)

See Also:

patch for /etc/rc.d/dhclient (FreeBSD-12.1-RELEASE) (1001 bytes, patch)
2020-06-26 13:15 UTC, Walter von Entferndt
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.