Skip to content

Commit 4069702

Browse files
authored
Merge pull request #897 from lmorg/develop
v6.4.1xxx
2 parents 69c17da + 87f81dc commit 4069702

File tree

14 files changed

+140
-25
lines changed

14 files changed

+140
-25
lines changed

app/app.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ const Name = "murex"
1616
const (
1717
Major = 6
1818
Minor = 4
19-
Revision = 375
19+
Revision = 102
2020
Branch = "develop"
21-
BuildDate = "2024-11-23 00:40:48"
21+
BuildDate = "2024-12-10 22:21:56"
2222
)
2323

2424
// Copyright is the copyright owner string

app/update-version.mx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ $GLOBAL.APP_GO = "./app.go"
44

55
function get_revision_number {
66
$rev = ${ open $GLOBAL.APP_GO -> :str: regexp 'f/Revision\s+=\s+([0-9]+)' }
7-
out ($rev+1)
7+
if { $MUREX_DEV } then { $rev++ }
8+
out $rev
89
}
910

1011
function get_branch_name {

builtins/core/runtime/runtime.go

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@ package cmdruntime
33
import (
44
"errors"
55
"runtime"
6+
godebug "runtime/debug"
67
"sort"
8+
"strings"
79

10+
"github.com/lmorg/murex/app"
811
"github.com/lmorg/murex/builtins/core/open"
912
"github.com/lmorg/murex/builtins/events"
1013
"github.com/lmorg/murex/config/defaults"
@@ -21,6 +24,7 @@ import (
2124
"github.com/lmorg/murex/utils/cache"
2225
cdcache "github.com/lmorg/murex/utils/cd/cache"
2326
"github.com/lmorg/murex/utils/envvars"
27+
"github.com/lmorg/murex/utils/humannumbers"
2428
"github.com/lmorg/murex/utils/json"
2529
)
2630

@@ -66,6 +70,7 @@ const (
6670
fCacheDbEnabled = "--cache-db-enabled"
6771
fCacheDbPath = "--cache-db-path"
6872
fGoGarbageCollect = "--go-gc"
73+
fAbout = "--about"
6974
fHelp = "--help"
7075
)
7176

@@ -111,6 +116,7 @@ var flags = map[string]string{
111116
fCacheDbEnabled: types.Boolean,
112117
fCacheDbPath: types.Boolean,
113118
fGoGarbageCollect: types.Boolean,
119+
fAbout: types.Boolean,
114120
fHelp: types.Boolean,
115121
}
116122

@@ -261,10 +267,17 @@ func cmdRuntime(p *lang.Process) error {
261267
case fCacheDbPath:
262268
ret[flag[2:]] = cache.DbPath()
263269
case fGoGarbageCollect:
264-
runtime.GC()
265-
ret[fGoGarbageCollect] = "done"
270+
//runtime.GC()
271+
godebug.FreeOSMemory()
272+
ret[flag[2:]] = "done"
273+
case fAbout:
274+
v := dumpAbout()
275+
if v == nil {
276+
return errors.New("unexpected error: reason unknown")
277+
}
278+
ret[flag[2:]] = v
266279
case fHelp:
267-
ret[fHelp[2:]] = Help()
280+
ret[flag[2:]] = Help()
268281
default:
269282
return errors.New("unrecognized parameter: " + flag)
270283
}
@@ -297,3 +310,47 @@ func dumpTestResults(p *lang.Process) interface{} {
297310
"process": p.Tests.Results.Dump(),
298311
}
299312
}
313+
314+
func dumpAbout() any {
315+
info, ok := godebug.ReadBuildInfo()
316+
if !ok {
317+
return nil
318+
}
319+
320+
var mem runtime.MemStats
321+
runtime.ReadMemStats(&mem)
322+
323+
m := map[string]any{
324+
"GoVersion": info.GoVersion,
325+
"GitBranch": app.Branch,
326+
"SemVer": app.Semver(),
327+
"BuildDate": app.BuildDate,
328+
"DebugEnabled": debug.Enabled,
329+
//"TestEnabled": p.Scope.Tests != nil,
330+
"NumCgoCalls": runtime.NumCgoCall(),
331+
"NumRoutines": runtime.NumGoroutine(),
332+
"NumCpus": runtime.NumCPU(),
333+
}
334+
335+
buildSettings := make(map[string]any)
336+
for _, setting := range info.Settings {
337+
if setting.Key == "-tags" || setting.Key == "DefaultGODEBUG" {
338+
buildSettings[setting.Key] = sort.StringSlice(strings.Split(setting.Value, ","))
339+
} else {
340+
buildSettings[setting.Key] = setting.Value
341+
}
342+
}
343+
m["BuildSettings"] = buildSettings
344+
345+
m["MemStats"] = map[string]any{
346+
"Alloc": humannumbers.Bytes(mem.Alloc),
347+
"TotalAlloc": humannumbers.Bytes(mem.TotalAlloc),
348+
"Sys": humannumbers.Bytes(mem.Sys),
349+
"Mallocs": mem.Mallocs,
350+
"Frees": mem.Frees,
351+
"NumGC": mem.NumGC,
352+
"NumForcedGC": mem.NumForcedGC,
353+
}
354+
355+
return m
356+
}

builtins/core/runtime/runtime_doc.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,11 @@
207207
--cache-namespaces: >-
208208
Lists namespaces in cache
209209
--go-gc: >-
210-
Forces the Go runtime to run its garbage collection
210+
Forces the Go runtime to run its garbage collection and then deallocate
211+
any free memory
212+
--about: >-
213+
Returns debugging information about the Murex executable. Such as compiler
214+
flags and resource utilization
211215
--help: >-
212216
Outputs a list of `runtimes`'s flags
213217

docs/changelog/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Track new features, any breaking changes, and the release history here.
44

55
## Articles
66

7-
### 22.11.2024 - [v6.4](../changelog/v6.4.md)
7+
### 11.12.2024 - [v6.4](../changelog/v6.4.md)
88

99
This change brings a number of ergonomic improvements to job control, `datetime` and working with structures.
1010

docs/changelog/v6.4.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,25 @@ Please read out [compatibility commitment](https://murex.rocks/compatibility.htm
2222

2323
None
2424

25-
## Features
25+
## v6.4.1xxx
26+
27+
### Features
28+
29+
* `runtime`: new flag: `--about` reports information about the Murex system. Useful for debugging ([issue #896](https://github.com/lmorg/murex/issues/896))
30+
31+
* `runtime`: `--go-gc` now forces the garbage collector to deallocate memory rather than just marking memory as unused ([issue #896](https://github.com/lmorg/murex/issues/896))
32+
33+
### Bug Fixes
34+
35+
* `expr` fix panic when using parentheses in dot notation ([issue #892](https://github.com/lmorg/murex/issues/892))
36+
37+
* versioning: only auto-version if `$MUREX_DEV` is set
38+
39+
* versioning: `0` pad semver revision to 4 characters
40+
41+
## v6.4.0xxx
42+
43+
### Features
2644

2745
* IO redirection: smarter file pipes which solve the race condition seen in traditional shells where you try to write to the same file you're reading from (EXPERIMENTAL) ([issue #851](https://github.com/lmorg/murex/issues/851))
2846

@@ -56,7 +74,7 @@ None
5674

5775
* mxtty: updated `csv` support ([commit](https://github.com/lmorg/murex/pull/887/commits/9fb0ab53f7c32556fc54f66b977048d2f1563b64), [read more](https://github.com/lmorg/mxtty))
5876

59-
## Bug Fixes
77+
### Bug Fixes
6078

6179
* private functions: mutex added to mitigate a potential race condition ([issue #883](https://github.com/lmorg/murex/issues/883))
6280

@@ -78,7 +96,7 @@ You rock!
7896

7997
<hr>
8098

81-
Published: 22.11.2024 at 21:32
99+
Published: 11.12.2024 at 22:09
82100

83101
## See Also
84102

@@ -92,6 +110,8 @@ Published: 22.11.2024 at 21:32
92110
Outputs an element from a nested structure
93111
* [How To Contribute](../Murex/CONTRIBUTING.md):
94112
Murex is community project. We gratefully accept contributions
113+
* [Shell Runtime (`runtime`)](../commands/runtime.md):
114+
Returns runtime information on the internal state of Murex
95115
* [index](../parser/item-index.md):
96116
Outputs an element from an array, map or table
97117

docs/commands/runtime.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ flag names. eg
120120

121121
## Flags
122122

123+
* `--about`
124+
Returns debugging information about the Murex executable. Such as compiler flags and resource utilization
123125
* `--aliases`
124126
Lists all [aliases](/docs/commands/alias.md)
125127
* `--autocomplete`
@@ -153,7 +155,7 @@ flag names. eg
153155
* `--globals`
154156
Lists all [global variables](/docs/commands/global.md)
155157
* `--go-gc`
156-
Forces the Go runtime to run its garbage collection
158+
Forces the Go runtime to run its garbage collection and then deallocate any free memory
157159
* `--help`
158160
Outputs a list of `runtimes`'s flags
159161
* `--indexes`

gen/changelog/v6.4.inc.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,25 @@ Please read out [compatibility commitment](https://murex.rocks/compatibility.htm
1818

1919
None
2020

21-
## Features
21+
## v6.4.1xxx
22+
23+
### Features
24+
25+
* `runtime`: new flag: `--about` reports information about the Murex system. Useful for debugging ([issue #896](https://github.com/lmorg/murex/issues/896))
26+
27+
* `runtime`: `--go-gc` now forces the garbage collector to deallocate memory rather than just marking memory as unused ([issue #896](https://github.com/lmorg/murex/issues/896))
28+
29+
### Bug Fixes
30+
31+
* `expr` fix panic when using parentheses in dot notation ([issue #892](https://github.com/lmorg/murex/issues/892))
32+
33+
* versioning: only auto-version if `$MUREX_DEV` is set
34+
35+
* versioning: `0` pad semver revision to 4 characters
36+
37+
## v6.4.0xxx
38+
39+
### Features
2240

2341
* IO redirection: smarter file pipes which solve the race condition seen in traditional shells where you try to write to the same file you're reading from (EXPERIMENTAL) ([issue #851](https://github.com/lmorg/murex/issues/851))
2442

@@ -52,7 +70,7 @@ None
5270

5371
* mxtty: updated `csv` support ([commit](https://github.com/lmorg/murex/pull/887/commits/9fb0ab53f7c32556fc54f66b977048d2f1563b64), [read more](https://github.com/lmorg/mxtty))
5472

55-
## Bug Fixes
73+
### Bug Fixes
5674

5775
* private functions: mutex added to mitigate a potential race condition ([issue #883](https://github.com/lmorg/murex/issues/883))
5876

gen/changelog/v6.4_doc.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Title: >-
33
v6.4
44
CategoryID: changelog
5-
DateTime: 2024-11-22 21:32
5+
DateTime: 2024-12-11 22:09
66
Summary: >-
77
This change brings a number of ergonomic improvements to job control,
88
`datetime` and working with structures.
@@ -15,3 +15,4 @@
1515
- datetime
1616
- index
1717
- element
18+
- runtime

lang/expressions/parse_vars.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ parseBareword:
7070
return tree.expression[startPos : tree.charPos-1], nil, "", err
7171
}
7272
tree.charPos++
73-
if execScalars {
73+
if exec {
7474
s, err := types.ConvertGoType(v, types.String)
7575
if err != nil {
7676
return tree.expression[startPos : tree.charPos-1], nil, "", err

0 commit comments

Comments
 (0)