Skip to contentSkip to conversation

run-postinsts: use 'flock --fcntl' instead of separate fcntl-lock binary

PATCH New Rasmus Villemoes 1 participant 2 messages Sep 15, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 run-postinsts: use 'flock --fcntl' instead of separate fcntl-lock binary

From: Rasmus Villemoes <[email protected]>

Since v2.41, util-linux flock has understood the --fcntl option, making it use fcntl(F_OFD_SETLK[W]) instead of flock().

---
 meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts | 2 +-
 meta/recipes-devtools/run-postinsts/run-postinsts_1.0.bb        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts +1 -1
index 1f3e692029..a94a769b59 100755
@@ -81,7 +81,7 @@ remove_rcsd_link=1
 if $pm_installed; then
 	case $pm in
 		"ipk")
-			if ! `fcntl-lock --wait 30 /run/opkg.lock true`; then
+			if ! `flock --fcntl --wait 30 /run/opkg.lock true`; then
 				eval echo "Unable to obtain the opkg lock, deadlock?" $append_log
 			fi
 			if ! eval "opkg configure $append_log"; then
meta/recipes-devtools/run-postinsts/run-postinsts_1.0.bb +1 -1
index 5486f89ae7..f581ff3636 100644
@@ -12,7 +12,7 @@ S = "${UNPACKDIR}"
 
 inherit allarch systemd update-rc.d
 
-RDEPENDS:${PN} = "util-linux-fcntl-lock"
+RDEPENDS:${PN} = "util-linux-flock"
 
 INITSCRIPT_NAME = "run-postinsts"
 INITSCRIPT_PARAMS = "start 99 S ."
Signature · 1 line
2.51.0
#1 lore raw

PATCH 2/2 util-linux: remove fcntl-lock

From: Rasmus Villemoes <[email protected]>

Since upstream util-linux's flock command now supports the --fcntl flag, there is no longer any reason to keep building the separate fcntl-lock binary.

---
 meta/recipes-core/util-linux/util-linux.inc   |   1 -
 .../util-linux/util-linux/fcntl-lock.c        | 332 ------------------
 .../util-linux/util-linux_2.41.1.bb           |   8 -
 3 files changed, 341 deletions(-)
 delete mode 100644 meta/recipes-core/util-linux/util-linux/fcntl-lock.c
meta/recipes-core/util-linux/util-linux.inc +0 -1
index 4c1105b6ae..e7a3c5be9f 100644
@@ -16,7 +16,6 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/util-linux/v${MAJOR_VERSION}/util-lin
            file://run-ptest \
            file://display_testname_for_subtest.patch \
            file://avoid_parallel_tests.patch \
-           file://fcntl-lock.c \
            file://0001-tests-ts-kill-decode-avoid-using-shell-built-in-kill.patch \
            file://0001-lsfd-mkfds-foreign-sockets-skip-when-lacking-sock_di.patch \
            file://0001-ts-kill-decode-use-RTMIN-from-kill-L-instead-of-hard.patch \
meta/recipes-core/util-linux/util-linux/fcntl-lock.c deleted +0 -332

332 lines not on this page · raw message

meta/recipes-core/util-linux/util-linux_2.41.1.bb +0 -8
index 41fb3e5951..b591680c1e 100644
@@ -17,7 +17,6 @@ LICENSE:${PN}-colcrt = "BSD-4-Clause-UC"
 LICENSE:${PN}-colrm = "BSD-4-Clause-UC & ${LIBCOMMON_LICENSES}"
 LICENSE:${PN}-column = "BSD-4-Clause-UC & ${LIBCOMMON_LICENSES}"
 LICENSE:${PN}-coresched = "EUPL-1.2 & ${LIBCOMMON_LICENSES}"
-LICENSE:${PN}-fcntl-lock = "MIT"
 LICENSE:${PN}-fdisk = "GPL-1.0-or-later & ${DEFAULT_LICENSES}"
 LICENSE:${PN}-fsfreeze = "GPL-1.0-or-later"
 LICENSE:${PN}-hexdump = "BSD-4-Clause-UC & ${LIBCOMMON_LICENSES}"
@@ -227,11 +226,6 @@ do_compile:prepend () {
 	[ -e ${S}/libsmartcols/src/filter-parser.c ] && touch ${S}/libsmartcols/src/filter-parser.c
 }
 
-do_compile:append () {
-	cp ${UNPACKDIR}/fcntl-lock.c ${S}/fcntl-lock.c
-	${CC} ${CFLAGS} ${LDFLAGS} ${S}/fcntl-lock.c -o ${B}/fcntl-lock
-}
-
 do_install:append () {
 	mkdir -p ${D}${base_bindir}
 
@@ -261,8 +255,6 @@ do_install:append () {
 	echo 'MOUNTALL="-t nonfs,nosmbfs,noncpfs"' > ${D}${sysconfdir}/default/mountall
 
 	rm -f ${D}${bindir}/chkdupexe
-
-	install -m 0755 ${B}/fcntl-lock ${D}${bindir}
 }
 
 do_install:append:class-target () {
Signature · 1 line
2.51.0