welaika / wordmove

Multi-stage command line deploy/mirroring and task runner for Wordpress
https://wptools.it/wordmove
MIT License
1.87k stars 165 forks source link

Backslash(es) in rsync options #605

Closed martin-josef closed 4 years ago

martin-josef commented 4 years ago

Describe the bug When I use rsync options in the movefile.yml backslashes get introduced into these commands. I run ssh as root.

The same applies to complex (w symbols) db passwords, even in quotation marks. But I will focus on rsync here.

Example, line in the movefile.yml:

rsync_options: "--usermap=www-data --groupmap=www-data --chmod=D770,F660"

I have also tried ' instead of ".

It gets executed as:

--usermap\=www-data --groupmap\=www-data --chmod\=D770,F660

Wordmove command wordmove push -e staging --all

Expected behavior I expect user- and groupmap / chmod to change ownership and permissions on my staging server, it doesn't (it's not an encoding issue w the log is my guess).

movefile.yml

global:
  sql_adapter: wpcli

local:
  vhost: http://mysite.test
  wordpress_path: /srv/www/mysite/public_html # use an absolute path here

  database:
    name: mydb
    user: wp
    password: "wp" # could be blank, so always use quotes around
    host: localhost

staging:
  vhost: https://mysite
  wordpress_path: /var/www/mysite/html # use an absolute path here

  database:
    name: dbname
    user: dbuser
    password: "dbpass"
    host: localhost
    # port: 3308 # Use just in case you have exotic server config
    # mysqldump_options: '--max_allowed_packet=1G' # Only available if using SSH
    # mysql_options: '--protocol=TCP' # mysql command is used to import db

  exclude:
    - '.git/'
    - '.gitignore'
    - '.gitmodules'
    - '.env'
    - 'node_modules/'
    - 'bin/'
    - 'tmp/*'
    - 'Gemfile*'
    - 'Movefile'
    - 'movefile'
    - 'movefile.yml'
    - 'movefile.yaml'
    - 'wp-config.php'
    - 'wp-content/*.sql.gz'
    - '*.orig'

  ssh:
    host: ip
    user: root
  #   password: password # password is optional, will use public keys if available.
  #   port: 22 # Port is optional
    rsync_options: "--usermap=www-data --groupmap=www-data --chmod=D770,F660"

Exception/trace Paste (removing personal data) the entire trace of error/exception you encountered, if any

Environment (please complete the following information):

Doctor

Yep, all green. Wordmove pushing / pulling works perfectly except for this issue.

martin-josef commented 4 years ago

Am I maybe looking at the wrong potential source for the problem? Should I be asking in a Ruby forum?

alessandro-fazzi commented 4 years ago

@martin-josef unfortunately my sensation is that you are on the right issue tracker.

It's really strange for me though, because I'm really used to use rsync_options like these on my company's projects:

rsync_options: '--itemize-changes --chmod=D775,F664 --no-perms --no-times --checksum'

Now...the only real difference from a surface analysis is that I use single quotes. If you mind to try it out it could be helpful. By the way it is not expected to make any difference.

Would you mind to check it out anyway?

alessandro-fazzi commented 4 years ago

For reference, the escaping is done inside a dependency, probably here: https://github.com/welaika/photocopier/blob/master/lib/photocopier/ssh.rb#L84

martin-josef commented 4 years ago

@martin-josef unfortunately my sensation is that you are on the right issue tracker.

It's really strange for me though, because I'm really used to use rsync_options like these on my company's projects:

rsync_options: '--itemize-changes --chmod=D775,F664 --no-perms --no-times --checksum'

Now...the only real difference from a surface analysis is that I use single quotes. If you mind to try it out it could be helpful. By the way it is not expected to make any difference.

Would you mind to check it out anyway?

Dear pioneerskies, I appreciate the reply. I have tested single quotes and the issue remains.

For reference, the escaping is done inside a dependency, probably here: https://github.com/welaika/photocopier/blob/master/lib/photocopier/ssh.rb#L84

I will look into that, as I am not very familiar with this. Any other ideas would also be appreciated.

Kind regards, Martin

martin-josef commented 4 years ago

I was not able to fix the issue but used remote hooks instead, which did the trick.