pico
created pr with
47.1
added 47.2
1: 0306c3f < -: ------- chore: rsync test
2: 971b354 ! 1: 745b513 chore: add `rsync --delete` test
added 47.3
1: 745b513 ! 1: 76a6734 chore: add `rsync --delete` test
added 47.4
1: 76a6734 ! 1: 57bb60c chore: add `rsync --delete` test
added 47.5
1: 57bb60c = 1: 57bb60c chore: add `rsync --delete` test
-: ------- > 2: 5c8d929 chore: test is failing on `--delete`
changed status to
accepted
cmds
checkout latest patchset:
ssh pr.pico.sh print 47 | git am -3checkout any patchset in a patch request:
ssh pr.pico.sh print 47.[rev] | git am -3add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh pr add 47set PR to open (enables RSS notifications):
ssh pr.pico.sh pr open 47set PR to draft (stops RSS notifications):
ssh pr.pico.sh pr draft 47
Patchset
47.5
chore: test is failing on `--delete`
Eric Bower
2025-02-22T02:10:34ZAlright, 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 ( | |
| 48 | 48 | github.com/jmoiron/sqlx v1.4.0 | |
| 49 | 49 | github.com/lib/pq v1.10.9 | |
| 50 | 50 | github.com/microcosm-cc/bluemonday v1.0.27 | |
| 51 | + | github.com/mikesmitty/edkey v0.0.0-20170222072505-3356ea4e686a | |
| 51 | 52 | github.com/minio/minio-go/v7 v7.0.80 | |
| 52 | 53 | github.com/mmcdole/gofeed v1.3.0 | |
| 53 | 54 | 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 | |
| 634 | 634 | github.com/miekg/dns v1.1.45/go.mod h1:e3IlAVfNqAllflbibAZEWOXOQ+Ynzk/dDozDxY7XnME= | |
| 635 | 635 | github.com/miekg/dns v1.1.62 h1:cN8OuEF1/x5Rq6Np+h1epln8OiyPWV+lROx9LxcGgIQ= | |
| 636 | 636 | 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= | |
| 637 | 639 | github.com/minio/madmin-go/v3 v3.0.77 h1:cqp5kVeT5anDyocvoN81puwpy+GN7t+Xdj6xCLpnONE= | |
| 638 | 640 | github.com/minio/madmin-go/v3 v3.0.77/go.mod h1:ku/RUc2xeo4Uui/GHUURMoNEVXk4Ih40xA3KHLyMF1o= | |
| 639 | 641 | github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34= |
+23
-14
pgs/ssh_test.go
#
| ... | ... | @@ -24,7 +24,13 @@ import ( | |
| 24 | 24 | ) | |
| 25 | 25 | ||
| 26 | 26 | 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 | + | ) | |
| 28 | 34 | dbpool := pgsdb.NewDBMemory(logger) | |
| 29 | 35 | // setup test data | |
| 30 | 36 | dbpool.SetupTestData() |
| ... | ... | @@ -63,7 +69,13 @@ func TestSshServerSftp(t *testing.T) { | |
| 63 | 69 | } | |
| 64 | 70 | ||
| 65 | 71 | 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 | + | ) | |
| 67 | 79 | dbpool := pgsdb.NewDBMemory(logger) | |
| 68 | 80 | // setup test data | |
| 69 | 81 | dbpool.SetupTestData() |
| ... | ... | @@ -107,10 +119,10 @@ func TestSshServerRsync(t *testing.T) { | |
| 107 | 119 | } | |
| 108 | 120 | ||
| 109 | 121 | // remove the temporary directory at the end of the program | |
| 110 | - | defer os.RemoveAll(name) | |
| 122 | + | // defer os.RemoveAll(name) | |
| 111 | 123 | ||
| 112 | 124 | block := &pem.Block{ | |
| 113 | - | Type: "PRIVATE KEY", | |
| 125 | + | Type: "OPENSSH PRIVATE KEY", | |
| 114 | 126 | Bytes: user.privateKey, | |
| 115 | 127 | } | |
| 116 | 128 | keyFile := filepath.Join(name, "id_ed25519") |
| ... | ... | @@ -154,13 +166,13 @@ func TestSshServerRsync(t *testing.T) { | |
| 154 | 166 | } | |
| 155 | 167 | ||
| 156 | 168 | // check it's there | |
| 157 | - | fi, err := client.Lstat("about.html") | |
| 169 | + | fi, err := client.Lstat("/test/about.html") | |
| 158 | 170 | if err != nil { | |
| 159 | 171 | cfg.Logger.Error("could not get stat for file", "err", err) | |
| 160 | 172 | t.Error("about.html not found") | |
| 161 | 173 | return | |
| 162 | 174 | } | |
| 163 | - | if fi.Size() != 0 { | |
| 175 | + | if fi.Size() != 46 { | |
| 164 | 176 | cfg.Logger.Error("about.html wrong size", "size", fi.Size()) | |
| 165 | 177 | t.Error("about.html wrong size") | |
| 166 | 178 | return |
| ... | ... | @@ -171,8 +183,9 @@ func TestSshServerRsync(t *testing.T) { | |
| 171 | 183 | ||
| 172 | 184 | // copy files with delete | |
| 173 | 185 | delCmd := exec.Command("rsync", "-rv", "--delete", "-e", eCmd, name+"/", "localhost:/test") | |
| 174 | - | err = delCmd.Run() | |
| 186 | + | result, err = delCmd.CombinedOutput() | |
| 175 | 187 | if err != nil { | |
| 188 | + | fmt.Println(string(result), err) | |
| 176 | 189 | t.Error(err) | |
| 177 | 190 | return | |
| 178 | 191 | } |
| ... | ... | @@ -284,11 +297,7 @@ func GenerateUser() UserSSH { | |
| 284 | 297 | panic(err) | |
| 285 | 298 | } | |
| 286 | 299 | ||
| 287 | - | b, err := x509.MarshalPKCS8PrivateKey(userKey) | |
| 288 | - | if err != nil { | |
| 289 | - | panic(err) | |
| 290 | - | } | |
| 291 | - | ||
| 300 | + | b := edkey.MarshalED25519PrivateKey(userKey) | |
| 292 | 301 | userSigner, err := ssh.NewSignerFromKey(userKey) | |
| 293 | 302 | if err != nil { | |
| 294 | 303 | panic(err) |