Re: [PATCH v3 1/4] Do not ignore errors from tar

Demi Marie Obenour
2025-09-18T02:45:17Z

[-- Attachment #1.1.1: Type: text/plain, Size: 1467 bytes --]

On 9/17/25 07:48, Alyssa Ross wrote:
> Demi Marie Obenour <demiobenour@gmail.com> writes:
>
>> These would be ignored due to a missing -o pipefail in the shell script.
>> As a result, listing nonexistent s6-rc-compile inputs would cause a
>> broken image to be successfully built.
>>
>> Reported-by: Alyssa Ross <hi@alyssa.is>
>> Link: https://spectrum-os.org/lists/archives/spectrum-devel/87segu879h.fsf@alyssa.is
>> Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
>> ---
>> host/rootfs/Makefile | 4 ++--
>> img/app/Makefile | 4 ++--
>> vm/sys/net/Makefile | 4 ++--
>> 3 files changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
>> index e96458dba06ae31129b115b2b649962f8d88187a..2288ae4d22ca817ba9fe8ebfc42326fe38b27c27 100644
>> --- a/host/rootfs/Makefile
>> +++ b/host/rootfs/Makefile
>> @@ -169,8 +169,8 @@ build/etc/s6-rc: $(S6_RC_FILES)
>> mkdir -p $$(dirname $@)
>> rm -rf $@
>>
>> - dir=$$(mktemp -d) && \
>> - tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 2 && \
>> + set -uo pipefail; dir=$$(mktemp -d) || exit; \
>> + { tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 2; } && \
>> s6-rc-compile $@ $$dir; \
>> exit=$$?; rm -r $$dir; exit $$exit
>>
>
> What do the additional { } do?
Cause s6-rc-compile to be skipped if either tar command fails.
--
Sincerely,
Demi Marie Obenour (she/her/hers)

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 7253 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]