package/dt-utils: add patch to fix barebox-state lock file
PATCH 1/1 package/dt-utils: add patch to fix barebox-state lock file
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 at pengutronix.de/msg00063.html
--- ...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
package/dt-utils/0001-state-use-run-to-store-lockfile.patch new file +50 -0
@@ -0,0 +1,50 @@ +From a3dfc81f886a40ebc624143cf64193ffa2619476 Mon Sep 17 00:00:00 2001 +From: Bartosz Bilas <[email protected]> +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 <[email protected]> +Signed-off-by: Bartosz Bilas <[email protected]> +--- + 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 <dt/dt.h> + #include <state.h> + ++#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 +
Signature · 1 line
2.30.1
PATCH 1/1 package/dt-utils: add patch to fix barebox-state lock file
Hi,
Quoted 10 lines · Bartosz Bilas
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 at pengutronix.de/msg00063.html
Mentioned patch is now part of 2021.03.0 release. I've sent patch
updating dt-utils to this version in
https://patchwork.ozlabs.org/project/buildroot/patch/20210510092853.1481441-1-m.niestroj at grinn-global.com/.
--
Regards,
Marcin
PATCH 1/1 package/dt-utils: add patch to fix barebox-state lock file
Hello,
Quoted 10 lines · Marcin Niestr?j
Hi,
Quoted 6 lines · Bartosz Bilas
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
Quoted 6 lines
Quoted 2 lines
[1] https://www.mail-archive.com/oss-tools at pengutronix.de/msg00063.html
Mentioned patch is now part of 2021.03.0 release. I've sent patch
updating dt-utils to this version in
https://patchwork.ozlabs.org/project/buildroot/patch/20210510092853.1481441-1-m.niestroj at grinn-global.com/.
In that case we can drop this. I will test your patch as soon as I get some device that can run barebox on it.
Best
Bartek
Quoted 4 lines
Signature · 3 lines
-- Regards, Marcin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20210511/25e3e8fa/attachment.html>