pico

created pr with 47.1 on 2025-02-21T21:07:49Z · by c8ef7d19
added 47.2 on 2025-02-21T21:21:15Z · by c8ef7d19
1: 0306c3f < -: ------- chore: rsync test
2: 971b354 ! 1: 745b513 chore: add `rsync --delete` test
added 47.3 on 2025-02-21T21:21:56Z · by c8ef7d19
1: 745b513 ! 1: 76a6734 chore: add `rsync --delete` test
added 47.4 on 2025-02-21T21:22:20Z · by c8ef7d19
1: 76a6734 ! 1: 57bb60c chore: add `rsync --delete` test
added 47.5 on 2025-02-22T02:12:03Z · by c8ef7d19
1: 57bb60c = 1: 57bb60c chore: add `rsync --delete` test
-: ------- > 2: 5c8d929 chore: test is failing on `--delete`
changed status to accepted on 2025-03-13T14:53:20Z · by c8ef7d19
cmds
checkout latest patchset:
ssh pr.pico.sh print 47 | git am -3
checkout any patchset in a patch request:
ssh pr.pico.sh print 47.[rev] | git am -3
add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh pr add 47
set PR to open (enables RSS notifications):
ssh pr.pico.sh pr open 47
set PR to draft (stops RSS notifications):
ssh pr.pico.sh pr draft 47

Patchset 47.5 on 2025-02-22T02:12:03Z · commit 5c8d929

chore: test is failing on `--delete`
Eric Bower 2025-02-22T02:10:34Z
Alright, the test is failing because of the new `--delete` flag.

