From: Thomas Petazzoni Date: Sat, 21 Sep 2019 23:14:15 +0200 Subject: [Buildroot] [PATCH 1/1] package/apache: atomic creation of pid file. In-Reply-To: <20190920150422.23409-1-nicolas.carrier@orolia.com> References: <20190920150422.23409-1-nicolas.carrier@orolia.com> Message-ID: <20190921231415.1c52a520@windsurf.home> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: buildroot@busybox.net On Fri, 20 Sep 2019 15:04:36 +0000 Nicolas Carrier wrote: > The original pattern for creating the pid file was: > open_create(pid_file) > write(pid_file, pid) > close(pid_file) > > But if a power outage occurs between open_create and write, the file will > be empty and httpd will refuse to start afterwards unless the corrupt pid > file is removed. > > This patch uses the pattern: > open_create(temp_pid_file) > write(temp_pid_file) > close(temp_pid_file) > rename(temp_pid_file, pid_file) > which is guaranteed to be atomic, provided that temp_pid_file and pid_file > are located in the same file system, which this patch does by creating > a temporary file name with the pattern: > pid_file_name + random_suffix > > This patch has been submitted upstream, but did receive no answer at all: > https://bz.apache.org/bugzilla/show_bug.cgi?id=63140 > > Signed-off-by: Nicolas Carrier We're not really fond of having patches like this that haven't been reviewed/blessed by upstream. But I see you submitted since months ago and got no feedback. > --- > package/apache/0003-corrupt-pid-file.patch | 51 ++++++++++++++++++++++ > 1 file changed, 51 insertions(+) > create mode 100644 package/apache/0003-corrupt-pid-file.patch > > diff --git a/package/apache/0003-corrupt-pid-file.patch b/package/apache/0003-corrupt-pid-file.patch > new file mode 100644 > index 0000000000..8208bc1ce5 > --- /dev/null > +++ b/package/apache/0003-corrupt-pid-file.patch > @@ -0,0 +1,51 @@ In any case, we need a description + Signed-off-by line in the patch itself, and since Apache is available in a Git repo (https://github.com/apache/httpd), we want the patch to be generated by git format-patch. Thanks! Thomas -- Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com