patches and low-level development discussion
 help / color / mirror / code / Atom feed
From: Demi Marie Obenour <demiobenour@gmail.com>
To: Alyssa Ross <hi@alyssa.is>, devel@spectrum-os.org
Subject: Re: [PATCH 1/2] scripts: format with shfmt
Date: Wed, 1 Oct 2025 13:45:09 -0400	[thread overview]
Message-ID: <0234f9af-a92b-4a43-ae7e-12c48f3795c4@gmail.com> (raw)
In-Reply-To: <20251001102838.7086-2-hi@alyssa.is>


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

On 10/1/25 06:27, Alyssa Ross wrote:
> This is actually a treewide shfmt run, but I guess nothing outside of
> scripts/ has any formatting issues.
> 
> Signed-off-by: Alyssa Ross <hi@alyssa.is>
> ---
>  scripts/dist-cloud-hypervisor.sh |   4 +-
>  scripts/format-uuid.sh           |   2 +-
>  scripts/make-erofs.sh            |   8 +--
>  scripts/run-qemu.sh              | 109 ++++++++++++++++---------------
>  scripts/update-nixpkgs.sh        |   4 +-
>  5 files changed, 64 insertions(+), 63 deletions(-)
> 
> diff --git a/scripts/dist-cloud-hypervisor.sh b/scripts/dist-cloud-hypervisor.sh
> index 603c2df..22bcbaa 100755
> --- a/scripts/dist-cloud-hypervisor.sh
> +++ b/scripts/dist-cloud-hypervisor.sh
> @@ -16,6 +16,6 @@ trap 'rm -rf -- "$dir"' EXIT
>  mkdir -p -- "$dir/$name/LICENSES"
>  cp -- LICENSES/Apache-2.0.txt LICENSES/LicenseRef-BSD-3-Clause-Google.txt \
>  	"$dir/$name/LICENSES"
> -cat pkgs/cloud-hypervisor/*.patch > "$dir/$name/cloud-hypervisor.patch"
> -cat pkgs/cloud-hypervisor/vhost/*.patch > "$dir/$name/vhost.patch"
> +cat pkgs/cloud-hypervisor/*.patch >"$dir/$name/cloud-hypervisor.patch"
> +cat pkgs/cloud-hypervisor/vhost/*.patch >"$dir/$name/vhost.patch"
>  tar -C "$dir" -czf "$name.tar.gz" -- "$name"
> diff --git a/scripts/format-uuid.sh b/scripts/format-uuid.sh
> index 497a5f2..3b38278 100755
> --- a/scripts/format-uuid.sh
> +++ b/scripts/format-uuid.sh
> @@ -4,7 +4,7 @@
>  # SPDX-FileCopyrightText: 2022 Unikie
>  # SPDX-License-Identifier: EUPL-1.2+
>  
> -substr () {
> +substr() {
>  	str=$1
>  	beg=$2
>  	end=$3
> diff --git a/scripts/make-erofs.sh b/scripts/make-erofs.sh
> index ad04844..7e46847 100755
> --- a/scripts/make-erofs.sh
> +++ b/scripts/make-erofs.sh
> @@ -35,8 +35,8 @@ while read -r arg1; do
>  	# a subset of all paths, but this subset includes all of
>  	# the ones passed in practice other than /.
>  	case $arg2 in
> -	(*/*) parent=${arg2%/*};;
> -	(*) parent=.;;
> +	*/*) parent=${arg2%/*} ;;
> +	*) parent=. ;;
>  	esac

I *really* don't like introducing mismatched parentheses, as it
breaks parentheses matching in editors.  Editors know about quoting,
but probably not about case statements.  Also, at least some shells
misparse the form without the extra parentheses when inside $(...).

>  	# Ensure any existing directories we want to write into are writable.
> @@ -50,8 +50,8 @@ while read -r arg1; do
>  
>  			# shellcheck disable=SC2030 # shadowed on purpose
>  			case "$parent" in
> -				*/*) parent="${parent%/*}" ;;
> -				*) break ;;
> +			*/*) parent="${parent%/*}" ;;
> +			*) break ;;
>  			esac
>  		done
>  
> diff --git a/scripts/run-qemu.sh b/scripts/run-qemu.sh
> index 64fd292..75ecef4 100755
> --- a/scripts/run-qemu.sh
> +++ b/scripts/run-qemu.sh
> @@ -6,14 +6,14 @@
>  # which can't be handled portably in Make language.
>  
>  case "${ARCH:="$(uname -m)"}" in
> -	aarch64)
> -		machine=virt,accel=kvm:tcg,gic-version=3,iommu=smmuv3
> -		;;
> -	x86_64)
> -		append="console=ttyS0${append:+ $append}"
> -		iommu=intel-iommu,intremap=on
> -		machine=q35,accel=kvm:tcg,kernel-irqchip=split
> -		;;
> +aarch64)
> +	machine=virt,accel=kvm:tcg,gic-version=3,iommu=smmuv3
> +	;;
> +x86_64)
> +	append="console=ttyS0${append:+ $append}"
> +	iommu=intel-iommu,intremap=on
> +	machine=q35,accel=kvm:tcg,kernel-irqchip=split
> +	;;
>  esac
>  
>  i=0
> @@ -22,49 +22,50 @@ while [ $i -lt $# ]; do
>  	shift
>  
>  	case "$arg" in
> -		-append)
> -			set -- "$@" -append "${append:+$append }$1"
> -			i=$((i + 2))
> -			shift
> -			continue
> -			;;
> -		-device)
> -			IFS=,
> -			for opt in $1; do
> -				case "$opt" in
> -					*-iommu)
> -						unset iommu
> -						;;
> +	-append)
> +		set -- "$@" -append "${append:+$append }$1"
> +		i=$((i + 2))
> +		shift
> +		continue
> +		;;
> +	-device)
> +		IFS=,
> +		for opt in $1; do
> +			case "$opt" in
> +			*-iommu)
> +				unset iommu
> +				;;
> +			esac
> +			break
> +		done
> +		unset IFS
> +		;;
> +	-machine)
> +		set -- "$@" "$arg"
> +		i=$((i + 1))
> +		arg=
> +
> +		IFS=,
> +		for opt in $1; do
> +			case "$opt" in
> +			virtualization=on)
> +				case "$ARCH" in
> +				aarch64)
> +					opt="$opt,accel=tcg"
> +					;;
> +				*)
> +					continue
> +					;;
>  				esac
> -				break
> -			done
> -			unset IFS
> -			;;
> -		-machine)
> -			set -- "$@" "$arg"
> -			i=$((i + 1))
> -			arg=
> +				;;
> +			esac
>  
> -			IFS=,
> -			for opt in $1; do
> -				case "$opt" in
> -					virtualization=on)
> -						case "$ARCH" in
> -							aarch64)
> -								opt="$opt,accel=tcg"
> -								;;
> -							*)
> -								continue
> -								;;
> -						esac
> -						;;
> -				esac
> +			arg="$arg${arg:+,}$opt"
> +		done
> +		unset IFS
>  
> -				arg="$arg${arg:+,}$opt"
> -			done
> -			unset IFS
> -
> -			shift
> +		shift
> +		;;
>  	esac
>  
>  	set -- "$@" "$arg"
> @@ -74,12 +75,12 @@ done
>  
>  for arg; do
>  	case "$arg" in
> -		-append)
> -			append=
> -			;;
> -		-kernel)
> -			kernel=1
> -			;;
> +	-append)
> +		append=
> +		;;
> +	-kernel)
> +		kernel=1
> +		;;
>  	esac
>  done
>  
> diff --git a/scripts/update-nixpkgs.sh b/scripts/update-nixpkgs.sh
> index dd1b7de..e481eb0 100755
> --- a/scripts/update-nixpkgs.sh
> +++ b/scripts/update-nixpkgs.sh
> @@ -12,11 +12,11 @@ set -ueo pipefail
>  root="$(dirname "$0")/.."
>  out="$(mktemp -p "$root/lib" -t nixpkgs.default.nix.XXXXXXXXXX)"
>  
> -exec > "$out"
> +exec >"$out"
>  
>  rev="$(
>  	curl -fsLS "https://api.github.com/repos/NixOS/nixpkgs/branches/${1-nixos-unstable}" |
> -	jq -r .commit.sha
> +		jq -r .commit.sha

This seems to be pointless extra indentation.

>  )"
>  url="https://github.com/NixOS/nixpkgs/archive/$rev.tar.gz"
>  


-- 
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 --]

  reply	other threads:[~2025-10-01 17:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-01 10:27 [PATCH 0/2] release/checks/shfmt: init Alyssa Ross
2025-10-01 10:27 ` [PATCH 1/2] scripts: format with shfmt Alyssa Ross
2025-10-01 17:45   ` Demi Marie Obenour [this message]
2025-10-02  9:52     ` Alyssa Ross
2025-11-09 18:58   ` Alyssa Ross
2025-10-01 10:27 ` [PATCH 2/2] release/checks/shfmt: init Alyssa Ross
2025-11-09 18:59   ` Alyssa Ross

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=0234f9af-a92b-4a43-ae7e-12c48f3795c4@gmail.com \
    --to=demiobenour@gmail.com \
    --cc=devel@spectrum-os.org \
    --cc=hi@alyssa.is \
    /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.
Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

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).