Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] xbps-src: fixed dangling binpkg lock on error
@ 2020-08-10  6:01 Noah-Huppert
  2020-08-10  6:03 ` [PR PATCH] [Updated] " Noah-Huppert
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: Noah-Huppert @ 2020-08-10  6:01 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 4163 bytes --]

There is a new pull request by Noah-Huppert against master on the void-packages repository

https://github.com/Noah-Huppert/void-packages binpkgs-lock-fix
https://github.com/void-linux/void-packages/pull/24191

xbps-src: fixed dangling binpkg lock on error
Fixes #21020. 

Previously if a binpkg failed to be created due to [`xbps-create` falling over in `common/hooks/do-pkg/00-gen-pkg.sh`](https://github.com/void-linux/void-packages/blob/master/common/hooks/do-pkg/00-gen-pkg.sh#L63) it would leave a `hostdir/binpkgs/*.lock` file around.

This fix traps `ERR` right after the lock file is created. If an error occurs it deletes the lock file. Right before the lock file is deleted it untraps `ERR`.

There was a[ `xbps-create` return value check in the source](https://github.com/void-linux/void-packages/blob/master/common/hooks/do-pkg/00-gen-pkg.sh#L88-L95). However I think the script is running with `set -e` which results in the failure of `xbps-create` exiting the process. Trapping `ERR` prevents the process from exiting.

**Before**  
Before these changes when a binpkg build failed due to `xbps-create` falling over it would look like so:

```
=> kernel-libc-headers-4.19.0_2: running do-pkg hook: 00-gen-pkg ...
=> Creating kernel-libc-headers-4.19.0_2.x86_64.xbps for repository /home/noah/documents/void-packages/hostdir/binpkgs ...
xbps-create: ERROR: Failed to open .xbps-pkg-XXX7c01am fd for writing: No such file or directory
[noah@ip-172-31-47-23 void-packages]$ => ERROR: kernel-libc-headers-4.19.0_2: do-pkg_00-gen-pkg: 'xbps-create ${_provides:+--provides "${_provides}"} ${_conflicts:+--conflicts "${_conflicts}"} ${_replaces:+--replaces "${_replaces}"} ${_reverts:+--reverts "${_reverts}"} ${_mutable_files:+--mutable-files "${_mutable_files}"} ${_deps:+--dependencies "${_deps}"} ${_conf_files:+--config-files "${_conf_files}"} ${PKG_BUILD_OPTIONS:+--build-options "${PKG_BUILD_OPTIONS}"} ${_gitrevs:+--source-revisions "${_gitrevs}"} ${_shprovides:+--shlib-provides "${_shprovides}"} ${_shrequires:+--shlib-requires "${_shrequires}"} ${_alternatives:+--alternatives "${_alternatives}"} ${_preserve:+--preserve} ${tags:+--tags "${tags}"} ${_changelog:+--changelog "${_changelog}"} ${XBPS_PKG_COMPTYPE:+--compression $XBPS_PKG_COMPTYPE} --architecture ${arch} --homepage "${homepage}" --license "${license}" --maintainer "${maintainer}" --desc "${desc}" --pkgver "${pkgver}" --quiet ${PKGDESTDIR}' exited with 1
=> ERROR:   in genpkg() at common/hooks/do-pkg/00-gen-pkg.sh:64
=> ERROR:   in hook() at common/hooks/do-pkg/00-gen-pkg.sh:121
=> ERROR:   in run_func() at common/xbps-src/shutils/common.sh:21
=> ERROR:   in run_pkg_hooks() at common/xbps-src/shutils/common.sh:232
=> ERROR:   in main() at common/xbps-src/libexec/xbps-src-dopkg.sh:44
```

When you tried to re-build any package which previously had a failed binpkg it would hang forever like so:

```
./xbps-src pkg kernel-libc-headers
=> kernel-libc-headers-4.19.0_2: running do-pkg hook: 00-gen-pkg ...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
...
```

**After**  

With the changes a binpkg build failing due to xbps-create appears as:

```
=> Creating kernel-libc-headers-4.19.0_2.x86_64.xbps for repository /home/noah/documents/void-packages/hostdir/binpkgs ...
xbps-create: ERROR: Failed to open .xbps-pkg-XXX316nSv fd for writing: No such file or directory
=> Unlocking kernel-libc-headers-4.19.0_2.x86_64.xbps.lock because an error occurred during kernel-libc-headers-4.19.0_2.x86_64.xbps creationrval="1"
=> ERROR: Failed to created binary package: kernel-libc-headers-4.19.0_2.x86_64.xbps!
```

When you try to re-build any package with a previously failed binpkg the lock file does not exist. So the build will run normally. 

A patch file from https://github.com/void-linux/void-packages/pull/24191.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-binpkgs-lock-fix-24191.patch --]
[-- Type: text/x-diff, Size: 1018 bytes --]

From 755e76c2da90a3d95e95774ab7be031e8898da66 Mon Sep 17 00:00:00 2001
From: Noah Huppert <contact@noahh.io>
Date: Mon, 10 Aug 2020 01:54:35 -0400
Subject: [PATCH] xbps-src: fixed dangling binpkg lock on error

---
 common/hooks/do-pkg/00-gen-pkg.sh | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/common/hooks/do-pkg/00-gen-pkg.sh b/common/hooks/do-pkg/00-gen-pkg.sh
index e6285b6e4ff..505883f4a74 100644
--- a/common/hooks/do-pkg/00-gen-pkg.sh
+++ b/common/hooks/do-pkg/00-gen-pkg.sh
@@ -23,7 +23,14 @@ genpkg() {
 		return 0
 	fi
 
+	# Lock binpkg
+	unlock_binpkg() {
+	    msg_normal "Unlocking ${binpkg}.lock because an error occurred during $binpkg creation"
+	    rm -f $pkgdir/${binpkg}.lock
+	}
+
 	touch -f $pkgdir/${binpkg}.lock
+	trap unlock_binpkg ERR
 
 	if [ ! -d $pkgdir ]; then
 		mkdir -p $pkgdir
@@ -86,7 +93,10 @@ genpkg() {
 		--quiet \
 		${PKGDESTDIR}
 	rval=$?
+	echo "rval=\"$rval\""
 
+	# Unlock binpkg
+	trap - ERR
 	rm -f $pkgdir/${binpkg}.lock
 
 	if [ $rval -ne 0 ]; then

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PR PATCH] [Updated] xbps-src: fixed dangling binpkg lock on error
  2020-08-10  6:01 [PR PATCH] xbps-src: fixed dangling binpkg lock on error Noah-Huppert
@ 2020-08-10  6:03 ` Noah-Huppert
  2020-08-10  6:04 ` Noah-Huppert
                   ` (15 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Noah-Huppert @ 2020-08-10  6:03 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 4160 bytes --]

There is an updated pull request by Noah-Huppert against master on the void-packages repository

https://github.com/Noah-Huppert/void-packages binpkgs-lock-fix
https://github.com/void-linux/void-packages/pull/24191

xbps-src: fixed dangling binpkg lock on error
Fixes #21020. 

Previously if a binpkg failed to be created due to [`xbps-create` falling over in `common/hooks/do-pkg/00-gen-pkg.sh`](https://github.com/void-linux/void-packages/blob/master/common/hooks/do-pkg/00-gen-pkg.sh#L63) it would leave a `hostdir/binpkgs/*.lock` file around.

This fix traps `ERR` right after the lock file is created. If an error occurs it deletes the lock file. Right before the lock file is deleted it untraps `ERR`.

There was a[ `xbps-create` return value check in the source](https://github.com/void-linux/void-packages/blob/master/common/hooks/do-pkg/00-gen-pkg.sh#L88-L95). However I think the script is running with `set -e` which results in the failure of `xbps-create` exiting the process. Trapping `ERR` prevents the process from exiting.

**Before**  
Before these changes when a binpkg build failed due to `xbps-create` falling over it would look like so:

```
=> kernel-libc-headers-4.19.0_2: running do-pkg hook: 00-gen-pkg ...
=> Creating kernel-libc-headers-4.19.0_2.x86_64.xbps for repository /home/noah/documents/void-packages/hostdir/binpkgs ...
xbps-create: ERROR: Failed to open .xbps-pkg-XXX7c01am fd for writing: No such file or directory
[noah@ip-172-31-47-23 void-packages]$ => ERROR: kernel-libc-headers-4.19.0_2: do-pkg_00-gen-pkg: 'xbps-create ${_provides:+--provides "${_provides}"} ${_conflicts:+--conflicts "${_conflicts}"} ${_replaces:+--replaces "${_replaces}"} ${_reverts:+--reverts "${_reverts}"} ${_mutable_files:+--mutable-files "${_mutable_files}"} ${_deps:+--dependencies "${_deps}"} ${_conf_files:+--config-files "${_conf_files}"} ${PKG_BUILD_OPTIONS:+--build-options "${PKG_BUILD_OPTIONS}"} ${_gitrevs:+--source-revisions "${_gitrevs}"} ${_shprovides:+--shlib-provides "${_shprovides}"} ${_shrequires:+--shlib-requires "${_shrequires}"} ${_alternatives:+--alternatives "${_alternatives}"} ${_preserve:+--preserve} ${tags:+--tags "${tags}"} ${_changelog:+--changelog "${_changelog}"} ${XBPS_PKG_COMPTYPE:+--compression $XBPS_PKG_COMPTYPE} --architecture ${arch} --homepage "${homepage}" --license "${license}" --maintainer "${maintainer}" --desc "${desc}" --pkgver "${pkgver}" --quiet ${PKGDESTDIR}' exited with 1
=> ERROR:   in genpkg() at common/hooks/do-pkg/00-gen-pkg.sh:64
=> ERROR:   in hook() at common/hooks/do-pkg/00-gen-pkg.sh:121
=> ERROR:   in run_func() at common/xbps-src/shutils/common.sh:21
=> ERROR:   in run_pkg_hooks() at common/xbps-src/shutils/common.sh:232
=> ERROR:   in main() at common/xbps-src/libexec/xbps-src-dopkg.sh:44
```

When you tried to re-build any package which previously had a failed binpkg it would hang forever like so:

```
./xbps-src pkg kernel-libc-headers
=> kernel-libc-headers-4.19.0_2: running do-pkg hook: 00-gen-pkg ...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
...
```

**After**  

With the changes a binpkg build failing due to xbps-create appears as:

```
=> Creating kernel-libc-headers-4.19.0_2.x86_64.xbps for repository /home/noah/documents/void-packages/hostdir/binpkgs ...
xbps-create: ERROR: Failed to open .xbps-pkg-XXX316nSv fd for writing: No such file or directory
=> Unlocking kernel-libc-headers-4.19.0_2.x86_64.xbps.lock because an error occurred during kernel-libc-headers-4.19.0_2.x86_64.xbps creation
=> ERROR: Failed to created binary package: kernel-libc-headers-4.19.0_2.x86_64.xbps!
```

When you try to re-build any package with a previously failed binpkg the lock file does not exist. So the build will run normally. 

A patch file from https://github.com/void-linux/void-packages/pull/24191.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-binpkgs-lock-fix-24191.patch --]
[-- Type: text/x-diff, Size: 977 bytes --]

From 4c1c61d82b96e662f935c911c14201a5c4ffb89f Mon Sep 17 00:00:00 2001
From: Noah Huppert <contact@noahh.io>
Date: Mon, 10 Aug 2020 02:03:50 -0400
Subject: [PATCH] xbps-src: fixed dangling binpkg lock on error

---
 common/hooks/do-pkg/00-gen-pkg.sh | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/common/hooks/do-pkg/00-gen-pkg.sh b/common/hooks/do-pkg/00-gen-pkg.sh
index e6285b6e4ff..76857b0fc30 100644
--- a/common/hooks/do-pkg/00-gen-pkg.sh
+++ b/common/hooks/do-pkg/00-gen-pkg.sh
@@ -23,7 +23,14 @@ genpkg() {
 		return 0
 	fi
 
+	# Lock binpkg
+	unlock_binpkg() {
+	    msg_normal "Unlocking ${binpkg}.lock because an error occurred during $binpkg creation"
+	    rm -f $pkgdir/${binpkg}.lock
+	}
+
 	touch -f $pkgdir/${binpkg}.lock
+	trap unlock_binpkg ERR
 
 	if [ ! -d $pkgdir ]; then
 		mkdir -p $pkgdir
@@ -87,6 +94,8 @@ genpkg() {
 		${PKGDESTDIR}
 	rval=$?
 
+	# Unlock binpkg
+	trap - ERR
 	rm -f $pkgdir/${binpkg}.lock
 
 	if [ $rval -ne 0 ]; then

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PR PATCH] [Updated] xbps-src: fixed dangling binpkg lock on error
  2020-08-10  6:01 [PR PATCH] xbps-src: fixed dangling binpkg lock on error Noah-Huppert
  2020-08-10  6:03 ` [PR PATCH] [Updated] " Noah-Huppert
@ 2020-08-10  6:04 ` Noah-Huppert
  2020-08-10  6:20 ` [PR REVIEW] " Noah-Huppert
                   ` (14 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Noah-Huppert @ 2020-08-10  6:04 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 4160 bytes --]

There is an updated pull request by Noah-Huppert against master on the void-packages repository

https://github.com/Noah-Huppert/void-packages binpkgs-lock-fix
https://github.com/void-linux/void-packages/pull/24191

xbps-src: fixed dangling binpkg lock on error
Fixes #21020. 

Previously if a binpkg failed to be created due to [`xbps-create` falling over in `common/hooks/do-pkg/00-gen-pkg.sh`](https://github.com/void-linux/void-packages/blob/master/common/hooks/do-pkg/00-gen-pkg.sh#L63) it would leave a `hostdir/binpkgs/*.lock` file around.

This fix traps `ERR` right after the lock file is created. If an error occurs it deletes the lock file. Right before the lock file is deleted it untraps `ERR`.

There was a[ `xbps-create` return value check in the source](https://github.com/void-linux/void-packages/blob/master/common/hooks/do-pkg/00-gen-pkg.sh#L88-L95). However I think the script is running with `set -e` which results in the failure of `xbps-create` exiting the process. Trapping `ERR` prevents the process from exiting.

**Before**  
Before these changes when a binpkg build failed due to `xbps-create` falling over it would look like so:

```
=> kernel-libc-headers-4.19.0_2: running do-pkg hook: 00-gen-pkg ...
=> Creating kernel-libc-headers-4.19.0_2.x86_64.xbps for repository /home/noah/documents/void-packages/hostdir/binpkgs ...
xbps-create: ERROR: Failed to open .xbps-pkg-XXX7c01am fd for writing: No such file or directory
[noah@ip-172-31-47-23 void-packages]$ => ERROR: kernel-libc-headers-4.19.0_2: do-pkg_00-gen-pkg: 'xbps-create ${_provides:+--provides "${_provides}"} ${_conflicts:+--conflicts "${_conflicts}"} ${_replaces:+--replaces "${_replaces}"} ${_reverts:+--reverts "${_reverts}"} ${_mutable_files:+--mutable-files "${_mutable_files}"} ${_deps:+--dependencies "${_deps}"} ${_conf_files:+--config-files "${_conf_files}"} ${PKG_BUILD_OPTIONS:+--build-options "${PKG_BUILD_OPTIONS}"} ${_gitrevs:+--source-revisions "${_gitrevs}"} ${_shprovides:+--shlib-provides "${_shprovides}"} ${_shrequires:+--shlib-requires "${_shrequires}"} ${_alternatives:+--alternatives "${_alternatives}"} ${_preserve:+--preserve} ${tags:+--tags "${tags}"} ${_changelog:+--changelog "${_changelog}"} ${XBPS_PKG_COMPTYPE:+--compression $XBPS_PKG_COMPTYPE} --architecture ${arch} --homepage "${homepage}" --license "${license}" --maintainer "${maintainer}" --desc "${desc}" --pkgver "${pkgver}" --quiet ${PKGDESTDIR}' exited with 1
=> ERROR:   in genpkg() at common/hooks/do-pkg/00-gen-pkg.sh:64
=> ERROR:   in hook() at common/hooks/do-pkg/00-gen-pkg.sh:121
=> ERROR:   in run_func() at common/xbps-src/shutils/common.sh:21
=> ERROR:   in run_pkg_hooks() at common/xbps-src/shutils/common.sh:232
=> ERROR:   in main() at common/xbps-src/libexec/xbps-src-dopkg.sh:44
```

When you tried to re-build any package which previously had a failed binpkg it would hang forever like so:

```
./xbps-src pkg kernel-libc-headers
=> kernel-libc-headers-4.19.0_2: running do-pkg hook: 00-gen-pkg ...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
...
```

**After**  

With the changes a binpkg build failing due to xbps-create appears as:

```
=> Creating kernel-libc-headers-4.19.0_2.x86_64.xbps for repository /home/noah/documents/void-packages/hostdir/binpkgs ...
xbps-create: ERROR: Failed to open .xbps-pkg-XXX316nSv fd for writing: No such file or directory
=> Unlocking kernel-libc-headers-4.19.0_2.x86_64.xbps.lock because an error occurred during kernel-libc-headers-4.19.0_2.x86_64.xbps creation
=> ERROR: Failed to created binary package: kernel-libc-headers-4.19.0_2.x86_64.xbps!
```

When you try to re-build any package with a previously failed binpkg the lock file does not exist. So the build will run normally. 

A patch file from https://github.com/void-linux/void-packages/pull/24191.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-binpkgs-lock-fix-24191.patch --]
[-- Type: text/x-diff, Size: 987 bytes --]

From 5049a416a8d14878642ff8d3e611fb6387dc6462 Mon Sep 17 00:00:00 2001
From: Noah Huppert <contact@noahh.io>
Date: Mon, 10 Aug 2020 02:04:16 -0400
Subject: [PATCH] [ci skip] xbps-src: fixed dangling binpkg lock on error

---
 common/hooks/do-pkg/00-gen-pkg.sh | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/common/hooks/do-pkg/00-gen-pkg.sh b/common/hooks/do-pkg/00-gen-pkg.sh
index e6285b6e4ff..76857b0fc30 100644
--- a/common/hooks/do-pkg/00-gen-pkg.sh
+++ b/common/hooks/do-pkg/00-gen-pkg.sh
@@ -23,7 +23,14 @@ genpkg() {
 		return 0
 	fi
 
+	# Lock binpkg
+	unlock_binpkg() {
+	    msg_normal "Unlocking ${binpkg}.lock because an error occurred during $binpkg creation"
+	    rm -f $pkgdir/${binpkg}.lock
+	}
+
 	touch -f $pkgdir/${binpkg}.lock
+	trap unlock_binpkg ERR
 
 	if [ ! -d $pkgdir ]; then
 		mkdir -p $pkgdir
@@ -87,6 +94,8 @@ genpkg() {
 		${PKGDESTDIR}
 	rval=$?
 
+	# Unlock binpkg
+	trap - ERR
 	rm -f $pkgdir/${binpkg}.lock
 
 	if [ $rval -ne 0 ]; then

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PR REVIEW] xbps-src: fixed dangling binpkg lock on error
  2020-08-10  6:01 [PR PATCH] xbps-src: fixed dangling binpkg lock on error Noah-Huppert
  2020-08-10  6:03 ` [PR PATCH] [Updated] " Noah-Huppert
  2020-08-10  6:04 ` Noah-Huppert
@ 2020-08-10  6:20 ` Noah-Huppert
  2020-08-10  6:29 ` [PR PATCH] [Updated] " Noah-Huppert
                   ` (13 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Noah-Huppert @ 2020-08-10  6:20 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 212 bytes --]

New review comment by Noah-Huppert on void-packages repository

https://github.com/void-linux/void-packages/pull/24191#discussion_r467705875

Comment:
Does trapping `ERR` cover enough? Or do we also need `EXIT`?

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PR PATCH] [Updated] xbps-src: fixed dangling binpkg lock on error
  2020-08-10  6:01 [PR PATCH] xbps-src: fixed dangling binpkg lock on error Noah-Huppert
                   ` (2 preceding siblings ...)
  2020-08-10  6:20 ` [PR REVIEW] " Noah-Huppert
@ 2020-08-10  6:29 ` Noah-Huppert
  2020-08-10  6:30 ` Noah-Huppert
                   ` (12 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Noah-Huppert @ 2020-08-10  6:29 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 4475 bytes --]

There is an updated pull request by Noah-Huppert against master on the void-packages repository

https://github.com/Noah-Huppert/void-packages binpkgs-lock-fix
https://github.com/void-linux/void-packages/pull/24191

xbps-src: fixed dangling binpkg lock on error
Fixes #21020. 

Previously if a binpkg failed to be created due to [`xbps-create` falling over in `common/hooks/do-pkg/00-gen-pkg.sh`](https://github.com/void-linux/void-packages/blob/master/common/hooks/do-pkg/00-gen-pkg.sh#L63) it would leave a `hostdir/binpkgs/*.lock` file around.

This fix traps `ERR` right after the lock file is created. If an error occurs it deletes the lock file. Right before the lock file is deleted it untraps `ERR`.

There was an [`xbps-create` return value check in the source](https://github.com/void-linux/void-packages/blob/master/common/hooks/do-pkg/00-gen-pkg.sh#L88-L95). However I think the script is running with `set -e` which results in the failure of `xbps-create` exiting the process. Trapping `ERR` prevents the process from exiting.

**Before**  
Before these changes when a binpkg build failed due to `xbps-create` falling over it would look like so:

```
=> kernel-libc-headers-4.19.0_2: running do-pkg hook: 00-gen-pkg ...
=> Creating kernel-libc-headers-4.19.0_2.x86_64.xbps for repository /home/noah/documents/void-packages/hostdir/binpkgs ...
xbps-create: ERROR: Failed to open .xbps-pkg-XXX7c01am fd for writing: No such file or directory
[noah@ip-172-31-47-23 void-packages]$ => ERROR: kernel-libc-headers-4.19.0_2: do-pkg_00-gen-pkg: 'xbps-create ${_provides:+--provides "${_provides}"} ${_conflicts:+--conflicts "${_conflicts}"} ${_replaces:+--replaces "${_replaces}"} ${_reverts:+--reverts "${_reverts}"} ${_mutable_files:+--mutable-files "${_mutable_files}"} ${_deps:+--dependencies "${_deps}"} ${_conf_files:+--config-files "${_conf_files}"} ${PKG_BUILD_OPTIONS:+--build-options "${PKG_BUILD_OPTIONS}"} ${_gitrevs:+--source-revisions "${_gitrevs}"} ${_shprovides:+--shlib-provides "${_shprovides}"} ${_shrequires:+--shlib-requires "${_shrequires}"} ${_alternatives:+--alternatives "${_alternatives}"} ${_preserve:+--preserve} ${tags:+--tags "${tags}"} ${_changelog:+--changelog "${_changelog}"} ${XBPS_PKG_COMPTYPE:+--compression $XBPS_PKG_COMPTYPE} --architecture ${arch} --homepage "${homepage}" --license "${license}" --maintainer "${maintainer}" --desc "${desc}" --pkgver "${pkgver}" --quiet ${PKGDESTDIR}' exited with 1
=> ERROR:   in genpkg() at common/hooks/do-pkg/00-gen-pkg.sh:64
=> ERROR:   in hook() at common/hooks/do-pkg/00-gen-pkg.sh:121
=> ERROR:   in run_func() at common/xbps-src/shutils/common.sh:21
=> ERROR:   in run_pkg_hooks() at common/xbps-src/shutils/common.sh:232
=> ERROR:   in main() at common/xbps-src/libexec/xbps-src-dopkg.sh:44
```
(Note: The `xbps-create: ERROR: Failed to open .xbps-pkg-XXX...` error is not relevant, but was produced by `xbps-create` failing, how `xbps-src` handles this failure is the focus of the PR). 

When you tried to re-build any package which previously had a failed binpkg it would [spin forever trying to acquire the lock](https://github.com/void-linux/void-packages/blob/master/common/hooks/do-pkg/00-gen-pkg.sh#L15-L18):

```
./xbps-src pkg kernel-libc-headers
=> kernel-libc-headers-4.19.0_2: running do-pkg hook: 00-gen-pkg ...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
...
```

**After**  

With the changes a binpkg build failing due to xbps-create appears as:

```
=> Creating kernel-libc-headers-4.19.0_2.x86_64.xbps for repository /home/noah/documents/void-packages/hostdir/binpkgs ...
xbps-create: ERROR: Failed to open .xbps-pkg-XXX316nSv fd for writing: No such file or directory
=> Unlocking kernel-libc-headers-4.19.0_2.x86_64.xbps.lock because an error occurred during kernel-libc-headers-4.19.0_2.x86_64.xbps creation
=> ERROR: Failed to created binary package: kernel-libc-headers-4.19.0_2.x86_64.xbps!
```

When you try to re-build any package with a previously failed binpkg the lock file does not exist. So the build will run normally. 

A patch file from https://github.com/void-linux/void-packages/pull/24191.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-binpkgs-lock-fix-24191.patch --]
[-- Type: text/x-diff, Size: 1189 bytes --]

From 4091756f7d973ea31703fc0726019bf6dc9352a9 Mon Sep 17 00:00:00 2001
From: Noah Huppert <contact@noahh.io>
Date: Mon, 10 Aug 2020 02:29:17 -0400
Subject: [PATCH] [ci skip] xbps-src: fixed dangling binpkg lock on error

---
 common/hooks/do-pkg/00-gen-pkg.sh | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/common/hooks/do-pkg/00-gen-pkg.sh b/common/hooks/do-pkg/00-gen-pkg.sh
index e6285b6e4ff..e1893101ade 100644
--- a/common/hooks/do-pkg/00-gen-pkg.sh
+++ b/common/hooks/do-pkg/00-gen-pkg.sh
@@ -23,7 +23,14 @@ genpkg() {
 		return 0
 	fi
 
+	# Lock binpkg
+	unlock_binpkg() {
+	    msg_normal "Unlocking ${binpkg}.lock because an error occurred during $binpkg creation"
+	    rm -f $pkgdir/${binpkg}.lock
+	}
+
 	touch -f $pkgdir/${binpkg}.lock
+	trap unlock_binpkg ERR EXIT
 
 	if [ ! -d $pkgdir ]; then
 		mkdir -p $pkgdir
@@ -60,6 +67,7 @@ genpkg() {
 	#
 	# Create the XBPS binary package.
 	#
+	sleep 100
 	xbps-create \
 		${_provides:+--provides "${_provides}"} \
 		${_conflicts:+--conflicts "${_conflicts}"} \
@@ -87,6 +95,8 @@ genpkg() {
 		${PKGDESTDIR}
 	rval=$?
 
+	# Unlock binpkg
+	trap - ERR
 	rm -f $pkgdir/${binpkg}.lock
 
 	if [ $rval -ne 0 ]; then

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PR PATCH] [Updated] xbps-src: fixed dangling binpkg lock on error
  2020-08-10  6:01 [PR PATCH] xbps-src: fixed dangling binpkg lock on error Noah-Huppert
                   ` (3 preceding siblings ...)
  2020-08-10  6:29 ` [PR PATCH] [Updated] " Noah-Huppert
@ 2020-08-10  6:30 ` Noah-Huppert
  2020-08-10  6:33 ` Noah-Huppert
                   ` (11 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Noah-Huppert @ 2020-08-10  6:30 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 4475 bytes --]

There is an updated pull request by Noah-Huppert against master on the void-packages repository

https://github.com/Noah-Huppert/void-packages binpkgs-lock-fix
https://github.com/void-linux/void-packages/pull/24191

xbps-src: fixed dangling binpkg lock on error
Fixes #21020. 

Previously if a binpkg failed to be created due to [`xbps-create` falling over in `common/hooks/do-pkg/00-gen-pkg.sh`](https://github.com/void-linux/void-packages/blob/master/common/hooks/do-pkg/00-gen-pkg.sh#L63) it would leave a `hostdir/binpkgs/*.lock` file around.

This fix traps `ERR` right after the lock file is created. If an error occurs it deletes the lock file. Right before the lock file is deleted it untraps `ERR`.

There was an [`xbps-create` return value check in the source](https://github.com/void-linux/void-packages/blob/master/common/hooks/do-pkg/00-gen-pkg.sh#L88-L95). However I think the script is running with `set -e` which results in the failure of `xbps-create` exiting the process. Trapping `ERR` prevents the process from exiting.

**Before**  
Before these changes when a binpkg build failed due to `xbps-create` falling over it would look like so:

```
=> kernel-libc-headers-4.19.0_2: running do-pkg hook: 00-gen-pkg ...
=> Creating kernel-libc-headers-4.19.0_2.x86_64.xbps for repository /home/noah/documents/void-packages/hostdir/binpkgs ...
xbps-create: ERROR: Failed to open .xbps-pkg-XXX7c01am fd for writing: No such file or directory
[noah@ip-172-31-47-23 void-packages]$ => ERROR: kernel-libc-headers-4.19.0_2: do-pkg_00-gen-pkg: 'xbps-create ${_provides:+--provides "${_provides}"} ${_conflicts:+--conflicts "${_conflicts}"} ${_replaces:+--replaces "${_replaces}"} ${_reverts:+--reverts "${_reverts}"} ${_mutable_files:+--mutable-files "${_mutable_files}"} ${_deps:+--dependencies "${_deps}"} ${_conf_files:+--config-files "${_conf_files}"} ${PKG_BUILD_OPTIONS:+--build-options "${PKG_BUILD_OPTIONS}"} ${_gitrevs:+--source-revisions "${_gitrevs}"} ${_shprovides:+--shlib-provides "${_shprovides}"} ${_shrequires:+--shlib-requires "${_shrequires}"} ${_alternatives:+--alternatives "${_alternatives}"} ${_preserve:+--preserve} ${tags:+--tags "${tags}"} ${_changelog:+--changelog "${_changelog}"} ${XBPS_PKG_COMPTYPE:+--compression $XBPS_PKG_COMPTYPE} --architecture ${arch} --homepage "${homepage}" --license "${license}" --maintainer "${maintainer}" --desc "${desc}" --pkgver "${pkgver}" --quiet ${PKGDESTDIR}' exited with 1
=> ERROR:   in genpkg() at common/hooks/do-pkg/00-gen-pkg.sh:64
=> ERROR:   in hook() at common/hooks/do-pkg/00-gen-pkg.sh:121
=> ERROR:   in run_func() at common/xbps-src/shutils/common.sh:21
=> ERROR:   in run_pkg_hooks() at common/xbps-src/shutils/common.sh:232
=> ERROR:   in main() at common/xbps-src/libexec/xbps-src-dopkg.sh:44
```
(Note: The `xbps-create: ERROR: Failed to open .xbps-pkg-XXX...` error is not relevant, but was produced by `xbps-create` failing, how `xbps-src` handles this failure is the focus of the PR). 

When you tried to re-build any package which previously had a failed binpkg it would [spin forever trying to acquire the lock](https://github.com/void-linux/void-packages/blob/master/common/hooks/do-pkg/00-gen-pkg.sh#L15-L18):

```
./xbps-src pkg kernel-libc-headers
=> kernel-libc-headers-4.19.0_2: running do-pkg hook: 00-gen-pkg ...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
...
```

**After**  

With the changes a binpkg build failing due to xbps-create appears as:

```
=> Creating kernel-libc-headers-4.19.0_2.x86_64.xbps for repository /home/noah/documents/void-packages/hostdir/binpkgs ...
xbps-create: ERROR: Failed to open .xbps-pkg-XXX316nSv fd for writing: No such file or directory
=> Unlocking kernel-libc-headers-4.19.0_2.x86_64.xbps.lock because an error occurred during kernel-libc-headers-4.19.0_2.x86_64.xbps creation
=> ERROR: Failed to created binary package: kernel-libc-headers-4.19.0_2.x86_64.xbps!
```

When you try to re-build any package with a previously failed binpkg the lock file does not exist. So the build will run normally. 

A patch file from https://github.com/void-linux/void-packages/pull/24191.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-binpkgs-lock-fix-24191.patch --]
[-- Type: text/x-diff, Size: 992 bytes --]

From 130a30edde30fb1e147de10458d37bbaae6af6b6 Mon Sep 17 00:00:00 2001
From: Noah Huppert <contact@noahh.io>
Date: Mon, 10 Aug 2020 02:29:50 -0400
Subject: [PATCH] [ci skip] xbps-src: fixed dangling binpkg lock on error

---
 common/hooks/do-pkg/00-gen-pkg.sh | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/common/hooks/do-pkg/00-gen-pkg.sh b/common/hooks/do-pkg/00-gen-pkg.sh
index e6285b6e4ff..1dca8dfeb7f 100644
--- a/common/hooks/do-pkg/00-gen-pkg.sh
+++ b/common/hooks/do-pkg/00-gen-pkg.sh
@@ -23,7 +23,14 @@ genpkg() {
 		return 0
 	fi
 
+	# Lock binpkg
+	unlock_binpkg() {
+	    msg_normal "Unlocking ${binpkg}.lock because an error occurred during $binpkg creation"
+	    rm -f $pkgdir/${binpkg}.lock
+	}
+
 	touch -f $pkgdir/${binpkg}.lock
+	trap unlock_binpkg ERR EXIT
 
 	if [ ! -d $pkgdir ]; then
 		mkdir -p $pkgdir
@@ -87,6 +94,8 @@ genpkg() {
 		${PKGDESTDIR}
 	rval=$?
 
+	# Unlock binpkg
+	trap - ERR
 	rm -f $pkgdir/${binpkg}.lock
 
 	if [ $rval -ne 0 ]; then

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PR PATCH] [Updated] xbps-src: fixed dangling binpkg lock on error
  2020-08-10  6:01 [PR PATCH] xbps-src: fixed dangling binpkg lock on error Noah-Huppert
                   ` (4 preceding siblings ...)
  2020-08-10  6:30 ` Noah-Huppert
@ 2020-08-10  6:33 ` Noah-Huppert
  2020-08-10  6:34 ` [PR REVIEW] " Noah-Huppert
                   ` (10 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Noah-Huppert @ 2020-08-10  6:33 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 4475 bytes --]

There is an updated pull request by Noah-Huppert against master on the void-packages repository

https://github.com/Noah-Huppert/void-packages binpkgs-lock-fix
https://github.com/void-linux/void-packages/pull/24191

xbps-src: fixed dangling binpkg lock on error
Fixes #21020. 

Previously if a binpkg failed to be created due to [`xbps-create` falling over in `common/hooks/do-pkg/00-gen-pkg.sh`](https://github.com/void-linux/void-packages/blob/master/common/hooks/do-pkg/00-gen-pkg.sh#L63) it would leave a `hostdir/binpkgs/*.lock` file around.

This fix traps `ERR` right after the lock file is created. If an error occurs it deletes the lock file. Right before the lock file is deleted it untraps `ERR`.

There was an [`xbps-create` return value check in the source](https://github.com/void-linux/void-packages/blob/master/common/hooks/do-pkg/00-gen-pkg.sh#L88-L95). However I think the script is running with `set -e` which results in the failure of `xbps-create` exiting the process. Trapping `ERR` prevents the process from exiting.

**Before**  
Before these changes when a binpkg build failed due to `xbps-create` falling over it would look like so:

```
=> kernel-libc-headers-4.19.0_2: running do-pkg hook: 00-gen-pkg ...
=> Creating kernel-libc-headers-4.19.0_2.x86_64.xbps for repository /home/noah/documents/void-packages/hostdir/binpkgs ...
xbps-create: ERROR: Failed to open .xbps-pkg-XXX7c01am fd for writing: No such file or directory
[noah@ip-172-31-47-23 void-packages]$ => ERROR: kernel-libc-headers-4.19.0_2: do-pkg_00-gen-pkg: 'xbps-create ${_provides:+--provides "${_provides}"} ${_conflicts:+--conflicts "${_conflicts}"} ${_replaces:+--replaces "${_replaces}"} ${_reverts:+--reverts "${_reverts}"} ${_mutable_files:+--mutable-files "${_mutable_files}"} ${_deps:+--dependencies "${_deps}"} ${_conf_files:+--config-files "${_conf_files}"} ${PKG_BUILD_OPTIONS:+--build-options "${PKG_BUILD_OPTIONS}"} ${_gitrevs:+--source-revisions "${_gitrevs}"} ${_shprovides:+--shlib-provides "${_shprovides}"} ${_shrequires:+--shlib-requires "${_shrequires}"} ${_alternatives:+--alternatives "${_alternatives}"} ${_preserve:+--preserve} ${tags:+--tags "${tags}"} ${_changelog:+--changelog "${_changelog}"} ${XBPS_PKG_COMPTYPE:+--compression $XBPS_PKG_COMPTYPE} --architecture ${arch} --homepage "${homepage}" --license "${license}" --maintainer "${maintainer}" --desc "${desc}" --pkgver "${pkgver}" --quiet ${PKGDESTDIR}' exited with 1
=> ERROR:   in genpkg() at common/hooks/do-pkg/00-gen-pkg.sh:64
=> ERROR:   in hook() at common/hooks/do-pkg/00-gen-pkg.sh:121
=> ERROR:   in run_func() at common/xbps-src/shutils/common.sh:21
=> ERROR:   in run_pkg_hooks() at common/xbps-src/shutils/common.sh:232
=> ERROR:   in main() at common/xbps-src/libexec/xbps-src-dopkg.sh:44
```
(Note: The `xbps-create: ERROR: Failed to open .xbps-pkg-XXX...` error is not relevant, but was produced by `xbps-create` failing, how `xbps-src` handles this failure is the focus of the PR). 

When you tried to re-build any package which previously had a failed binpkg it would [spin forever trying to acquire the lock](https://github.com/void-linux/void-packages/blob/master/common/hooks/do-pkg/00-gen-pkg.sh#L15-L18):

```
./xbps-src pkg kernel-libc-headers
=> kernel-libc-headers-4.19.0_2: running do-pkg hook: 00-gen-pkg ...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
...
```

**After**  

With the changes a binpkg build failing due to xbps-create appears as:

```
=> Creating kernel-libc-headers-4.19.0_2.x86_64.xbps for repository /home/noah/documents/void-packages/hostdir/binpkgs ...
xbps-create: ERROR: Failed to open .xbps-pkg-XXX316nSv fd for writing: No such file or directory
=> Unlocking kernel-libc-headers-4.19.0_2.x86_64.xbps.lock because an error occurred during kernel-libc-headers-4.19.0_2.x86_64.xbps creation
=> ERROR: Failed to created binary package: kernel-libc-headers-4.19.0_2.x86_64.xbps!
```

When you try to re-build any package with a previously failed binpkg the lock file does not exist. So the build will run normally. 

A patch file from https://github.com/void-linux/void-packages/pull/24191.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-binpkgs-lock-fix-24191.patch --]
[-- Type: text/x-diff, Size: 997 bytes --]

From 4855924ec097baf96983c2ad2f9ec6dc6c71736b Mon Sep 17 00:00:00 2001
From: Noah Huppert <contact@noahh.io>
Date: Mon, 10 Aug 2020 02:33:09 -0400
Subject: [PATCH] [ci skip] xbps-src: fixed dangling binpkg lock on error

---
 common/hooks/do-pkg/00-gen-pkg.sh | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/common/hooks/do-pkg/00-gen-pkg.sh b/common/hooks/do-pkg/00-gen-pkg.sh
index e6285b6e4ff..8198d5d0863 100644
--- a/common/hooks/do-pkg/00-gen-pkg.sh
+++ b/common/hooks/do-pkg/00-gen-pkg.sh
@@ -23,7 +23,14 @@ genpkg() {
 		return 0
 	fi
 
+	# Lock binpkg
+	unlock_binpkg() {
+	    msg_normal "Unlocking ${binpkg}.lock because an error occurred during $binpkg creation"
+	    rm -f $pkgdir/${binpkg}.lock
+	}
+
 	touch -f $pkgdir/${binpkg}.lock
+	trap unlock_binpkg ERR EXIT
 
 	if [ ! -d $pkgdir ]; then
 		mkdir -p $pkgdir
@@ -87,6 +94,8 @@ genpkg() {
 		${PKGDESTDIR}
 	rval=$?
 
+	# Unlock binpkg
+	trap - ERR EXIT
 	rm -f $pkgdir/${binpkg}.lock
 
 	if [ $rval -ne 0 ]; then

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PR REVIEW] xbps-src: fixed dangling binpkg lock on error
  2020-08-10  6:01 [PR PATCH] xbps-src: fixed dangling binpkg lock on error Noah-Huppert
                   ` (5 preceding siblings ...)
  2020-08-10  6:33 ` Noah-Huppert
@ 2020-08-10  6:34 ` Noah-Huppert
  2020-08-10 15:28 ` Noah-Huppert
                   ` (9 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Noah-Huppert @ 2020-08-10  6:34 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 314 bytes --]

New review comment by Noah-Huppert on void-packages repository

https://github.com/void-linux/void-packages/pull/24191#discussion_r467709996

Comment:
Yep need `EXIT` error or else a C-c wouldn't be caught. I tested by adding a 100 second sleep and hitting C-c, of course it didn't trap so the lock still dangled.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PR REVIEW] xbps-src: fixed dangling binpkg lock on error
  2020-08-10  6:01 [PR PATCH] xbps-src: fixed dangling binpkg lock on error Noah-Huppert
                   ` (6 preceding siblings ...)
  2020-08-10  6:34 ` [PR REVIEW] " Noah-Huppert
@ 2020-08-10 15:28 ` Noah-Huppert
  2020-08-10 15:33 ` ahesford
                   ` (8 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Noah-Huppert @ 2020-08-10 15:28 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 308 bytes --]

New review comment by Noah-Huppert on void-packages repository

https://github.com/void-linux/void-packages/pull/24191#discussion_r467709996

Comment:
Yep need `EXIT` or else a C-c wouldn't be caught. I tested by adding a 100 second sleep and hitting C-c, of course it didn't trap so the lock still dangled.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PR REVIEW] xbps-src: fixed dangling binpkg lock on error
  2020-08-10  6:01 [PR PATCH] xbps-src: fixed dangling binpkg lock on error Noah-Huppert
                   ` (7 preceding siblings ...)
  2020-08-10 15:28 ` Noah-Huppert
@ 2020-08-10 15:33 ` ahesford
  2020-08-10 15:35 ` [PR PATCH] [Updated] " Noah-Huppert
                   ` (7 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: ahesford @ 2020-08-10 15:33 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 225 bytes --]

New review comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/24191#discussion_r467989564

Comment:
Shouldn't the `trap` reset occur after the lock is removed to avoid any race?

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PR PATCH] [Updated] xbps-src: fixed dangling binpkg lock on error
  2020-08-10  6:01 [PR PATCH] xbps-src: fixed dangling binpkg lock on error Noah-Huppert
                   ` (8 preceding siblings ...)
  2020-08-10 15:33 ` ahesford
@ 2020-08-10 15:35 ` Noah-Huppert
  2020-08-10 15:37 ` [PR REVIEW] " Noah-Huppert
                   ` (6 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Noah-Huppert @ 2020-08-10 15:35 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 4601 bytes --]

There is an updated pull request by Noah-Huppert against master on the void-packages repository

https://github.com/Noah-Huppert/void-packages binpkgs-lock-fix
https://github.com/void-linux/void-packages/pull/24191

xbps-src: fixed dangling binpkg lock on error
Fixes #21020. 

Previously if a binpkg failed to be created due to [`xbps-create` falling over in `common/hooks/do-pkg/00-gen-pkg.sh`](https://github.com/void-linux/void-packages/blob/master/common/hooks/do-pkg/00-gen-pkg.sh#L63) it would leave a `hostdir/binpkgs/*.lock` file around.

This fix traps `ERR` and `EXIT` right after the lock file is created. If an error occurs it deletes the lock file. Right before the lock file is deleted it untraps `ERR` and `EXIT`.

There was an [`xbps-create` return value check in the source](https://github.com/void-linux/void-packages/blob/master/common/hooks/do-pkg/00-gen-pkg.sh#L88-L95). However I think the script is running with `set -e` which results in the failure of `xbps-create` exiting the process. Trapping `ERR` prevents the process from exiting.Trapping `EXIT` prevents the process from exiting if the user hits C-c during the `xbps-create` process.

**Before**  
Before these changes when a binpkg build failed due to `xbps-create` falling over it would look like so:

```
=> kernel-libc-headers-4.19.0_2: running do-pkg hook: 00-gen-pkg ...
=> Creating kernel-libc-headers-4.19.0_2.x86_64.xbps for repository /home/noah/documents/void-packages/hostdir/binpkgs ...
xbps-create: ERROR: Failed to open .xbps-pkg-XXX7c01am fd for writing: No such file or directory
[noah@ip-172-31-47-23 void-packages]$ => ERROR: kernel-libc-headers-4.19.0_2: do-pkg_00-gen-pkg: 'xbps-create ${_provides:+--provides "${_provides}"} ${_conflicts:+--conflicts "${_conflicts}"} ${_replaces:+--replaces "${_replaces}"} ${_reverts:+--reverts "${_reverts}"} ${_mutable_files:+--mutable-files "${_mutable_files}"} ${_deps:+--dependencies "${_deps}"} ${_conf_files:+--config-files "${_conf_files}"} ${PKG_BUILD_OPTIONS:+--build-options "${PKG_BUILD_OPTIONS}"} ${_gitrevs:+--source-revisions "${_gitrevs}"} ${_shprovides:+--shlib-provides "${_shprovides}"} ${_shrequires:+--shlib-requires "${_shrequires}"} ${_alternatives:+--alternatives "${_alternatives}"} ${_preserve:+--preserve} ${tags:+--tags "${tags}"} ${_changelog:+--changelog "${_changelog}"} ${XBPS_PKG_COMPTYPE:+--compression $XBPS_PKG_COMPTYPE} --architecture ${arch} --homepage "${homepage}" --license "${license}" --maintainer "${maintainer}" --desc "${desc}" --pkgver "${pkgver}" --quiet ${PKGDESTDIR}' exited with 1
=> ERROR:   in genpkg() at common/hooks/do-pkg/00-gen-pkg.sh:64
=> ERROR:   in hook() at common/hooks/do-pkg/00-gen-pkg.sh:121
=> ERROR:   in run_func() at common/xbps-src/shutils/common.sh:21
=> ERROR:   in run_pkg_hooks() at common/xbps-src/shutils/common.sh:232
=> ERROR:   in main() at common/xbps-src/libexec/xbps-src-dopkg.sh:44
```
(Note: The `xbps-create: ERROR: Failed to open .xbps-pkg-XXX...` error is not relevant, but was produced by `xbps-create` failing, how `xbps-src` handles this failure is the focus of the PR). 

When you tried to re-build any package which previously had a failed binpkg it would [spin forever trying to acquire the lock](https://github.com/void-linux/void-packages/blob/master/common/hooks/do-pkg/00-gen-pkg.sh#L15-L18):

```
./xbps-src pkg kernel-libc-headers
=> kernel-libc-headers-4.19.0_2: running do-pkg hook: 00-gen-pkg ...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
...
```

**After**  

With the changes a binpkg build failing due to xbps-create appears as:

```
=> Creating kernel-libc-headers-4.19.0_2.x86_64.xbps for repository /home/noah/documents/void-packages/hostdir/binpkgs ...
xbps-create: ERROR: Failed to open .xbps-pkg-XXX316nSv fd for writing: No such file or directory
=> Unlocking kernel-libc-headers-4.19.0_2.x86_64.xbps.lock because an error occurred during kernel-libc-headers-4.19.0_2.x86_64.xbps creation
=> ERROR: Failed to created binary package: kernel-libc-headers-4.19.0_2.x86_64.xbps!
```

When you try to re-build any package with a previously failed binpkg the lock file does not exist. So the build will run normally. 

A patch file from https://github.com/void-linux/void-packages/pull/24191.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-binpkgs-lock-fix-24191.patch --]
[-- Type: text/x-diff, Size: 1062 bytes --]

From c16a4fb372cd1620e0e2541aeb54592c5a16488d Mon Sep 17 00:00:00 2001
From: Noah Huppert <contact@noahh.io>
Date: Mon, 10 Aug 2020 11:35:44 -0400
Subject: [PATCH] [ci skip] xbps-src: fixed dangling binpkg lock on error

---
 common/hooks/do-pkg/00-gen-pkg.sh | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/common/hooks/do-pkg/00-gen-pkg.sh b/common/hooks/do-pkg/00-gen-pkg.sh
index e6285b6e4ff..ea8c47b6275 100644
--- a/common/hooks/do-pkg/00-gen-pkg.sh
+++ b/common/hooks/do-pkg/00-gen-pkg.sh
@@ -23,6 +23,15 @@ genpkg() {
 		return 0
 	fi
 
+	# Lock binpkg
+	unlock_binpkg() {
+	    if [ -f "$pkgdir/${binpkg}.lock" ]; then
+		   msg_normal "Unlocking ${binpkg}.lock because an error occurred during $binpkg creation"
+		   rm -f $pkgdir/${binpkg}.lock
+	    fi
+	}
+
+	trap unlock_binpkg ERR EXIT
 	touch -f $pkgdir/${binpkg}.lock
 
 	if [ ! -d $pkgdir ]; then
@@ -87,7 +96,9 @@ genpkg() {
 		${PKGDESTDIR}
 	rval=$?
 
+	# Unlock binpkg
 	rm -f $pkgdir/${binpkg}.lock
+	trap - ERR EXIT
 
 	if [ $rval -ne 0 ]; then
 		rm -f $pkgdir/$binpkg

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PR REVIEW] xbps-src: fixed dangling binpkg lock on error
  2020-08-10  6:01 [PR PATCH] xbps-src: fixed dangling binpkg lock on error Noah-Huppert
                   ` (9 preceding siblings ...)
  2020-08-10 15:35 ` [PR PATCH] [Updated] " Noah-Huppert
@ 2020-08-10 15:37 ` Noah-Huppert
  2020-08-10 15:51 ` ahesford
                   ` (5 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Noah-Huppert @ 2020-08-10 15:37 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 475 bytes --]

New review comment by Noah-Huppert on void-packages repository

https://github.com/void-linux/void-packages/pull/24191#discussion_r467994688

Comment:
Yea I think you're right. I modified the trap function so it checks to see if the lock file exists before deleting it. This allowed me to move the trap to before the lock file is created and the untrap to after the file is removed. This should cover all the bases, including if the lock file fails to be created or removed.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: xbps-src: fixed dangling binpkg lock on error
  2020-08-10  6:01 [PR PATCH] xbps-src: fixed dangling binpkg lock on error Noah-Huppert
                   ` (10 preceding siblings ...)
  2020-08-10 15:37 ` [PR REVIEW] " Noah-Huppert
@ 2020-08-10 15:51 ` ahesford
  2020-08-10 16:47 ` [PR PATCH] [Updated] " Noah-Huppert
                   ` (4 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: ahesford @ 2020-08-10 15:51 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 362 bytes --]

New comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/24191#issuecomment-671437108

Comment:
I would drop the message and the test for existence and just `rm -f` the lock silently. There's no need to call attention to the lock in case of error, and `rm -f` won't complain if it tries to remove a nonexistent file.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PR PATCH] [Updated] xbps-src: fixed dangling binpkg lock on error
  2020-08-10  6:01 [PR PATCH] xbps-src: fixed dangling binpkg lock on error Noah-Huppert
                   ` (11 preceding siblings ...)
  2020-08-10 15:51 ` ahesford
@ 2020-08-10 16:47 ` Noah-Huppert
  2020-08-10 16:47 ` Noah-Huppert
                   ` (3 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Noah-Huppert @ 2020-08-10 16:47 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 4601 bytes --]

There is an updated pull request by Noah-Huppert against master on the void-packages repository

https://github.com/Noah-Huppert/void-packages binpkgs-lock-fix
https://github.com/void-linux/void-packages/pull/24191

xbps-src: fixed dangling binpkg lock on error
Fixes #21020. 

Previously if a binpkg failed to be created due to [`xbps-create` falling over in `common/hooks/do-pkg/00-gen-pkg.sh`](https://github.com/void-linux/void-packages/blob/master/common/hooks/do-pkg/00-gen-pkg.sh#L63) it would leave a `hostdir/binpkgs/*.lock` file around.

This fix traps `ERR` and `EXIT` right after the lock file is created. If an error occurs it deletes the lock file. Right before the lock file is deleted it untraps `ERR` and `EXIT`.

There was an [`xbps-create` return value check in the source](https://github.com/void-linux/void-packages/blob/master/common/hooks/do-pkg/00-gen-pkg.sh#L88-L95). However I think the script is running with `set -e` which results in the failure of `xbps-create` exiting the process. Trapping `ERR` prevents the process from exiting.Trapping `EXIT` prevents the process from exiting if the user hits C-c during the `xbps-create` process.

**Before**  
Before these changes when a binpkg build failed due to `xbps-create` falling over it would look like so:

```
=> kernel-libc-headers-4.19.0_2: running do-pkg hook: 00-gen-pkg ...
=> Creating kernel-libc-headers-4.19.0_2.x86_64.xbps for repository /home/noah/documents/void-packages/hostdir/binpkgs ...
xbps-create: ERROR: Failed to open .xbps-pkg-XXX7c01am fd for writing: No such file or directory
[noah@ip-172-31-47-23 void-packages]$ => ERROR: kernel-libc-headers-4.19.0_2: do-pkg_00-gen-pkg: 'xbps-create ${_provides:+--provides "${_provides}"} ${_conflicts:+--conflicts "${_conflicts}"} ${_replaces:+--replaces "${_replaces}"} ${_reverts:+--reverts "${_reverts}"} ${_mutable_files:+--mutable-files "${_mutable_files}"} ${_deps:+--dependencies "${_deps}"} ${_conf_files:+--config-files "${_conf_files}"} ${PKG_BUILD_OPTIONS:+--build-options "${PKG_BUILD_OPTIONS}"} ${_gitrevs:+--source-revisions "${_gitrevs}"} ${_shprovides:+--shlib-provides "${_shprovides}"} ${_shrequires:+--shlib-requires "${_shrequires}"} ${_alternatives:+--alternatives "${_alternatives}"} ${_preserve:+--preserve} ${tags:+--tags "${tags}"} ${_changelog:+--changelog "${_changelog}"} ${XBPS_PKG_COMPTYPE:+--compression $XBPS_PKG_COMPTYPE} --architecture ${arch} --homepage "${homepage}" --license "${license}" --maintainer "${maintainer}" --desc "${desc}" --pkgver "${pkgver}" --quiet ${PKGDESTDIR}' exited with 1
=> ERROR:   in genpkg() at common/hooks/do-pkg/00-gen-pkg.sh:64
=> ERROR:   in hook() at common/hooks/do-pkg/00-gen-pkg.sh:121
=> ERROR:   in run_func() at common/xbps-src/shutils/common.sh:21
=> ERROR:   in run_pkg_hooks() at common/xbps-src/shutils/common.sh:232
=> ERROR:   in main() at common/xbps-src/libexec/xbps-src-dopkg.sh:44
```
(Note: The `xbps-create: ERROR: Failed to open .xbps-pkg-XXX...` error is not relevant, but was produced by `xbps-create` failing, how `xbps-src` handles this failure is the focus of the PR). 

When you tried to re-build any package which previously had a failed binpkg it would [spin forever trying to acquire the lock](https://github.com/void-linux/void-packages/blob/master/common/hooks/do-pkg/00-gen-pkg.sh#L15-L18):

```
./xbps-src pkg kernel-libc-headers
=> kernel-libc-headers-4.19.0_2: running do-pkg hook: 00-gen-pkg ...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
...
```

**After**  

With the changes a binpkg build failing due to xbps-create appears as:

```
=> Creating kernel-libc-headers-4.19.0_2.x86_64.xbps for repository /home/noah/documents/void-packages/hostdir/binpkgs ...
xbps-create: ERROR: Failed to open .xbps-pkg-XXX316nSv fd for writing: No such file or directory
=> Unlocking kernel-libc-headers-4.19.0_2.x86_64.xbps.lock because an error occurred during kernel-libc-headers-4.19.0_2.x86_64.xbps creation
=> ERROR: Failed to created binary package: kernel-libc-headers-4.19.0_2.x86_64.xbps!
```

When you try to re-build any package with a previously failed binpkg the lock file does not exist. So the build will run normally. 

A patch file from https://github.com/void-linux/void-packages/pull/24191.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-binpkgs-lock-fix-24191.patch --]
[-- Type: text/x-diff, Size: 907 bytes --]

From a13d7e64428385e87cd6ed9044a97b326f422d8d Mon Sep 17 00:00:00 2001
From: Noah Huppert <contact@noahh.io>
Date: Mon, 10 Aug 2020 12:46:56 -0400
Subject: [PATCH] [ci skip] xbps-src: fixed dangling binpkg lock on error

---
 common/hooks/do-pkg/00-gen-pkg.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/common/hooks/do-pkg/00-gen-pkg.sh b/common/hooks/do-pkg/00-gen-pkg.sh
index e6285b6e4ff..217b913bb89 100644
--- a/common/hooks/do-pkg/00-gen-pkg.sh
+++ b/common/hooks/do-pkg/00-gen-pkg.sh
@@ -23,6 +23,12 @@ genpkg() {
 		return 0
 	fi
 
+	# Lock binpkg
+	unlock_binpkg() {
+	    rm -f $pkgdir/${binpkg}.lock
+	}
+
+	trap unlock_binpkg ERR EXIT
 	touch -f $pkgdir/${binpkg}.lock
 
 	if [ ! -d $pkgdir ]; then
@@ -87,7 +93,9 @@ genpkg() {
 		${PKGDESTDIR}
 	rval=$?
 
+	# Unlock binpkg
 	rm -f $pkgdir/${binpkg}.lock
+	trap - ERR EXIT
 
 	if [ $rval -ne 0 ]; then
 		rm -f $pkgdir/$binpkg

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: xbps-src: fixed dangling binpkg lock on error
  2020-08-10  6:01 [PR PATCH] xbps-src: fixed dangling binpkg lock on error Noah-Huppert
                   ` (12 preceding siblings ...)
  2020-08-10 16:47 ` [PR PATCH] [Updated] " Noah-Huppert
@ 2020-08-10 16:47 ` Noah-Huppert
  2020-08-17 13:42 ` [PR PATCH] [Closed]: " ahesford
                   ` (2 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Noah-Huppert @ 2020-08-10 16:47 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 376 bytes --]

New comment by Noah-Huppert on void-packages repository

https://github.com/void-linux/void-packages/pull/24191#issuecomment-671466218

Comment:
> I would drop the message and the test for existence and just `rm -f` the lock silently. There's no need to call attention to the lock in case of error, and `rm -f` won't complain if it tries to remove a nonexistent file.

done

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PR PATCH] [Closed]: xbps-src: fixed dangling binpkg lock on error
  2020-08-10  6:01 [PR PATCH] xbps-src: fixed dangling binpkg lock on error Noah-Huppert
                   ` (13 preceding siblings ...)
  2020-08-10 16:47 ` Noah-Huppert
@ 2020-08-17 13:42 ` ahesford
  2020-08-17 13:45 ` ahesford
  2020-08-19 20:33 ` Noah-Huppert
  16 siblings, 0 replies; 18+ messages in thread
From: ahesford @ 2020-08-17 13:42 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 4283 bytes --]

There's a closed pull request on the void-packages repository

xbps-src: fixed dangling binpkg lock on error
https://github.com/void-linux/void-packages/pull/24191

Description:
Fixes #21020. 

Previously if a binpkg failed to be created due to [`xbps-create` falling over in `common/hooks/do-pkg/00-gen-pkg.sh`](https://github.com/void-linux/void-packages/blob/master/common/hooks/do-pkg/00-gen-pkg.sh#L63) it would leave a `hostdir/binpkgs/*.lock` file around.

This fix traps `ERR` and `EXIT` right before the lock file is created. If an error occurs it deletes the lock file. Right after the lock file is deleted it untraps `ERR` and `EXIT`.

There was an [`xbps-create` return value check in the source](https://github.com/void-linux/void-packages/blob/master/common/hooks/do-pkg/00-gen-pkg.sh#L88-L95). However I think the script is running with `set -e` which results in the failure of `xbps-create` exiting the process. Trapping `ERR` prevents the process from exiting.Trapping `EXIT` prevents the process from exiting if the user hits C-c during the `xbps-create` process.

**Before**  
Before these changes when a binpkg build failed due to `xbps-create` falling over it would look like so:

```
=> kernel-libc-headers-4.19.0_2: running do-pkg hook: 00-gen-pkg ...
=> Creating kernel-libc-headers-4.19.0_2.x86_64.xbps for repository /home/noah/documents/void-packages/hostdir/binpkgs ...
xbps-create: ERROR: Failed to open .xbps-pkg-XXX7c01am fd for writing: No such file or directory
[noah@ip-172-31-47-23 void-packages]$ => ERROR: kernel-libc-headers-4.19.0_2: do-pkg_00-gen-pkg: 'xbps-create ${_provides:+--provides "${_provides}"} ${_conflicts:+--conflicts "${_conflicts}"} ${_replaces:+--replaces "${_replaces}"} ${_reverts:+--reverts "${_reverts}"} ${_mutable_files:+--mutable-files "${_mutable_files}"} ${_deps:+--dependencies "${_deps}"} ${_conf_files:+--config-files "${_conf_files}"} ${PKG_BUILD_OPTIONS:+--build-options "${PKG_BUILD_OPTIONS}"} ${_gitrevs:+--source-revisions "${_gitrevs}"} ${_shprovides:+--shlib-provides "${_shprovides}"} ${_shrequires:+--shlib-requires "${_shrequires}"} ${_alternatives:+--alternatives "${_alternatives}"} ${_preserve:+--preserve} ${tags:+--tags "${tags}"} ${_changelog:+--changelog "${_changelog}"} ${XBPS_PKG_COMPTYPE:+--compression $XBPS_PKG_COMPTYPE} --architecture ${arch} --homepage "${homepage}" --license "${license}" --maintainer "${maintainer}" --desc "${desc}" --pkgver "${pkgver}" --quiet ${PKGDESTDIR}' exited with 1
=> ERROR:   in genpkg() at common/hooks/do-pkg/00-gen-pkg.sh:64
=> ERROR:   in hook() at common/hooks/do-pkg/00-gen-pkg.sh:121
=> ERROR:   in run_func() at common/xbps-src/shutils/common.sh:21
=> ERROR:   in run_pkg_hooks() at common/xbps-src/shutils/common.sh:232
=> ERROR:   in main() at common/xbps-src/libexec/xbps-src-dopkg.sh:44
```
(Note: The `xbps-create: ERROR: Failed to open .xbps-pkg-XXX...` error is not relevant, but was produced by `xbps-create` failing, how `xbps-src` handles this failure is the focus of the PR). 

When you tried to re-build any package which previously had a failed binpkg it would [spin forever trying to acquire the lock](https://github.com/void-linux/void-packages/blob/master/common/hooks/do-pkg/00-gen-pkg.sh#L15-L18):

```
./xbps-src pkg kernel-libc-headers
=> kernel-libc-headers-4.19.0_2: running do-pkg hook: 00-gen-pkg ...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
=> WARNING: kernel-libc-headers-4.19.0_2: binpkg is being created, waiting for 1s...
...
```

**After**  

With the changes a binpkg build failing due to xbps-create appears as:

```
=> Creating kernel-libc-headers-4.19.0_2.x86_64.xbps for repository /home/noah/documents/void-packages/hostdir/binpkgs ...
xbps-create: ERROR: Failed to open .xbps-pkg-XXX316nSv fd for writing: No such file or directory
=> ERROR: Failed to created binary package: kernel-libc-headers-4.19.0_2.x86_64.xbps!
```

When you try to re-build any package with a previously failed binpkg the lock file does not exist. So the build will run normally. 

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: xbps-src: fixed dangling binpkg lock on error
  2020-08-10  6:01 [PR PATCH] xbps-src: fixed dangling binpkg lock on error Noah-Huppert
                   ` (14 preceding siblings ...)
  2020-08-17 13:42 ` [PR PATCH] [Closed]: " ahesford
@ 2020-08-17 13:45 ` ahesford
  2020-08-19 20:33 ` Noah-Huppert
  16 siblings, 0 replies; 18+ messages in thread
From: ahesford @ 2020-08-17 13:45 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 415 bytes --]

New comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/24191#issuecomment-674891025

Comment:
OK, I pulled this in with some minor changes. Since the `unlock_binpkg` function was a one-liner, I dropped the function and moved the `rm -f` right into the `trap`. Also, the lock name has been pushed into a local variable that is reused throughout the packaging function.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: xbps-src: fixed dangling binpkg lock on error
  2020-08-10  6:01 [PR PATCH] xbps-src: fixed dangling binpkg lock on error Noah-Huppert
                   ` (15 preceding siblings ...)
  2020-08-17 13:45 ` ahesford
@ 2020-08-19 20:33 ` Noah-Huppert
  16 siblings, 0 replies; 18+ messages in thread
From: Noah-Huppert @ 2020-08-19 20:33 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 433 bytes --]

New comment by Noah-Huppert on void-packages repository

https://github.com/void-linux/void-packages/pull/24191#issuecomment-676669820

Comment:
> OK, I pulled this in with some minor changes. Since the `unlock_binpkg` function was a one-liner, I dropped the function and moved the `rm -f` right into the `trap`. Also, the lock name has been pushed into a local variable that is reused throughout the packaging function.

Awesome!

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2020-08-19 20:33 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-10  6:01 [PR PATCH] xbps-src: fixed dangling binpkg lock on error Noah-Huppert
2020-08-10  6:03 ` [PR PATCH] [Updated] " Noah-Huppert
2020-08-10  6:04 ` Noah-Huppert
2020-08-10  6:20 ` [PR REVIEW] " Noah-Huppert
2020-08-10  6:29 ` [PR PATCH] [Updated] " Noah-Huppert
2020-08-10  6:30 ` Noah-Huppert
2020-08-10  6:33 ` Noah-Huppert
2020-08-10  6:34 ` [PR REVIEW] " Noah-Huppert
2020-08-10 15:28 ` Noah-Huppert
2020-08-10 15:33 ` ahesford
2020-08-10 15:35 ` [PR PATCH] [Updated] " Noah-Huppert
2020-08-10 15:37 ` [PR REVIEW] " Noah-Huppert
2020-08-10 15:51 ` ahesford
2020-08-10 16:47 ` [PR PATCH] [Updated] " Noah-Huppert
2020-08-10 16:47 ` Noah-Huppert
2020-08-17 13:42 ` [PR PATCH] [Closed]: " ahesford
2020-08-17 13:45 ` ahesford
2020-08-19 20:33 ` Noah-Huppert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).