From: Alyssa Ross <hi@alyssa.is>
To: Demi Marie Obenour <demiobenour@gmail.com>, devel@spectrum-os.org
Subject: Re: [PATCH 1/2] scripts: format with shfmt
Date: Thu, 02 Oct 2025 11:52:03 +0200 [thread overview]
Message-ID: <87o6qpwrzw.fsf@alyssa.is> (raw)
In-Reply-To: <0234f9af-a92b-4a43-ae7e-12c48f3795c4@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3711 bytes --]
Demi Marie Obenour <demiobenour@gmail.com> writes:
> 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 $(...).
Emacs seems to, but it's probably an exception. I would like to have
soem standard, and I wouldn't mind adopting matched parentheses style,
but I didn't see an option for that in shfmt, at least. If there's a
way to get formatted shell scripts with matched parantheses case items,
then we can both be happy, but otherwise I'm inclined to favour
consistent formatting, especially because I don't think we'd be able to
standardize on a syntax I suspect most shell scripters don't even know
exists (I didn't) without tooling support.
>> 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.
I think it's probably a good thing to have a consistent way of showing
that something is part of a pipeline, since it's so easy to miss the
line-final |.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]
next prev parent reply other threads:[~2025-10-02 9:52 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
2025-10-02 9:52 ` Alyssa Ross [this message]
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=87o6qpwrzw.fsf@alyssa.is \
--to=hi@alyssa.is \
--cc=demiobenour@gmail.com \
--cc=devel@spectrum-os.org \
/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).