Skip to content

Fix a few syntax issues in shell scripts - #62102

Merged
safern merged 4 commits into
dotnet:mainfrom
am11:feature/build/script-fixes
Nov 30, 2021
Merged

Fix a few syntax issues in shell scripts#62102
safern merged 4 commits into
dotnet:mainfrom
am11:feature/build/script-fixes

Conversation

@am11

@am11am11 commented Nov 27, 2021

Copy link
Copy Markdown
Member

This delta updates shell scripts for consistency. In particular, avoid mixing Bash and Unix shell syntax by replacing:

  • [ $x == $y ] and [[ $x = $y ]] with [[ $x == $y ]]
  • [[ $x ]] && [[ $y ]] and [ $x ] && [ $y ] with [[ $x && $y ]]
  • [ ! -z $x ] and [ $x != "" ] with [ -n $x ]
  • [ ! -n $x ] and [ $x == "" ] with [ -z $x ]
  • ! $x == $y with $x != $y
  • #!/bin/bash with #!/usr/bin/env bash
  • [[ with [ in files with /bin/sh shebang

@ghost

Copy link
Copy Markdown

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@am11
am11force-pushed the feature/build/script-fixes branch from 9520955 to ab8553cCompareNovember 28, 2021 01:09
```sh
# git remote add dotnet https://github.com/dotnet/runtime && git pull --rebase dotnet main
if uname 2>/devnull | grep -q Darwin; then
space=" "
fi
git show --name-only --pretty="" HEAD...dotnet/main |\
xargs -I{} sh -c "test -f {} && sed -i$space'' 's/[[:space:]]*$//' {}"
```
@am11
am11force-pushed the feature/build/script-fixes branch from ab8553c to 17c6508CompareNovember 28, 2021 17:19
@ghost

Copy link
Copy Markdown

Tagging subscribers to this area: @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

Issue Details

This delta updates shell scripts for consistency. In particular, avoid mixing Bash and Unix shell syntax by replacing:

  • [ $x == $y ] and [[ $x = $y ]] with [[ $x == $y ]]
  • [[ $x ]] && [[ $y ]] and [ $x ] && [ $y ] with [[ $x && $y ]]
  • [ ! -z $x ] and [ $x != "" ] with [ -n $x ]
  • [ ! -n $x ] and [ $x == "" ] with [ -z $x ]
  • ! $x == $y with $x != $y
  • #!/bin/bash with #!/usr/bin/env bash
  • [[ with [ in files with /bin/sh shebang
Author:am11
Assignees:-
Labels:

area-Infrastructure

Milestone:-

@hoyosjshoyosjs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple minor questions.

Comment threadeng/run-test.sh Outdated
Comment threadsrc/mono/mono/tests/verifier/make_il_overflow_test.sh Outdated

@hoyosjshoyosjs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@am11

am11 commented Nov 30, 2021

Copy link
Copy Markdown
MemberAuthor

Resolved merge conflict with 85642f8.
@hoyosjs, I don't have permissions, could you please merge this? Thanks.

@safern

Copy link
Copy Markdown
Member

@radical could you please look at the staging failure?

@safern
safern merged commit 6cc2d2e into dotnet:mainNov 30, 2021
@am11
am11 deleted the feature/build/script-fixes branch November 30, 2021 23:35
@ghostghost locked as resolved and limited conversation to collaborators Dec 31, 2021
@antonfirsov

Copy link
Copy Markdown
Contributor

This change broke the (non-mandatory) SslStress pipeline.

When touching SslStress and HttpStress, please make sure to run the corresponding pipelines:

/azp run runtime-libraries stress-http
/azp run runtime-libraries stress-ssl

Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@am11@safern@antonfirsov@hoyosjs@marek-safar