From: Denys Vlasenko <dvlasenk@xxxxxxxxxx> redhat/scripts/expand_srpm.sh: add missing function, robustify "die" (presumably a shell function) is not defined. Add it. Delete the empty line at the end of the script, git complained when I added a copy of this file to another tree. This part will happily execute if someone just accidentally runs the script from the command line with no arguments: cd "$cloned/$PACKAGE_NAME" rm -r -- * ...and might delete most of your files! Add a safeguard against this. While at it, remove superfluous stray semicolons. Signed-off-by: Denys Vlasenko <dvlasenk@xxxxxxxxxx> diff --git a/redhat/scripts/expand_srpm.sh b/redhat/scripts/expand_srpm.sh index blahblah..blahblah 100755 --- a/redhat/scripts/expand_srpm.sh +++ b/redhat/scripts/expand_srpm.sh @@ -1,9 +1,18 @@ #!/bin/sh +die() { + echo "Error: $1" >&2 + exit 1 +} + # $1: cloned tree -cloned="$1"; +cloned="$1" + +# Avoid accidental "rm *" in the root directory +test "$cloned" || die '$1 is not given' +test "$SPECPACKAGE_NAME" || die '$SPECPACKAGE_NAME is not set' -cd "$cloned/$SPECPACKAGE_NAME" || die "\"$cloned\" doesn't seem to have a dist-git clone"; +cd "$cloned/$SPECPACKAGE_NAME" || die "\"$cloned\" doesn't seem to have a dist-git clone" # delete everything in the cloned tree to avoid having stale files rm -r -- * @@ -17,4 +26,3 @@ echo "*.bz2" >> .gitignore rpm2cpio "$SRPM" | cpio -idmv git add -A - -- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2619 _______________________________________________ kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@xxxxxxxxxxxxxxxxxxxxxxx Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue