From af177f96054c34f3f21fba7237888779cdc7fe9f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 23 May 2023 13:19:29 +1000 Subject: [PATCH 1/5] Bump golang.org/x/net from 0.9.0 to 0.10.0 (#1667) Bumps [golang.org/x/net](https://github.com/golang/net) from 0.9.0 to 0.10.0. - [Commits](https://github.com/golang/net/compare/v0.9.0...v0.10.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index aecea1a6..b159b20e 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e github.com/spf13/cobra v1.7.0 github.com/spf13/pflag v1.0.5 - golang.org/x/net v0.9.0 + golang.org/x/net v0.10.0 golang.org/x/text v0.9.0 gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473 gopkg.in/yaml.v3 v3.0.1 @@ -25,7 +25,7 @@ require ( github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.17 // indirect - golang.org/x/sys v0.7.0 // indirect + golang.org/x/sys v0.8.0 // indirect golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f // indirect ) diff --git a/go.sum b/go.sum index a2704af3..0c38b597 100644 --- a/go.sum +++ b/go.sum @@ -50,11 +50,11 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM= -golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f h1:uF6paiQQebLeSXkrTqHqz0MXhXXS1KgF41eUdBNvxK0= From f7fc4edce206678bea83dfa9334dad783c7ce5ed Mon Sep 17 00:00:00 2001 From: Mike Farah Date: Tue, 23 May 2023 13:26:50 +1000 Subject: [PATCH 2/5] Preparing release notes --- release_notes.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/release_notes.txt b/release_notes.txt index a7e2b363..3b1a79a2 100644 --- a/release_notes.txt +++ b/release_notes.txt @@ -1,3 +1,8 @@ +4.34.1: + - Added shell output format thanks @giorgiga + - Fixed nil pointer dereference (#1649) thanks @ArthurFritz + - Bumped dependency versions + 4.33.3: - Fixed bug when splatting empty array #1613 - Added scalar output for TOML (#1617) From 5ef537f3fd1a9437aa3ee44c32c6459a126efdc4 Mon Sep 17 00:00:00 2001 From: Mike Farah Date: Tue, 23 May 2023 13:27:28 +1000 Subject: [PATCH 3/5] Bumping version --- cmd/version.go | 2 +- snap/snapcraft.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/version.go b/cmd/version.go index 6a8f143b..8efc91cf 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -11,7 +11,7 @@ var ( GitDescribe string // Version is main version number that is being run at the moment. - Version = "v4.33.3" + Version = "v4.34.1" // VersionPrerelease is a pre-release marker for the version. If this is "" (empty string) // then it means that it is a final release. Otherwise, this is a pre-release diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 39224575..ea9a14a0 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,5 +1,5 @@ name: yq -version: 'v4.33.3' +version: 'v4.34.1' summary: A lightweight and portable command-line YAML processor description: | The aim of the project is to be the jq or sed of yaml files. From 5950329e2cca62cdac114afa6dec27026bb224a0 Mon Sep 17 00:00:00 2001 From: Mike Farah Date: Tue, 23 May 2023 15:35:39 +1000 Subject: [PATCH 4/5] Added docs on yes/no being strings in yaml spec 1.2 --- README.md | 1 + pkg/yqlib/doc/operators/boolean-operators.md | 18 ++++++++++++++++++ pkg/yqlib/operator_booleans_test.go | 10 ++++++++++ 3 files changed, 29 insertions(+) diff --git a/README.md b/README.md index 6d17241c..637bd2ad 100644 --- a/README.md +++ b/README.md @@ -362,5 +362,6 @@ Use "yq [command] --help" for more information about a command. ## Known Issues / Missing Features - `yq` attempts to preserve comment positions and whitespace as much as possible, but it does not handle all scenarios (see https://github.com/go-yaml/yaml/tree/v3 for details) - Powershell has its own...[opinions on quoting yq](https://mikefarah.gitbook.io/yq/usage/tips-and-tricks#quotes-in-windows-powershell) +- "yes", "no" were dropped as boolean values in the yaml 1.2 standard - which is the standard yq assumes. See [tips and tricks](https://mikefarah.gitbook.io/yq/usage/tips-and-tricks) for more common problems and solutions. diff --git a/pkg/yqlib/doc/operators/boolean-operators.md b/pkg/yqlib/doc/operators/boolean-operators.md index c409445a..887817d7 100644 --- a/pkg/yqlib/doc/operators/boolean-operators.md +++ b/pkg/yqlib/doc/operators/boolean-operators.md @@ -26,6 +26,24 @@ will output true ``` +## "yes" and "no" are strings +In the yaml 1.2 standard, support for yes/no as booleans was dropped - they are now considered strings. See '10.2.1.2. Boolean' in https://yaml.org/spec/1.2.2/ + +Given a sample.yml file of: +```yaml +- yes +- no +``` +then +```bash +yq '.[] | tag' sample.yml +``` +will output +```yaml +!!str +!!str +``` + ## `and` example Running ```bash diff --git a/pkg/yqlib/operator_booleans_test.go b/pkg/yqlib/operator_booleans_test.go index dc219ad1..c48c5307 100644 --- a/pkg/yqlib/operator_booleans_test.go +++ b/pkg/yqlib/operator_booleans_test.go @@ -12,6 +12,16 @@ var booleanOperatorScenarios = []expressionScenario{ "D0, P[], (!!bool)::true\n", }, }, + { + description: "\"yes\" and \"no\" are strings", + subdescription: "In the yaml 1.2 standard, support for yes/no as booleans was dropped - they are now considered strings. See '10.2.1.2. Boolean' in https://yaml.org/spec/1.2.2/", + document: `[yes, no]`, + expression: `.[] | tag`, + expected: []string{ + "D0, P[0], (!!str)::!!str\n", + "D0, P[1], (!!str)::!!str\n", + }, + }, { skipDoc: true, document: "b: hi", From fcc04823ca158ecf361317d76986b2d9e6e947b8 Mon Sep 17 00:00:00 2001 From: Mike Farah Date: Tue, 23 May 2023 15:38:08 +1000 Subject: [PATCH 5/5] Added docs on base64 only working with utf8 content --- pkg/yqlib/doc/operators/encode-decode.md | 2 +- pkg/yqlib/doc/operators/headers/encode-decode.md | 2 +- pkg/yqlib/doc/operators/headers/load.md | 2 ++ pkg/yqlib/doc/operators/load.md | 2 ++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/yqlib/doc/operators/encode-decode.md b/pkg/yqlib/doc/operators/encode-decode.md index 65f76322..b3b02aad 100644 --- a/pkg/yqlib/doc/operators/encode-decode.md +++ b/pkg/yqlib/doc/operators/encode-decode.md @@ -25,7 +25,7 @@ See CSV and TSV [documentation](https://mikefarah.gitbook.io/yq/usage/csv-tsv) f XML uses the `--xml-attribute-prefix` and `xml-content-name` flags to identify attributes and content fields. -Base64 assumes [rfc4648](https://rfc-editor.org/rfc/rfc4648.html) encoding. Encoding and decoding both assume that the content is a string. +Base64 assumes [rfc4648](https://rfc-editor.org/rfc/rfc4648.html) encoding. Encoding and decoding both assume that the content is a utf-8 string and not binary content. ## Encode value as json string Given a sample.yml file of: diff --git a/pkg/yqlib/doc/operators/headers/encode-decode.md b/pkg/yqlib/doc/operators/headers/encode-decode.md index b5108de4..88e2a020 100644 --- a/pkg/yqlib/doc/operators/headers/encode-decode.md +++ b/pkg/yqlib/doc/operators/headers/encode-decode.md @@ -25,4 +25,4 @@ See CSV and TSV [documentation](https://mikefarah.gitbook.io/yq/usage/csv-tsv) f XML uses the `--xml-attribute-prefix` and `xml-content-name` flags to identify attributes and content fields. -Base64 assumes [rfc4648](https://rfc-editor.org/rfc/rfc4648.html) encoding. Encoding and decoding both assume that the content is a string. +Base64 assumes [rfc4648](https://rfc-editor.org/rfc/rfc4648.html) encoding. Encoding and decoding both assume that the content is a utf-8 string and not binary content. diff --git a/pkg/yqlib/doc/operators/headers/load.md b/pkg/yqlib/doc/operators/headers/load.md index 9989f2ff..d6ad6085 100644 --- a/pkg/yqlib/doc/operators/headers/load.md +++ b/pkg/yqlib/doc/operators/headers/load.md @@ -14,6 +14,8 @@ You can load files of the following supported types: | Plain String | load_str | | Base64 | load_base64 | +Note that load_base64 only works for base64 encoded utf-8 strings. + ## Samples files for tests: ### yaml diff --git a/pkg/yqlib/doc/operators/load.md b/pkg/yqlib/doc/operators/load.md index 79dc0149..dc0463aa 100644 --- a/pkg/yqlib/doc/operators/load.md +++ b/pkg/yqlib/doc/operators/load.md @@ -14,6 +14,8 @@ You can load files of the following supported types: | Plain String | load_str | | Base64 | load_base64 | +Note that load_base64 only works for base64 encoded utf-8 strings. + ## Samples files for tests: ### yaml