From: "Mike Frysinger" <vapier@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/build-docbook-catalog:master commit in: /
Date: Sun, 3 Oct 2021 04:01:07 +0000 (UTC) [thread overview]
Message-ID: <1633225385.6f6354f622ef92418cfd3f111064c37d4a6cd6c9.vapier@gentoo> (raw)
commit: 6f6354f622ef92418cfd3f111064c37d4a6cd6c9
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 3 01:43:05 2021 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sun Oct 3 01:43:05 2021 +0000
URL: https://gitweb.gentoo.org/proj/build-docbook-catalog.git/commit/?id=6f6354f6
switch locking to flock
If the tool gets killed while holding its lock, the files stay locked,
and future runs hang waiting for the lock, until a dev manually clears
things. Switch to flock as it provides a process-based lock and the
kernel will release it automatically when we exit.
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
build-docbook-catalog | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/build-docbook-catalog b/build-docbook-catalog
index b815bfc..b4d7223 100755
--- a/build-docbook-catalog
+++ b/build-docbook-catalog
@@ -69,14 +69,11 @@ main() {
mkdir -p "${ROOT}${ROOTCONFDIR}" || error "could not create ${ROOTCONFDIR}"
fi
- local lock="${ROOT}${ROOTCONFDIR}"/build-docbook-catalog-lock
+ local lock="${ROOT}/run/lock/build-docbook-catalog.lock"
(
# Lock the dir to avoid trashing other runs that might
# be running parallel.
- touch "${lock}".$$ && \
- until ln "${lock}".$$ "${lock}" 2>/dev/null; do sleep 1; done && \
- rm "${lock}".$$
- [[ -f ${lock}.$$ ]] && error "unable to lock ${ROOTCONFDIR}"
+ flock 200
create_catalogs # will exit on error
for type in xsl xsl-ns xsl-saxon xsl-xalan; do
@@ -98,8 +95,9 @@ main() {
populate_entities
fi
- )
- rm "${lock}"
+ # NB: Don't delete the lock since we can't delete files by fd, and if we do
+ # it by path, we might delete the lock while other processes grab it.
+ ) 200>>"${lock}"
exit 0
}
next reply other threads:[~2021-10-03 4:01 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-03 4:01 Mike Frysinger [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-04-25 3:43 [gentoo-commits] proj/build-docbook-catalog:master commit in: / Sam James
2023-04-25 3:43 Sam James
2022-01-27 20:28 Sam James
2022-01-17 23:13 Andreas K. Hüttel
2021-10-08 12:22 Mike Frysinger
2021-10-05 1:14 Mike Frysinger
2021-10-05 1:14 Mike Frysinger
2021-10-03 4:01 Mike Frysinger
2021-10-03 4:01 Mike Frysinger
2021-10-03 4:01 Mike Frysinger
2021-10-03 4:01 Mike Frysinger
2021-10-03 4:01 Mike Frysinger
2021-10-03 4:01 Mike Frysinger
2021-10-02 6:20 Mike Frysinger
2021-10-02 6:20 Mike Frysinger
2021-10-02 6:17 Mike Frysinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1633225385.6f6354f622ef92418cfd3f111064c37d4a6cd6c9.vapier@gentoo \
--to=vapier@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox