Skip to content

Commit 1ae8c53

Browse files
authored
Merge pull request ActiveState#3399 from ActiveState/version/0-45-0-RC2
Version 0.45.0-RC2
2 parents e8bf9fd + 2fc054f commit 1ae8c53

File tree

1,612 files changed

+369387
-25689
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,612 files changed

+369387
-25689
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
strategy:
3737
matrix:
3838
go-version:
39-
- 1.20.x
39+
- 1.22.x
4040
sys:
4141
- {os: ubuntu-latest}
4242
- {os: macos-12, shell: zsh}
@@ -175,7 +175,7 @@ jobs:
175175
name: Check Format
176176
id: check_format
177177
shell: bash
178-
if: "!contains(fromJSON('[\"refs/heads/beta\", \"refs/heads/release\", \"refs/heads/LTS\"]'), github.ref) && !startsWith(github.event.pull_request.head.ref, 'version/')"
178+
if: "!contains(fromJSON('[\"refs/heads/beta\", \"refs/heads/release\", \"refs/heads/LTS\", \"refs/heads/master\"]'), github.ref) && !startsWith(github.event.pull_request.head.ref, 'version/')"
179179
run: parallelize results Check-Format
180180

181181
- # === Unit Tests ===

.github/workflows/propagate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
name: Install Go
3535
uses: actions/setup-go@v3
3636
with:
37-
go-version: '1.20.x'
37+
go-version: '1.22.x'
3838

3939
- # === Install State Tool ===
4040
name: Install State Tool

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
name: Install Go
3232
uses: actions/setup-go@v3
3333
with:
34-
go-version: '1.20.x'
34+
go-version: '1.22.x'
3535

3636
- # === Install State Tool ===
3737
name: Install State Tool

.github/workflows/verify.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
name: Install Go
3737
uses: actions/setup-go@v3
3838
with:
39-
go-version: '1.20.x'
39+
go-version: '1.22.x'
4040

4141
- # === Install State Tool ===
4242
name: Install State Tool

activestate.yaml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ scripts:
5151
if: ne .Shell "cmd"
5252
value: |
5353
if ! type "go" &> /dev/null; then
54-
echo "go is not installed. Please install Go version 1.20 or above."
54+
echo "go is not installed. Please install Go version 1.22 or above."
5555
exit 1
5656
fi
5757
if ! type "golangci-lint" &> /dev/null; then
5858
echo "golangci-lint was not found on your PATH, installing .."
59-
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.2
59+
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.59.1
6060
fi
6161
git config core.hooksPath .githooks
6262
if ! type "swagger" &> /dev/null; then
@@ -288,7 +288,7 @@ scripts:
288288
language: bash
289289
description: Runs unit tests (not integration tests)
290290
value: |
291-
ACTIVESTATE_PROJECT="" go test -v `go list ./... | grep -v integration | grep -v automation | grep -v expect | grep -v state-svc | grep -v state-offline` $@
291+
go test -v `go list ./... | grep -v integration | grep -v automation | grep -v expect | grep -v state-svc | grep -v state-offline` $@
292292
standalone: true
293293
- name: integration-tests
294294
language: bash
@@ -373,13 +373,9 @@ scripts:
373373
374374
git fetch --quiet origin $TARGET_BRANCH:refs/remotes/origin/$TARGET_BRANCH
375375
376-
CHANGED=$(git diff --name-only origin/$TARGET_BRANCH)
376+
CHANGED=$(git diff --name-only origin/$TARGET_BRANCH | grep -v testdata | grep -v vendor)
377377
NO_NEWLINE=0
378378
for FILE in $CHANGED; do
379-
if [[ $FILE == vendor/* ]]; then
380-
continue
381-
fi
382-
383379
if file "$FILE" | grep -q -E 'text|ASCII'; then
384380
if [ $(tail -c 1 "$FILE" | wc -l) -eq 0 ]; then
385381
echo "Missing newline at end of file: $FILE"
@@ -458,13 +454,21 @@ scripts:
458454
fi
459455
perf stat -d -r 8 -e task-clock,page-faults,cycles,instructions -- ${@} >/dev/null
460456
${updated} && sudo sh -c 'echo '${paranoid}' >/proc/sys/kernel/perf_event_paranoid'
457+
- name: to-buildscript
458+
language: bash
459+
standalone: true
460+
value: go run $project.path()/scripts/to-buildscript/main.go $@
461+
- name: to-buildexpression
462+
language: bash
463+
standalone: true
464+
value: go run $project.path()/scripts/to-buildexpression/main.go $@
461465

462466
events:
463467
- name: activate
464468
if: ne .Shell "cmd"
465469
value: |
466470
$scripts.install-deps-dev.path()
467471
- name: file-changed
468-
scope: ["internal/locale/locales"]
472+
scope: [ "internal/locale/locales" ]
469473
value: build
470474
config_version: 1

changelog.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,56 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to
77
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
88

9+
## 0.45.0
10+
11+
### Added
12+
13+
* On Linux we will now automatically detect the most appropriate platform based on the system glibc version.
14+
* This only applies if your project has multiple linux platforms defined.
15+
* If you were using the `runtime.preferred.glibc` config option it will still be respected, but you likely won't
16+
need it anymore.
17+
* We now show failed builds when running `state artifacts`. You can still instrument the artifacts that did not fail.
18+
19+
### Changed
20+
21+
* We no longer support running shell-builtins through `state exec`, instead we require that the executable passed in
22+
exists on the system. Running shell-builtins was never the intended behavior, but was a side-effect. You can still
23+
access shell built-ins by running it through a shell, eg. `state exec -- cmd /C "where python3"`.
24+
* Our installers now give slightly better indication that a download is happening, avoiding confusion about the process
25+
hanging.
26+
* We will now produce an error if you have an invalid `if` conditional in your activestate.yaml. Previously these
27+
conditionals were simply assumed to be `false`.
28+
* We will now inform you there is nothing new to commit when running `state commit` with no changes to commit.
29+
* The `LOCAL` and `REMOTE` targets for `state reset` are now case-insensitive.
30+
* You can now `state checkout` a project without a language defined in its configuration.
31+
* Note making changes to such a project in the State Tool is not yet fully supported.
32+
* When the State Tool encounters an unexpected internal we now relay this internal error to the user. Previously you
33+
only received a generic "execute failed" error, which is far less helpful than an internal error.
34+
* Running `state pull` will now fail if the configured commit does not belong to the configured project.
35+
* This is a corrupted state that the user can encounter by manually editing their activestate.yaml (eg. by resolving
36+
a git conflict).
37+
38+
### Fixed
39+
40+
* Updates would retry and eventually timeout if it took longer than 30 seconds to download.
41+
* On Windows, arguments were not always escaped properly when using commands like `state exec`, or runtime executors.
42+
* Sometimes row/column text was not aligned properly.
43+
* Build progress and an empty build log would sometimes be produced when the build was already done.
44+
* The "Platforms" command group was shown twice on `state --help`, one of these should have been the "Authors" group.
45+
* When running `state artifacts` with the `--commit` flag; it was not respected when `--namespace` was also supplied.
46+
* Running `state publish` with a custom `EDITOR` environment variable would not respect the configured editor.
47+
* Sometimes `state pull` would produce conflicts when there shouldn't have been any.
48+
* Our service process now has a longer timeout window, eliminating state-svc errors when the system is under heavy load
49+
and the service hasn't started yet (eg. when booting up).
50+
* We no longer show redundant bullets for each change under `state history`.
51+
* Running `state publish --edit` will no longer require you to supply a file (eg. you just want to change the
52+
description).
53+
54+
### Security
55+
56+
* Addressed several CVEs, packages in question [have been updated](https://github.com/ActiveState/cli/pull/3306/files)
57+
to more recent appropriate versions.
58+
959
## 0.44.1
1060

1161
### Changed

cmd/state-exec/cmd.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ package main
33
import (
44
"fmt"
55
"os"
6-
"os/exec"
76
)
87

98
func runCmd(meta *executorMeta) (int, error) {
109
userArgs := os.Args[1:]
11-
cmd := exec.Command(meta.MatchingBin, userArgs...)
10+
cmd := Command(meta.MatchingBin, userArgs...)
1211
cmd.Stdin = os.Stdin
1312
cmd.Stdout = os.Stdout
1413
cmd.Stderr = os.Stderr

cmd/state-exec/cmd_lin_mac.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//go:build !windows
2+
// +build !windows
3+
4+
package main
5+
6+
import "os/exec"
7+
8+
func Command(name string, arg ...string) *exec.Cmd {
9+
return exec.Command(name, arg...)
10+
}

cmd/state-exec/cmd_windows.go

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
package main
2+
3+
import (
4+
"os/exec"
5+
"path/filepath"
6+
"strings"
7+
"syscall"
8+
9+
"github.com/ActiveState/cli/cmd/state-exec/internal/logr"
10+
)
11+
12+
func Command(name string, arg ...string) *exec.Cmd {
13+
cmd := exec.Command(name, arg...)
14+
15+
exeName := filepath.Base(strings.ToLower(name))
16+
if exeName == "cmd" || strings.HasSuffix(exeName, ".bat") || strings.HasSuffix(exeName, ".cmd") {
17+
// Go currently does not escape arguments properly on Windows, it account for spaces and tab characters, but not
18+
// other characters that need escaping such as `<` and `>`.
19+
// This can be dropped once we update to a Go version that fixes this bug: https://github.com/golang/go/issues/68313
20+
cmd.SysProcAttr = &syscall.SysProcAttr{CmdLine: makeCmdLine(cmd.Args)}
21+
logr.Debug("processed command line: %s", cmd.SysProcAttr.CmdLine)
22+
}
23+
24+
return cmd
25+
}
26+
27+
// makeCmdLine builds a command line out of args by escaping "special"
28+
// characters and joining the arguments with spaces.
29+
// Based on syscall\exec_windows.go
30+
func makeCmdLine(args []string) string {
31+
var b []byte
32+
for _, v := range args {
33+
if len(b) > 0 {
34+
b = append(b, ' ')
35+
}
36+
b = appendEscapeArg(b, v)
37+
}
38+
return string(b)
39+
}
40+
41+
// appendEscapeArg escapes the string s, as per escapeArg,
42+
// appends the result to b, and returns the updated slice.
43+
// Based on syscall\exec_windows.go
44+
func appendEscapeArg(b []byte, s string) []byte {
45+
if len(s) == 0 {
46+
return append(b, `""`...)
47+
}
48+
49+
needsBackslash := false
50+
needsQuotes := false
51+
for i := 0; i < len(s); i++ {
52+
switch s[i] {
53+
case '"', '\\':
54+
needsBackslash = true
55+
// Based on https://github.com/sebres/PoC/blob/master/SB-0D-001-win-exec/SOLUTION.md#definition
56+
case ' ', '\t', '<', '>', '&', '|', '^', '!', '(', ')', '%':
57+
needsQuotes = true
58+
}
59+
}
60+
61+
if !needsBackslash && !needsQuotes {
62+
// No special handling required; normal case.
63+
return append(b, s...)
64+
}
65+
if !needsBackslash {
66+
// hasSpace is true, so we need to quote the string.
67+
b = append(b, '"')
68+
b = append(b, s...)
69+
return append(b, '"')
70+
}
71+
72+
if needsQuotes {
73+
b = append(b, '"')
74+
}
75+
slashes := 0
76+
for i := 0; i < len(s); i++ {
77+
c := s[i]
78+
switch c {
79+
default:
80+
slashes = 0
81+
case '\\':
82+
slashes++
83+
case '"':
84+
for ; slashes > 0; slashes-- {
85+
b = append(b, '\\')
86+
}
87+
b = append(b, '\\')
88+
}
89+
b = append(b, c)
90+
}
91+
if needsQuotes {
92+
for ; slashes > 0; slashes-- {
93+
b = append(b, '\\')
94+
}
95+
b = append(b, '"')
96+
}
97+
98+
return b
99+
}

cmd/state-installer/installer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func (i *Installer) Install() (rerr error) {
108108
// If we got to this point, we could not copy and rename over existing files.
109109
// This is a permission issue. (We have an installer test for copying and renaming over a file
110110
// in use, which does not raise an error.)
111-
return locale.WrapInputError(err, "err_update_access_denied", "", errs.JoinMessage(err))
111+
return locale.WrapExternalError(err, "err_update_access_denied", "", errs.JoinMessage(err))
112112
}
113113
return errs.Wrap(err, "Failed to copy installation files to dir %s. Error received: %s", i.path, errs.JoinMessage(err))
114114
}

0 commit comments

Comments
 (0)