Skip to content

baton export to CSV results in a runtime error #49

@rowdy-fms

Description

@rowdy-fms

The operating system is Ubuntu 24.04 aarch64.
Each of the Baton utilities noted below was downloaded from the respective GitHub release page.
Each of the collectors did seem to work - running ./baton stats reported lots of data gathered.
But trying to ./baton export csv resulted in a runtime error, and the resultant CSV file contained only the column headings.

rowdy@ubuntu2404:~/baton$ ./baton-postgresql --version
baton-postgresql version 0.1.5

rowdy@ubuntu2404:~/baton$ ./baton-postgresql --dsn postgres://user:[email protected]:5432/database1
{"level":"info","ts":1733367226.049593,"caller":"grpclog/component.go:34","msg":"[core][Server #1]Server created","system":"grpc","grpc_log":true}
{"level":"info","ts":1733367226.0499706,"caller":"grpclog/component.go:34","msg":"[core][Server #1 ListenSocket #2]ListenSocket created","system":"grpc","grpc_log":true}
{"level":"info","ts":1733367226.0665336,"caller":"sync/syncer.go:358","msg":"Syncing resource types..."}
{"level":"info","ts":1733367226.067313,"caller":"sync/syncer.go:422","msg":"Syncing resources..."}
{"level":"info","ts":1733367226.135534,"caller":"sync/syncer.go:588","msg":"Syncing entitlements..."}
{"level":"info","ts":1733367226.2412584,"caller":"sync/syncer.go:948","msg":"Syncing grants..."}
{"level":"info","ts":1733367226.9420986,"caller":"sync/syncer.go:298","msg":"Sync complete."}

rowdy@ubuntu2404:~/baton$ ./baton --version
baton version 0.1.4

rowdy@ubuntu2404:~/baton$ ./baton stats
Type           | Count
column         | 0
database       | 14
entitlements   | 1334
function       | 1
grants         | 2900
large-object   | 0
procedure      | 0
resource_types | 10
role           | 14
schema         | 1
sequence       | 1
table          | 83
view           | 0

rowdy@ubuntu2404:~/baton$ ./baton export csv
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0xe1fe34]

goroutine 1 [running]:
main.buildCSV({0x14713c8?, 0x4000391710?}, {0x40003919b0, 0x4000d268d0, 0x4000d26900, 0x4000d27770, 0x4000d277a0, 0x400034cd80, 0x400034ce10}, {0x1118bf5, ...})
  /Users/runner/work/baton/baton/cmd/baton/csv.go:318 +0xc34
main.runExportCSV(0x40003be908, {0x11061a8?, 0x4?, 0x1106180?})
  /Users/runner/work/baton/baton/cmd/baton/csv.go:204 +0x274
github.com/spf13/cobra.(*Command).execute(0x40003be908, {0x201f5e0, 0x0, 0x0})
  /Users/runner/work/baton/baton/vendor/github.com/spf13/cobra/command.go:985 +0x840
github.com/spf13/cobra.(*Command).ExecuteC(0x4000194f08)
  /Users/runner/work/baton/baton/vendor/github.com/spf13/cobra/command.go:1117 +0x344
github.com/spf13/cobra.(*Command).Execute(...)
  /Users/runner/work/baton/baton/vendor/github.com/spf13/cobra/command.go:1041
github.com/spf13/cobra.(*Command).ExecuteContext(...)
  /Users/runner/work/baton/baton/vendor/github.com/spf13/cobra/command.go:1034
main.main()
  /Users/runner/work/baton/baton/cmd/baton/main.go:39 +0x45c

rowdy@ubuntu2404:~/baton$ ls -l sync.*
-rw-rw-r-- 1 rowdy rowdy 249713 Dec  5 02:53 sync.c1z
-rw-rw-r-- 1 rowdy rowdy    166 Dec  5 02:54 sync.csv

rowdy@ubuntu2404:~/baton$ cat sync.csv
Type,Last Name,First Name,User ID,User Status,Email Address,Entitlement Display Name,Entitlement,Resource Type,Resource Name,Entitlement Description,Entitlement Slug
rowdy@ubuntu2404:~/baton$ ./baton-sql-server --version
baton-sql-server version 0.0.7

rowdy@ubuntu2404:~/baton$ ./baton-sql-server --dsn 'server=192.168.2.8;user id=sa;password=passw0rd;port=1433'
{"level":"info","ts":1733367478.8260758,"caller":"grpclog/component.go:36","msg":"[core][Server #1]Server created","system":"grpc","grpc_log":true}
{"level":"info","ts":1733367478.8261487,"caller":"grpclog/component.go:36","msg":"[core][Server #1 ListenSocket #2]ListenSocket created","system":"grpc","grpc_log":true}
{"level":"info","ts":1733367478.845847,"caller":"sync/syncer.go:346","msg":"Syncing resource types..."}
{"level":"info","ts":1733367478.8471985,"caller":"sync/syncer.go:410","msg":"Syncing resources..."}
{"level":"info","ts":1733367478.9671264,"caller":"sync/syncer.go:576","msg":"Syncing entitlements..."}
{"level":"info","ts":1733367479.471752,"caller":"sync/syncer.go:936","msg":"Syncing grants..."}
{"level":"info","ts":1733367495.754528,"caller":"sync/syncer.go:291","msg":"Sync complete."}

rowdy@ubuntu2404:~/baton$ ./baton --version
baton version 0.1.4

rowdy@ubuntu2404:~/baton$ ./baton stats
Type           | Count
database       | 18
database-role  | 200
entitlements   | 2929
grants         | 182
group          | 0
resource_types | 6
server         | 1
server-role    | 9
user           | 24

rowdy@ubuntu2404:~/baton$ ./baton export csv
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0xe1fe34]

goroutine 1 [running]:
main.buildCSV({0x14713c8?, 0x4000393710?}, {0x40003939b0, 0x40003fe900, 0x40003fe930, 0x40003ff770, 0x40003ff7a0, 0x40010b95f0, 0x40010b9620}, {0x1118bf5, ...})
  /Users/runner/work/baton/baton/cmd/baton/csv.go:318 +0xc34
main.runExportCSV(0x40003be908, {0x11061a8?, 0x4?, 0x1106180?})
  /Users/runner/work/baton/baton/cmd/baton/csv.go:204 +0x274
github.com/spf13/cobra.(*Command).execute(0x40003be908, {0x201f5e0, 0x0, 0x0})
  /Users/runner/work/baton/baton/vendor/github.com/spf13/cobra/command.go:985 +0x840
github.com/spf13/cobra.(*Command).ExecuteC(0x4000194f08)
  /Users/runner/work/baton/baton/vendor/github.com/spf13/cobra/command.go:1117 +0x344
github.com/spf13/cobra.(*Command).Execute(...)
  /Users/runner/work/baton/baton/vendor/github.com/spf13/cobra/command.go:1041
github.com/spf13/cobra.(*Command).ExecuteContext(...)
  /Users/runner/work/baton/baton/vendor/github.com/spf13/cobra/command.go:1034
main.main()
  /Users/runner/work/baton/baton/cmd/baton/main.go:39 +0x45c

rowdy@ubuntu2404:~/baton$ ls -l sync.*
-rw-rw-r-- 1 rowdy rowdy 144222 Dec  5 03:05 sync.c1z
-rw-rw-r-- 1 rowdy rowdy    166 Dec  5 03:05 sync.csv

rowdy@ubuntu2404:~/baton$ cat sync.csv
Type,Last Name,First Name,User ID,User Status,Email Address,Entitlement Display Name,Entitlement,Resource Type,Resource Name,Entitlement Description,Entitlement Slug

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions