Ruby cannot stat a file with a pound/hash character - ruby

Behold:
bear#ptah:~/Pictures/Wallpapers
$ stat /home/bear/Dropbox/.#NineFoxes.org
File: /home/bear/Dropbox/.#NineFoxes.org -> polar#fennec.3781:1659418908
Size: 28 Blocks: 0 IO Block: 4096 symbolic link
Device: 10306h/66310d Inode: 57016400 Links: 1
Access: (0777/lrwxrwxrwx) Uid: ( 1000/ bear) Gid: ( 1000/ bear)
Access: 2022-09-23 12:31:49.280214712 -0700
Modify: 2022-08-07 22:25:24.000000000 -0700
Change: 2022-09-23 12:31:49.532216732 -0700
Birth: 2022-09-23 12:31:49.280214712 -0700
bear#ptah:~/Pictures/Wallpapers
$ stat /home/bear/Dropbox/foo.log
File: /home/bear/Dropbox/foo.log
Size: 1471 Blocks: 8 IO Block: 4096 regular file
Device: 10306h/66310d Inode: 57016411 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ bear) Gid: ( 1000/ bear)
Access: 2022-09-23 12:31:49.280214712 -0700
Modify: 2022-09-10 23:28:04.000000000 -0700
Change: 2022-09-23 12:31:50.116221410 -0700
Birth: 2022-09-23 12:31:49.280214712 -0700
bear#ptah:~/Pictures/Wallpapers
$ irb
irb(main):001:0> File.stat '/home/bear/Dropbox/foo.log'
=> #<File::Stat dev=0x10306, ino=57016411, mode=0100644, nlink=1, uid=1000, gid=1000, rdev=0x0, size=1471, blksize=4096, blocks=8, atime=2022-09-23 12:31:49.280214712 -0700, mtime=2022-09-10 23:28:04 -0700, ctime=2022-09-23 12:31:50.11622141 -0700>
irb(main):002:0> File.stat '/home/bear/Dropbox/.#NineFoxes.org'
Traceback (most recent call last):
5: from /usr/bin/irb:23:in `<main>'
4: from /usr/bin/irb:23:in `load'
3: from /usr/lib/ruby/gems/2.7.0/gems/irb-1.2.6/exe/irb:11:in `<top (required)>'
2: from (irb):2
1: from (irb):2:in `stat'
Errno::ENOENT (No such file or directory # rb_file_s_stat - /home/bear/Dropbox/.#NineFoxes.org)
irb(main):003:0>
The filename is simply correct; that is the file and Ruby fails to stat it. Linux can, everything else can. Ruby can stat a file without a hash in it, also. What is needed to render this file usable to Ruby? (No, renaming is not an option; I need to stat the file.)
Note: This is the filename that Dir.glob finds, also. This is the filename that Ruby thinks it has.
irb(main):003:0> x = Dir.glob('Dropbox/*.org', File::FNM_DOTMATCH)
=> ["Dropbox/NineFoxes.org", "Dropbox/.#NineFoxes.org", "Dropbox/Elf.org", "Dropbox/Midra.org"]
irb(main):004:0> File.stat(x[0])
=> #<File::Stat dev=0x10306, ino=57016406, mode=0100744, nlink=1, uid=1000, gid=1000, rdev=0x0, size=38102, blksize=4096, blocks=80, atime=2022-09-23 12:31:49.280214712 -0700, mtime=2022-07-29 22:00:02 -0700, ctime=2022-09-23 12:31:50.11622141 -0700>
irb(main):005:0> File.stat(x[1])
Traceback (most recent call last):
5: from /usr/bin/irb:23:in `<main>'
4: from /usr/bin/irb:23:in `load'
3: from /usr/lib/ruby/gems/2.7.0/gems/irb-1.2.6/exe/irb:11:in `<top (required)>'
2: from (irb):5
1: from (irb):5:in `stat'
Errno::ENOENT (No such file or directory # rb_file_s_stat - Dropbox/.#NineFoxes.org)
irb(main):006:0> File.stat(x[2])
=> #<File::Stat dev=0x10306, ino=57016408, mode=0100644, nlink=1, uid=1000, gid=1000, rdev=0x0, size=8416, blksize=4096, blocks=24, atime=2022-09-23 12:31:49.280214712 -0700, mtime=2022-09-19 18:08:32 -0700, ctime=2022-09-23 12:31:50.120221442 -0700>
irb(main):007:0>
Additional: This is Linux, MX Linux 21, ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux-gnu]. The shell is Bash.

File.stat just calls File::Stat.new and that will raise an exception if the file doesn't exist; this is the behaviour you're seeing.
Note that /home/bear/Dropbox/.#NineFoxes.org is a symlink (see the Access: 0777/lrwxrwxrwx in stat's output). Ruby's File.stat documentation doesn't say if it follows symlinks or not but File.lstat says:
Same as File::stat, but does not follow the last symbolic link. Instead, reports on the link itself.
so it is implied that File.stat will follow the symlink and stat what it points to.
So the /home/bear/Dropbox/.#NineFoxes.org symlink does exist but what the symlink references doesn't exist.

Related

How can I use shell builtin type command in Ruby?

I am trying to create an application which will have a different result on Debian based system with dpkg package manager, Arch based system with pacman package manager and Redhat based system with yum package manager or rpm package manager.
To detect the system, I am using Kernel#system method primarily there.
Nevertheless this works:
%x(which pacman) # => "/usr/bin/pacman\n"
%x(which dpkg) # => ""
system('which pacman') # => true # and perhaps better to redirect stdout to /dev/null
system('which dpkg') # => false
But I don't like to use which because it's not a builtin. That said, your package manager can remove which (pacman -R which) or you may be missing which.
In that case, I would love to use type -p
In BASH or sh:
$ type -p pacman
/usr/bin/pacman
$ echo $?
0
$ type -p dpkg
$ echo $?
1
But in Ruby:
> system('type -p pacman')
# => nil
> system('type -p dpkg')
# => nil
> %x('type -p pacman')
sh: type -p pacman: command not found
# => ""
# OR
> require 'open3'
# => true
> Open3.capture2e('type -p pacman')
Traceback (most recent call last):
7: from /home/sourav/.irb:350:in `<main>'
6: from (irb):7
5: from (irb):7:in `rescue in irb_binding'
4: from /usr/lib/ruby/2.6.0/open3.rb:390:in `capture2e'
3: from /usr/lib/ruby/2.6.0/open3.rb:208:in `popen2e'
2: from /usr/lib/ruby/2.6.0/open3.rb:213:in `popen_run'
1: from /usr/lib/ruby/2.6.0/open3.rb:213:in `spawn'
Errno::ENOENT (No such file or directory - type)
> IO.popen('type -p pacman')
Traceback (most recent call last):
4: from /home/sourav/.irb:350:in `<main>'
3: from (irb):6
2: from (irb):6:in `rescue in irb_binding'
1: from (irb):6:in `popen'
Errno::ENOENT (No such file or directory - type)
Same goes with PTY#spawn, exec, Kernel#``
How can I use the type -p command in Ruby?
Try running your command by first spawning a new shell:
system('sh -c "type -p pry"')
/Users/foo/.rvm/gems/ruby-2.6.3/bin/pry
=> true
And likewise get false when it isn't found:
system('sh -c "type -p qwertyasdf"')
=> false

Sass won't compile SCSS (EACCES error)

I'm trying to compile my SCSS file but I always get this error. This is new because before the Windows 10 Creator Update it was working fine.
Here's the error :
$ sass --no-cache --update --trace app.scss:app.css
c:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/sass-3.4.25/lib/sass/plugin/compiler.rb:516:in `initialize': Permission denied # rb_sysopen - appp.css (Errno::EACCES)
from c:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/sass-3.4.25/lib/sass/plugin/compiler.rb:516:in `open'
from c:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/sass-3.4.25/lib/sass/plugin/compiler.rb:516:in `write_file'
from c:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/sass-3.4.25/lib/sass/plugin/compiler.rb:503:in `update_stylesheet'
from c:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/sass-3.4.25/lib/sass/plugin/compiler.rb:215:in `block in update_stylesheets'
from c:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/sass-3.4.25/lib/sass/plugin/compiler.rb:209:in `each'
from c:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/sass-3.4.25/lib/sass/plugin/compiler.rb:209:in `update_stylesheets'
from c:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/sass-3.4.25/lib/sass/plugin.rb:82:in `update_stylesheets'
from c:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/sass-3.4.25/lib/sass/exec/sass_scss.rb:340:in `watch_or_update'
from c:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/sass-3.4.25/lib/sass/exec/sass_scss.rb:51:in `process_result'
from c:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/sass-3.4.25/lib/sass/exec/base.rb:52:in `parse'
from c:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/sass-3.4.25/lib/sass/exec/base.rb:19:in `parse!'
from c:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/sass-3.4.25/bin/sass:13:in `<top (required)>'
from c:/Ruby24-x64/bin/sass:23:in `load'
from c:/Ruby24-x64/bin/sass:23:in `<main>'
I checked where the compiler fail and this is what I got :
513 def write_file(fileName, content)
514 flag = 'w'
515 flag = 'wb' if Sass::Util.windows? && options[:unix_newlines]
516 File.open(fileName, flag) do |file|
517 file.set_encoding(content.encoding) unless Sass::Util.ruby1_8?
518 file.print(content)
519 end
520 end
Just found the problem. For whatever reason, if the file is in a path with spaces it won't work. I moved the folder to a "safe address" and it works like a charm.

NFS drive attached using mklink on windows can not be accessed by unprivileged users

I am calling cmd.exe /c mklink /d C:\LOCAL\PATH \\REMOTE\PATH from cygwin as Admin and the drive can be accessed from multiple Admin's sessions as expected. However, my point is to use it by unprivileged local users as well.
I have changed the owner of the symlink to the user chown USER /LOCAL/PATH but I still can not access the drive:
USER#DESKTOP-P014S4E ~
$ stat /LOCAL/PATH
File: ‘/LOCAL/PATH’ -> ‘//REMOTE/PATH’
Size: 55 Blocks: 0 IO Block: 65536 symbolic link
Device: cccc11d4h/3435925972d Inode: 2814749767198837 Links: 1
Access: (0777/lrwxrwxrwx) Uid: (197619/ USER) Gid: (197121/ None)
Access: 2016-01-13 12:41:49.035500500 -0800
Modify: 2016-01-13 12:41:49.035500500 -0800
Change: 2016-01-14 09:08:54.416498800 -0800
Birth: 2016-01-13 12:41:49.035500500 -0800
USER#DESKTOP-P014S4E ~
$ ls -l /LOCAL/PATH
lrwxrwxrwx 1 USER None 55 Jan 13 12:41 /LOCAL/PATH -> //REMOTE/PATH
USER#DESKTOP-P014S4E ~
$ stat /LOCAL/PATH/
File: ‘/LOCAL/PATH/’
Size: 0 Blocks: 0 IO Block: 65536 directory
Device: c3h/195d Inode: 2351152405898294425 Links: 1
Access: (0755/drwxr-xr-x) Uid: (197619/ USER) Gid: (197121/ None)
Access: 2016-01-13 12:41:49.035500500 -0800
Modify: 2016-01-13 12:41:49.035500500 -0800
Change: 2016-01-14 09:08:54.416498800 -0800
Birth: 2016-01-13 12:41:49.035500500 -0800
USER#DESKTOP-P014S4E ~
$ ls -l /LOCAL/PATH/
ls: cannot open directory /LOCAL/PATH/: Permission denied
USER#DESKTOP-P014S4E ~
$ cd /LOCAL/PATH
-bash: cd: /LOCAL/PATH: Permission denied
USER#DESKTOP-P014S4E ~
$ cd /LOCAL/PATH/
-bash: cd: /LOCAL/PATH/: Permission denied
Note that stat /LOCAL/PATH/ reports something completely different for Admin:
Admin#DESKTOP-P014S4E ~
$ stat /LOCAL/PATH
File: ‘/LOCAL/PATH’
Size: 1024 Blocks: 8 IO Block: 65536 directory
Device: 38h/56d Inode: 2 Links: 25
Access: (0755/drwxr-xr-x) Uid: (4278190080/Unix_User+0) Gid: (4278190080/Unix_Group+0)
Access: 2016-01-14 01:12:12.000000000 -0800
Modify: 2015-11-19 02:34:42.000226000 -0800
Change: 2015-11-19 02:34:42.000226000 -0800
Birth: -
Admin#DESKTOP-P014S4E ~
$ powershell -Command "Get-Acl C:\PATH"
Directory: C:\
Path Owner Access
---- ----- ------
PATH DESKTOP-P014S4E\USER Everyone Allow Read, Synchronize...
Thanks for any pointers.

jekyll not updating static CSS, HTML files in docker development container

I am debugging an issue where I am doing my development inside of a Docker container, but Jekyll is not properly updating static HTML or CSS files after the first time it has been written. I have added the following code to static_file.rb after line 83:
sha256_src = Digest::SHA256.file path
sha256_dst = Digest::SHA256.file dest_path
fail "invalid file copy: #{path} / #{dest_path}" unless sha256_src == sha256_dst
And I see that the fail triggered because the hash does not match. Instead, an older version of the static file at path has been copied to dest_path. I thought I was losing my mind, but I know that Docker uses layered file systems and so I wonder if I am hitting some kind of bug or known issue.
Are there any known issues with using the following technologies in tandem with each other:
Jekyll
Docker containers
Linux containers
FileUtils cp method
Ruby 2.2.3p173
I have had to work around it by running the following command:
cp s5/*.css _site/s5/
cp s5/*.html _site/s5/
Instead of having it work automatically for me with jekyll build.
Here is how I am linking my files to the docker image:
export ABSPATH=$(cd "$(dirname "$0")"; cd ../; pwd)
docker run -d --name static -t -i -p 4000:4000 -p 2422:22 --link static-db:db -v "$ABSPATH:/mnt/app" me/static:0.0.2 /sbin/my_init --enable-insecure-key
Docker version:
Client:
Version: 1.8.3
API version: 1.20
Go version: go1.4.2
Git commit: f4bf5c7
Built: Mon Oct 12 18:01:15 UTC 2015
OS/Arch: darwin/amd64
Server:
Version: 1.8.3
API version: 1.20
Go version: go1.4.2
Git commit: f4bf5c7
Built: Mon Oct 12 18:01:15 UTC 2015
OS/Arch: linux/amd64
Docker info:
Containers: 10
Images: 265
Storage Driver: aufs
Root Dir: /mnt/sda1/var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 285
Dirperm1 Supported: true
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 4.1.10-boot2docker
Operating System: Boot2Docker 1.8.3 (TCL 6.4); master : af8b089 - Mon Oct 12 18:56:54 UTC 2015
CPUs: 1
Total Memory: 3.859 GiB
Name: dev
ID: ZY6F:2VSO:EDRL:TWYE:JAS6:5GC3:PPAO:TNA6:KCCB:HFLC:4IQB:5BYE
Debug mode (server): true
File Descriptors: 21
Goroutines: 33
System Time: 2015-10-18T18:36:20.08630971Z
EventsListeners: 0
Init SHA1:
Init Path: /usr/local/bin/docker
Docker Root Dir: /mnt/sda1/var/lib/docker
Username: me
Registry: https://index.docker.io/v1/
Labels:
provider=virtualbox
I am running this linked to a volume on OSX.
Here is an interactive session using binding.pry inside of static_file.rb. You can see that FileUtils.cp is not working properly.
In step 9-10 one can see I am manually invoking the FileUtils::cp command, and the resulting file hash is aa75cd.... I even try using FileUtils.cp to copy my original file to a different file path without success. However, in step 20-21, when I invoke the shell cp command directly using cp, it works and the resulting file has the proper hash of 724707....
Parsing Haml layouts...done.
Parsing Scss layouts...done.
Configuration file: /mnt/app/_config.yml
Source: /mnt/app
Destination: /mnt/app/_site
Generating...
From: /usr/local/lib/ruby/gems/2.2.0/gems/jekyll-2.5.3/lib/jekyll/static_file.rb # line 92 Jekyll::StaticFile#write:
77: def write(dest)
78: dest_path = destination(dest)
79:
80: return false if File.exist?(dest_path) and !modified?
81: ##mtimes[path] = mtime
82:
83: FileUtils.mkdir_p(File.dirname(dest_path))
84: FileUtils.rm(dest_path) if File.exist?(dest_path)
85:
86: FileUtils.cp(path, dest_path)
87:
88: sha256_src = Digest::SHA256.file path
89: sha256_dst = Digest::SHA256.file dest_path
90:
91: if sha256_src != sha256_dst
=> 92: binding.pry
93: end
94: puts "invalid file copy: #{path} / #{dest_path}" unless sha256_src == sha256_dst
95:
96: true
97: end
[1] pry(#<Jekyll::StaticFile>)> path
=> "/mnt/app/styles/scruff5.css"
[2] pry(#<Jekyll::StaticFile>)> dest_path
=> "/mnt/app/_site/styles/scruff5.css"
[3] pry(#<Jekyll::StaticFile>)> Digest::SHA256.file path
=> #<Digest::SHA256: 72470716291c6fef0c8c2151a0d0997f0991396cda964ba48e3cbb65cc7f7908>
[4] pry(#<Jekyll::StaticFile>)> Digest::SHA256.file dest_path
=> #<Digest::SHA256: aa75cd20ddf51b86ec2344002532f08891e05eb1a0a9f7e5f99d8fda05c5c920>
[5] pry(#<Jekyll::StaticFile>)> dest_path
=> "/mnt/app/_site/styles/scruff5.css"
[6] pry(#<Jekyll::StaticFile>)> FileUtils.rm(dest_path)
=> ["/mnt/app/_site/styles/scruff5.css"]
[7] pry(#<Jekyll::StaticFile>)> Digest::SHA256.file dest_path
Errno::ENOENT: No such file or directory # rb_sysopen - /mnt/app/_site/styles/scruff5.css
from /usr/local/lib/ruby/2.2.0/digest.rb:49:in `initialize'
[8] pry(#<Jekyll::StaticFile>)> Digest::SHA256.file path
=> #<Digest::SHA256: 72470716291c6fef0c8c2151a0d0997f0991396cda964ba48e3cbb65cc7f7908>
[9] pry(#<Jekyll::StaticFile>)> FileUtils.cp(path, dest_path)
=> nil
[10] pry(#<Jekyll::StaticFile>)> Digest::SHA256.file dest_path
=> #<Digest::SHA256: aa75cd20ddf51b86ec2344002532f08891e05eb1a0a9f7e5f99d8fda05c5c920>
[11] pry(#<Jekyll::StaticFile>)> dest_path
=> "/mnt/app/_site/styles/scruff5.css"
[12] pry(#<Jekyll::StaticFile>)> dest_path = dest_path + '-2'
=> "/mnt/app/_site/styles/scruff5.css-2"
[13] pry(#<Jekyll::StaticFile>)> FileUtils.cp(path, dest_path)
=> nil
[14] pry(#<Jekyll::StaticFile>)> FileUtils.cp(path, dest_path)
=> nil
[15] pry(#<Jekyll::StaticFile>)> Digest::SHA256.file dest_path
=> #<Digest::SHA256: aa75cd20ddf51b86ec2344002532f08891e05eb1a0a9f7e5f99d8fda05c5c920>
[16] pry(#<Jekyll::StaticFile>)> (Digest::SHA256.file dest_path).hexdigest
=> "aa75cd20ddf51b86ec2344002532f08891e05eb1a0a9f7e5f99d8fda05c5c920"
[17] pry(#<Jekyll::StaticFile>)> (Digest::SHA256.file path).hexdigest
=> "72470716291c6fef0c8c2151a0d0997f0991396cda964ba48e3cbb65cc7f7908"
[18] pry(#<Jekyll::StaticFile>)> FileUtils.rm dest_path
=> ["/mnt/app/_site/styles/scruff5.css-2"]
[19] pry(#<Jekyll::StaticFile>)> dest_path = '/mnt/app/_site/styles/scruff5.css'
=> "/mnt/app/_site/styles/scruff5.css"
[20] pry(#<Jekyll::StaticFile>)> `cp #{path} #{dest_path}`
=> ""
[21] pry(#<Jekyll::StaticFile>)> Digest::SHA256.file dest_path
=> #<Digest::SHA256: 72470716291c6fef0c8c2151a0d0997f0991396cda964ba48e3cbb65cc7f7908>
[22] pry(#<Jekyll::StaticFile>)>
After doing the above analysis and determining that [FileUtils.cp][1] seemed to be at the root of this issue, I downgraded from Ruby 2.2.1 to Ruby 2.1.7p400, and this issue now appears to be corrected. It would appear that Ruby 2.2.1 has a potentially version serious regression in FileUtils.

Wordmove pull error "Invalid byte sequence in UTF-8 (ArgumentError)"

I have Ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux] and when I'm trying to use Wordmove, I'm getting following pull error:
▬▬ ✓ Pulling Database ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
local | mysqldump --host=localhost --user=USER --password=PASS wpDB > /var/www/local/wp-content/local-backup-1421774302.sql
remote | mysqldump --host=localhost --user=USER --password=PASS wpDB > /var/www/site/wp-content/dump.sql
remote | get: /var/www/site/wp-content/dump.sql /var/www/local/wp-content/dump.sql
remote | delete: /var/www/site/wp-content/dump.sql
local | adapt dump
/var/lib/gems/1.9.1/gems/wordmove-1.2.0/lib/wordmove/sql_adapter.rb:44:in `gsub!': invalid byte sequence in UTF-8 (ArgumentError)
from /var/lib/gems/1.9.1/gems/wordmove-1.2.0/lib/wordmove/sql_adapter.rb:44:in `serialized_replace!'
from /var/lib/gems/1.9.1/gems/wordmove-1.2.0/lib/wordmove/sql_adapter.rb:36:in `replace_field!'
from /var/lib/gems/1.9.1/gems/wordmove-1.2.0/lib/wordmove/sql_adapter.rb:25:in `replace_vhost!'
from /var/lib/gems/1.9.1/gems/wordmove-1.2.0/lib/wordmove/sql_adapter.rb:17:in `adapt!'
from /var/lib/gems/1.9.1/gems/wordmove-1.2.0/lib/wordmove/deployer/base.rb:182:in `adapt_sql'
from /var/lib/gems/1.9.1/gems/wordmove-1.2.0/lib/wordmove/deployer/ssh.rb:35:in `pull_db'
from /var/lib/gems/1.9.1/gems/wordmove-1.2.0/lib/wordmove/cli.rb:47:in `block in pull'
from /var/lib/gems/1.9.1/gems/wordmove-1.2.0/lib/wordmove/cli.rb:34:in `block in handle_options'
from /var/lib/gems/1.9.1/gems/wordmove-1.2.0/lib/wordmove/cli.rb:32:in `each'
from /var/lib/gems/1.9.1/gems/wordmove-1.2.0/lib/wordmove/cli.rb:32:in `handle_options'
from /var/lib/gems/1.9.1/gems/wordmove-1.2.0/lib/wordmove/cli.rb:46:in `pull'
from /var/lib/gems/1.9.1/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /var/lib/gems/1.9.1/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /var/lib/gems/1.9.1/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
from /var/lib/gems/1.9.1/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /var/lib/gems/1.9.1/gems/wordmove-1.2.0/bin/wordmove:6:in `<top (required)>'
from /usr/local/bin/wordmove:23:in `load'
from /usr/local/bin/wordmove:23:in `<main>'
Other websites run in the very same environment does not show this error. Does anyone have any idea, what can be casuing this error?
Add
sql_content.encode!('UTF-16', 'UTF-8', :invalid => :replace, :replace => '')
sql_content.encode!('UTF-8', 'UTF-16')
sql_content.force_encoding("UTF-8")
to this File,above the line 45
/root/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/wordmove-2.1.2/lib/wordmove/sql_adapter/default.rb
or this File
/var/lib/gems/2.7.0/gems/wordmove-5.2.2/lib/wordmove/sql_adapter/default.rb
Ref: https://github.com/welaika/wordmove/wiki/invalid-byte-sequence-in-UTF-8-while-pushing---pulling-db

Resources