From patchwork Wed Feb 17 18:56:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Bilas X-Patchwork-Id: 1441312 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dgn9y3vljz9sRN for ; Thu, 18 Feb 2021 05:56:22 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 1BC22870EB; Wed, 17 Feb 2021 18:56:20 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5m+q3IJP3ycl; Wed, 17 Feb 2021 18:56:19 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 7892F870FB; Wed, 17 Feb 2021 18:56:19 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 50D3E1BF40B for ; Wed, 17 Feb 2021 18:56:17 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 4DA11870FB for ; Wed, 17 Feb 2021 18:56:17 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xvo-UAfWvleF for ; Wed, 17 Feb 2021 18:56:15 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from smtp2.megiteam.pl (smtp2.megiteam.pl [213.189.52.193]) by hemlock.osuosl.org (Postfix) with ESMTPS id 30A40870EB for ; Wed, 17 Feb 2021 18:56:15 +0000 (UTC) Received: from host-81-161-203-250.oxylion.net.pl ([81.161.203.250] helo=bartekk-pc.lan) by smtp.megiteam.pl with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86.2_XX) (envelope-from ) id 1lCRzg-00045l-7h; Wed, 17 Feb 2021 19:56:12 +0100 From: Bartosz Bilas To: buildroot@buildroot.org Date: Wed, 17 Feb 2021 19:56:09 +0100 Message-Id: <20210217185609.1120677-1-b.bilas@grinn-global.com> X-Mailer: git-send-email 2.30.1 MIME-Version: 1.0 Subject: [Buildroot] [PATCH] package/dt-utils: add patch to fix barebox-state lock file X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Bilas Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Add patch from the upstream mailing list [1] that fixes the following error when we try to execute barebox-state command: # barebox-state Failed to open lock-file /var/lock/barebox-state [1] https://www.mail-archive.com/oss-tools@pengutronix.de/msg00063.html Signed-off-by: Bartosz Bilas --- ...0001-state-use-run-to-store-lockfile.patch | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 package/dt-utils/0001-state-use-run-to-store-lockfile.patch diff --git a/package/dt-utils/0001-state-use-run-to-store-lockfile.patch b/package/dt-utils/0001-state-use-run-to-store-lockfile.patch new file mode 100644 index 0000000000..a0b8067601 --- /dev/null +++ b/package/dt-utils/0001-state-use-run-to-store-lockfile.patch @@ -0,0 +1,50 @@ +From a3dfc81f886a40ebc624143cf64193ffa2619476 Mon Sep 17 00:00:00 2001 +From: Bartosz Bilas +Date: Wed, 17 Feb 2021 19:29:47 +0100 +Subject: [PATCH] state: use /run to store lockfile + +The current location /var/lock is considered legacy (at least by +systemd). Just use /run to store the lockfile and append the usual .lock +suffix. + +Signed-off-by: Stefan Agner +Signed-off-by: Bartosz Bilas +--- + src/barebox-state.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/src/barebox-state.c b/src/barebox-state.c +index f8b8df6..5c05c5b 100644 +--- a/src/barebox-state.c ++++ b/src/barebox-state.c +@@ -38,6 +38,8 @@ + #include
+ #include + ++#define BAREBOX_STATE_LOCKFILE "/run/barebox-state.lock" ++ + struct state_variable; + + static int __state_uint8_set(struct state_variable *var, const char *val); +@@ -501,15 +503,15 @@ int main(int argc, char *argv[]) + ++nr_states; + } + +- lock_fd = open("/var/lock/barebox-state", O_CREAT | O_RDWR, 0600); ++ lock_fd = open(BAREBOX_STATE_LOCKFILE, O_CREAT | O_RDWR, 0600); + if (lock_fd < 0) { +- pr_err("Failed to open lock-file /var/lock/barebox-state\n"); ++ pr_err("Failed to open lock-file " BAREBOX_STATE_LOCKFILE "\n"); + exit(1); + } + + ret = flock(lock_fd, LOCK_EX); + if (ret < 0) { +- pr_err("Failed to lock /var/lock/barebox-state: %m\n"); ++ pr_err("Failed to lock " BAREBOX_STATE_LOCKFILE ": %m\n"); + close(lock_fd); + exit(1); + } +-- +2.30.1 +