```
time=2025-02-21T21:10:11.225-05:00 level=ERROR source=/home/erock/go/pkg/mod/github.com/picosh/send@v0.0.0-20250213162645-ec2027b68462/protocols/rsync/rsync.go:157 msg="error running rsync middleware" service=pgs err="runtime error: index out of range [7876097] with length 0"
```
Semantic diff summary
0 added, 5 modified, 0 signature changed, 0 removed across 1 analyzed file (2 files skipped: unsupported file type)
+1 -0 go.mod #
......@@ -48,6 +48,7 @@ require (
4848 github.com/jmoiron/sqlx v1.4.0
4949 github.com/lib/pq v1.10.9
5050 github.com/microcosm-cc/bluemonday v1.0.27
51+ github.com/mikesmitty/edkey v0.0.0-20170222072505-3356ea4e686a
5152 github.com/minio/minio-go/v7 v7.0.80
5253 github.com/mmcdole/gofeed v1.3.0
5354 github.com/muesli/reflow v0.3.0
+2 -0 go.sum #
......@@ -634,6 +634,8 @@ github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKju
634634 github.com/miekg/dns v1.1.45/go.mod h1:e3IlAVfNqAllflbibAZEWOXOQ+Ynzk/dDozDxY7XnME=
635635 github.com/miekg/dns v1.1.62 h1:cN8OuEF1/x5Rq6Np+h1epln8OiyPWV+lROx9LxcGgIQ=
636636 github.com/miekg/dns v1.1.62/go.mod h1:mvDlcItzm+br7MToIKqkglaGhlFMHJ9DTNNWONWXbNQ=
637+github.com/mikesmitty/edkey v0.0.0-20170222072505-3356ea4e686a h1:eU8j/ClY2Ty3qdHnn0TyW3ivFoPC/0F1gQZz8yTxbbE=
638+github.com/mikesmitty/edkey v0.0.0-20170222072505-3356ea4e686a/go.mod h1:v8eSC2SMp9/7FTKUncp7fH9IwPfw+ysMObcEz5FWheQ=
637639 github.com/minio/madmin-go/v3 v3.0.77 h1:cqp5kVeT5anDyocvoN81puwpy+GN7t+Xdj6xCLpnONE=
638640 github.com/minio/madmin-go/v3 v3.0.77/go.mod h1:ku/RUc2xeo4Uui/GHUURMoNEVXk4Ih40xA3KHLyMF1o=
639641 github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34=
+23 -14 pgs/ssh_test.go #
......@@ -3,7 +3,6 @@ package pgs
33 import (
44 "crypto/ed25519"
55 "crypto/rand"
6- "crypto/x509"
76 "encoding/pem"
87 "fmt"
98 "io"
......@@ -15,6 +14,7 @@ import (
1514 "testing"
1615 "time"
1716
17+ "github.com/mikesmitty/edkey"
1818 "github.com/picosh/pico/db"
1919 pgsdb "github.com/picosh/pico/pgs/db"
2020 "github.com/picosh/pico/shared/storage"
......@@ -24,7 +24,13 @@ import (
2424 )
2525
2626 func TestSshServerSftp(t *testing.T) {
27- logger := slog.Default()
27+ opts := &slog.HandlerOptions{
28+ AddSource: true,
29+ Level: slog.LevelInfo,
30+ }
31+ logger := slog.New(
32+ slog.NewTextHandler(os.Stdout, opts),
33+ )
2834 dbpool := pgsdb.NewDBMemory(logger)
2935 // setup test data
3036 dbpool.SetupTestData()
......@@ -63,7 +69,13 @@ func TestSshServerSftp(t *testing.T) {
6369 }
6470
6571 func TestSshServerRsync(t *testing.T) {
66- logger := slog.Default()
72+ opts := &slog.HandlerOptions{
73+ AddSource: true,
74+ Level: slog.LevelInfo,
75+ }
76+ logger := slog.New(
77+ slog.NewTextHandler(os.Stdout, opts),
78+ )
6779 dbpool := pgsdb.NewDBMemory(logger)
6880 // setup test data
6981 dbpool.SetupTestData()
......@@ -107,10 +119,10 @@ func TestSshServerRsync(t *testing.T) {
107119 }
108120
109121 // remove the temporary directory at the end of the program
110- defer os.RemoveAll(name)
122+ // defer os.RemoveAll(name)
111123
112124 block := &pem.Block{
113- Type: "PRIVATE KEY",
125+ Type: "OPENSSH PRIVATE KEY",
114126 Bytes: user.privateKey,
115127 }
116128 keyFile := filepath.Join(name, "id_ed25519")
......@@ -139,7 +151,7 @@ func TestSshServerRsync(t *testing.T) {
139151 )
140152
141153 eCmd := fmt.Sprintf(
142- `"ssh -p 2222 -o IdentitiesOnly=yes -i %s -o StrictHostKeyChecking=no"`,
154+ "ssh -p 2222 -o IdentitiesOnly=yes -i %s -o StrictHostKeyChecking=no",
143155 keyFile,
144156 )
145157
......@@ -154,13 +166,13 @@ func TestSshServerRsync(t *testing.T) {
154166 }
155167
156168 // check it's there
157- fi, err := client.Lstat("about.html")
169+ fi, err := client.Lstat("/test/about.html")
158170 if err != nil {
159171 cfg.Logger.Error("could not get stat for file", "err", err)
160172 t.Error("about.html not found")
161173 return
162174 }
163- if fi.Size() != 0 {
175+ if fi.Size() != 46 {
164176 cfg.Logger.Error("about.html wrong size", "size", fi.Size())
165177 t.Error("about.html wrong size")
166178 return
......@@ -171,8 +183,9 @@ func TestSshServerRsync(t *testing.T) {
171183
172184 // copy files with delete
173185 delCmd := exec.Command("rsync", "-rv", "--delete", "-e", eCmd, name+"/", "localhost:/test")
174- err = delCmd.Run()
186+ result, err = delCmd.CombinedOutput()
175187 if err != nil {
188+ fmt.Println(string(result), err)
176189 t.Error(err)
177190 return
178191 }
......@@ -284,11 +297,7 @@ func GenerateUser() UserSSH {
284297 panic(err)
285298 }
286299
287- b, err := x509.MarshalPKCS8PrivateKey(userKey)
288- if err != nil {
289- panic(err)
290- }
291-
300+ b := edkey.MarshalED25519PrivateKey(userKey)
292301 userSigner, err := ssh.NewSignerFromKey(userKey)
293302 if err != nil {
294303 panic(err)
Back to top