appleboy / drone-scp

Copy files and artifacts via SSH using a binary, docker or Drone CI.
MIT License
142 stars 29 forks source link

`error: tar: unknown option -- -` #137

Closed mrusme closed 1 year ago

mrusme commented 1 year ago

Closing https://github.com/appleboy/scp-action/issues/83 and reopening here, because I believe it's an issue with drone-scp expecting GNU tar on the other end, which isn't always the case (OpenBSD).

untar file xpkHVyWJzG.tar
error:  tar: unknown option -- -
usage: tar {crtux}[014578befHhjLmNOoPpqsvwXZz]
           [blocking-factor | archive | replstr] [-C directory] [-I file]
           [file ...]
       tar {-crtux} [-014578eHhjLmNOoPpqvwXZz] [-b blocking-factor]
           [-C directory] [-f archive] [-I file] [-s replstr] [file ...]

drone-scp error:  Process exited with status 1
drone-scp rollback: remove all target tmp file
remove file xpkHVyWJzG.tar
mrusme commented 1 year ago

To whomever comes across this issue: pkg_add gtar && ln -s /usr/local/bin/gtar /usr/bin/tar will do the trick on OpenBSD, as a workaround.

appleboy commented 1 year ago

@mrusme

```yaml
  uses: appleboy/scp-action@master
  with:
    host: example.com
    username: foo
    password: bar
    port: 22
    source: "tests/a.txt,tests/b.txt"
    target: "test"
+   tar_exec: gtar