* [Buildroot] [PATCH] package/dt-utils: add patch to fix barebox-state lock file
@ 2021-02-17 18:56 Bartosz Bilas
2021-05-10 9:51 ` Marcin Niestrój
0 siblings, 1 reply; 3+ messages in thread
From: Bartosz Bilas @ 2021-02-17 18:56 UTC (permalink / raw)
To: 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 at pengutronix.de/msg00063.html
Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
---
...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 <b.bilas@grinn-global.com>
+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 <ste...@agner.ch>
+Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
+---
+ 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
+
--
2.30.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Buildroot] [PATCH] package/dt-utils: add patch to fix barebox-state lock file
2021-02-17 18:56 [Buildroot] [PATCH] package/dt-utils: add patch to fix barebox-state lock file Bartosz Bilas
@ 2021-05-10 9:51 ` Marcin Niestrój
2021-05-11 11:30 ` Bartosz Bilas
0 siblings, 1 reply; 3+ messages in thread
From: Marcin Niestrój @ 2021-05-10 9:51 UTC (permalink / raw)
To: buildroot
Hi,
Bartosz Bilas <b.bilas@grinn-global.com> writes:
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Buildroot] [PATCH] package/dt-utils: add patch to fix barebox-state lock file
2021-05-10 9:51 ` Marcin Niestrój
@ 2021-05-11 11:30 ` Bartosz Bilas
0 siblings, 0 replies; 3+ messages in thread
From: Bartosz Bilas @ 2021-05-11 11:30 UTC (permalink / raw)
To: buildroot
Hello,
On 10.05.2021 11:51, Marcin Niestr?j wrote:
> Hi,
>
> Bartosz Bilas <b.bilas@grinn-global.com> writes:
>
>> 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/.
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
>
> --
> Regards,
> Marcin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20210511/25e3e8fa/attachment.html>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-05-11 11:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-17 18:56 [Buildroot] [PATCH] package/dt-utils: add patch to fix barebox-state lock file Bartosz Bilas
2021-05-10 9:51 ` Marcin Niestrój
2021-05-11 11:30 ` Bartosz Bilas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox