diff --git a/CHANGELOG.md b/CHANGELOG.md index 5529e708..1eb99005 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,11 +14,11 @@ and this project adheres to @@ -27,11 +27,9 @@ NOTE: Add new changes BELOW THIS COMMENT. - Requirements to domain names in domain-specific upstream configurations have been relaxed to meet those from [RFC 3696][rfc3696] ([#4884]). -- Panic when using unencrypted DNS-over-HTTPS ([#5518]). - Failing service installation via script on FreeBSD ([#5431]). [#4884]: https://github.com/AdguardTeam/AdGuardHome/issues/4884 -[#5518]: https://github.com/AdguardTeam/AdGuardHome/issues/5518 [#5431]: https://github.com/AdguardTeam/AdGuardHome/issues/5431 [rfc3696]: https://datatracker.ietf.org/doc/html/rfc3696 @@ -42,6 +40,20 @@ NOTE: Add new changes ABOVE THIS COMMENT. +## [v0.107.25] - 2023-02-21 + +See also the [v0.107.25 GitHub milestone][ms-v0.107.25]. + +### Fixed + +- Panic when using unencrypted DNS-over-HTTPS ([#5518]). + +[#5518]: https://github.com/AdguardTeam/AdGuardHome/issues/5518 + +[ms-v0.107.25]: https://github.com/AdguardTeam/AdGuardHome/milestone/61?closed=1 + + + ## [v0.107.24] - 2023-02-15 See also the [v0.107.24 GitHub milestone][ms-v0.107.24]. @@ -1682,11 +1694,12 @@ See also the [v0.104.2 GitHub milestone][ms-v0.104.2]. -[Unreleased]: https://github.com/AdguardTeam/AdGuardHome/compare/v0.107.24...HEAD +[Unreleased]: https://github.com/AdguardTeam/AdGuardHome/compare/v0.107.25...HEAD +[v0.107.25]: https://github.com/AdguardTeam/AdGuardHome/compare/v0.107.24...v0.107.25 [v0.107.24]: https://github.com/AdguardTeam/AdGuardHome/compare/v0.107.23...v0.107.24 [v0.107.23]: https://github.com/AdguardTeam/AdGuardHome/compare/v0.107.22...v0.107.23 [v0.107.22]: https://github.com/AdguardTeam/AdGuardHome/compare/v0.107.21...v0.107.22 diff --git a/Makefile b/Makefile index ad895f16..864734d4 100644 --- a/Makefile +++ b/Makefile @@ -4,17 +4,26 @@ # See https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html. .POSIX: +# This comment is used to simplify checking local copies of the +# Makefile. Bump this number every time a significant change is made to +# this Makefile. +# +# AdGuard-Project-Version: 2 + +# Don't name these macros "GO" etc., because GNU Make apparently makes +# them exported environment variables with the literal value of +# "${GO:-go}" and so on, which is not what we need. Use a dot in the +# name to make sure that users don't have an environment variable with +# the same name. +# +# See https://unix.stackexchange.com/q/646255/105635. +GO.MACRO = $${GO:-go} +VERBOSE.MACRO = $${VERBOSE:-0} + CHANNEL = development CLIENT_DIR = client COMMIT = $$( git rev-parse --short HEAD ) DIST_DIR = dist -# Don't name this macro "GO", because GNU Make apparenly makes it an -# exported environment variable with the literal value of "${GO:-go}", -# which is not what we need. Use a dot in the name to make sure that -# users don't have an environment variable with the same name. -# -# See https://unix.stackexchange.com/q/646255/105635. -GO.MACRO = $${GO:-go} GOPROXY = https://goproxy.cn|https://proxy.golang.org|direct GOSUMDB = sum.golang.google.cn GPG_KEY = devteam@adguard.com @@ -25,7 +34,6 @@ NPM_INSTALL_FLAGS = $(NPM_FLAGS) --quiet --no-progress --ignore-engines\ --ignore-optional --ignore-platform --ignore-scripts RACE = 0 SIGN = 1 -VERBOSE = 0 VERSION = v0.0.0 YARN = yarn @@ -59,13 +67,13 @@ ENV = env\ RACE='$(RACE)'\ SIGN='$(SIGN)'\ NEXTAPI='$(NEXTAPI)'\ - VERBOSE='$(VERBOSE)'\ + VERBOSE="$(VERBOSE.MACRO)"\ VERSION='$(VERSION)'\ # Keep the line above blank. -# Keep this target first, so that a naked make invocation triggers -# a full build. +# Keep this target first, so that a naked make invocation triggers a +# full build. build: deps quick-build quick-build: js-build go-build @@ -119,4 +127,4 @@ go-os-check: openapi-lint: ; cd ./openapi/ && $(YARN) test openapi-show: ; cd ./openapi/ && $(YARN) start -txt-lint: ; $(ENV) "$(SHELL)" ./scripts/make/txt-lint.sh +txt-lint: ; $(ENV) "$(SHELL)" ./scripts/make/txt-lint.sh diff --git a/internal/tools/tools.go b/internal/tools/tools.go index 230d6c4b..88f55fa9 100644 --- a/internal/tools/tools.go +++ b/internal/tools/tools.go @@ -1,5 +1,4 @@ //go:build tools -// +build tools package tools diff --git a/main.go b/main.go index 6246b19e..85c2795e 100644 --- a/main.go +++ b/main.go @@ -1,5 +1,4 @@ //go:build !next -// +build !next package main diff --git a/main_next.go b/main_next.go index d9773d47..bf3fa8ea 100644 --- a/main_next.go +++ b/main_next.go @@ -1,5 +1,4 @@ //go:build next -// +build next package main diff --git a/scripts/hooks/pre-commit b/scripts/hooks/pre-commit index a76639af..cfb72448 100755 --- a/scripts/hooks/pre-commit +++ b/scripts/hooks/pre-commit @@ -2,10 +2,18 @@ set -e -f -u -# Only show interactive prompts if there is a terminal attached. This -# should work on all of our supported Unix systems. +# This comment is used to simplify checking local copies of the script. +# Bump this number every time a significant change is made to this +# script. +# +# AdGuard-Project-Version: 1 + +# Only show interactive prompts if there a terminal is attached to +# stdout. While this technically doesn't guarantee that reading from +# /dev/tty works, this should work reasonably well on all of our +# supported development systems and in most terminal emulators. is_tty='0' -if [ -e /dev/tty ] +if [ -t '1' ] then is_tty='1' fi diff --git a/scripts/make/go-build.sh b/scripts/make/go-build.sh index 8d993d66..7f629cd8 100644 --- a/scripts/make/go-build.sh +++ b/scripts/make/go-build.sh @@ -6,6 +6,11 @@ # only has superficial knowledge of the POSIX shell language and alike. # Experienced readers may find it overly verbose. +# This comment is used to simplify checking local copies of the script. Bump +# this number every time a significant change is made to this script. +# +# AdGuard-Project-Version: 1 + # The default verbosity level is 0. Show every command that is run and every # package that is processed if the caller requested verbosity level greater than # 0. Also show subcommands if the requested verbosity level is greater than 1. @@ -111,17 +116,17 @@ readonly o_flags # must be enabled. if [ "${RACE:-0}" -eq '0' ] then - cgo_enabled='0' + CGO_ENABLED='0' race_flags='--race=0' else - cgo_enabled='1' + CGO_ENABLED='1' race_flags='--race=1' fi -readonly cgo_enabled race_flags +readonly CGO_ENABLED race_flags +export CGO_ENABLED -CGO_ENABLED="$cgo_enabled" GO111MODULE='on' -export CGO_ENABLED GO111MODULE +export GO111MODULE # Build the new binary if requested. if [ "${NEXTAPI:-0}" -eq '0' ] @@ -132,5 +137,16 @@ else fi readonly tags_flags -"$go" build --ldflags "$ldflags" "$race_flags" "$tags_flags" --trimpath "$o_flags" "$v_flags"\ +if [ "$verbose" -gt '0' ] +then + "$go" env +fi + +"$go" build\ + --ldflags "$ldflags"\ + "$race_flags"\ + "$tags_flags"\ + --trimpath\ + "$o_flags"\ + "$v_flags"\ "$x_flags" diff --git a/scripts/make/go-deps.sh b/scripts/make/go-deps.sh index 58ba720b..f12d2df7 100644 --- a/scripts/make/go-deps.sh +++ b/scripts/make/go-deps.sh @@ -1,5 +1,10 @@ #!/bin/sh +# This comment is used to simplify checking local copies of the script. Bump +# this number every time a significant change is made to this script. +# +# AdGuard-Project-Version: 1 + verbose="${VERBOSE:-0}" readonly verbose @@ -7,14 +12,14 @@ if [ "$verbose" -gt '1' ] then env set -x - x_flags='-x' + x_flags='-x=1' elif [ "$verbose" -gt '0' ] then set -x - x_flags='' + x_flags='-x=0' else set +x - x_flags='' + x_flags='-x=0' fi readonly x_flags @@ -23,6 +28,4 @@ set -e -f -u go="${GO:-go}" readonly go -# Don't use quotes with flag variables because we want an empty space if those -# aren't set. -"$go" mod download $x_flags +"$go" mod download "$x_flags" diff --git a/scripts/make/go-test.sh b/scripts/make/go-test.sh index e37c7f18..03d2c100 100644 --- a/scripts/make/go-test.sh +++ b/scripts/make/go-test.sh @@ -1,5 +1,10 @@ #!/bin/sh +# This comment is used to simplify checking local copies of the script. Bump +# this number every time a significant change is made to this script. +# +# AdGuard-Project-Version: 1 + verbose="${VERBOSE:-0}" readonly verbose @@ -43,5 +48,12 @@ shuffle_flags='--shuffle=on' timeout_flags="${TIMEOUT_FLAGS:---timeout=90s}" readonly count_flags cover_flags shuffle_flags timeout_flags -"$go" test "$count_flags" "$cover_flags" "$race_flags" "$shuffle_flags" "$timeout_flags"\ - "$x_flags" "$v_flags" ./... +"$go" test\ + "$count_flags"\ + "$cover_flags"\ + "$shuffle_flags"\ + "$race_flags"\ + "$timeout_flags"\ + "$x_flags"\ + "$v_flags"\ + ./... diff --git a/scripts/make/go-tools.sh b/scripts/make/go-tools.sh index a66d5c06..ba512dc3 100644 --- a/scripts/make/go-tools.sh +++ b/scripts/make/go-tools.sh @@ -1,22 +1,27 @@ #!/bin/sh +# This comment is used to simplify checking local copies of the script. Bump +# this number every time a significant change is made to this script. +# +# AdGuard-Project-Version: 2 + verbose="${VERBOSE:-0}" readonly verbose if [ "$verbose" -gt '1' ] then set -x - v_flags='-v' - x_flags='-x' + v_flags='-v=1' + x_flags='-x=1' elif [ "$verbose" -gt '0' ] then set -x - v_flags='-v' - x_flags='' + v_flags='-v=1' + x_flags='-x=0' else set +x - v_flags='' - x_flags='' + v_flags='-v=0' + x_flags='-x=0' fi readonly v_flags x_flags @@ -27,6 +32,25 @@ readonly go # TODO(a.garipov): Add goconst? +# Remove only the actual binaries in the bin/ directory, as developers may add +# their own scripts there. Most commonly, a script named “go” for tools that +# call the go binary and need a particular version. +rm -f\ + bin/errcheck\ + bin/fieldalignment\ + bin/gocyclo\ + bin/gofumpt\ + bin/gosec\ + bin/govulncheck\ + bin/ineffassign\ + bin/looppointer\ + bin/misspell\ + bin/nilness\ + bin/shadow\ + bin/staticcheck\ + bin/unparam\ + ; + # Reset GOARCH and GOOS to make sure we install the tools for the native # architecture even when we're cross-compiling the main binary, and also to # prevent the "cannot install cross-compiled binaries when GOBIN is set" error. @@ -37,14 +61,15 @@ env\ GOWORK='off'\ "$go" install\ --modfile=./internal/tools/go.mod\ - $v_flags\ - $x_flags\ + "$v_flags"\ + "$x_flags"\ github.com/fzipp/gocyclo/cmd/gocyclo\ github.com/golangci/misspell/cmd/misspell\ github.com/gordonklaus/ineffassign\ github.com/kisielk/errcheck\ github.com/kyoh86/looppointer/cmd/looppointer\ github.com/securego/gosec/v2/cmd/gosec\ + golang.org/x/tools/go/analysis/passes/fieldalignment/cmd/fieldalignment\ golang.org/x/tools/go/analysis/passes/nilness/cmd/nilness\ golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow\ golang.org/x/vuln/cmd/govulncheck\