vagrant-triggers: unzipping large file on host machine: /vagrant-triggers/dsl.rb:130:in `shellsplit': undefined method `scan' for false:FalseClass (NoMethodError)

70 views
Skip to first unread message

Larry LeFever

unread,
Sep 16, 2016, 4:34:57 PM9/16/16
to Vagrant
I'm trying to unzip a large file (> 1 GB) in the host system right after provisioning of the guest system.  The unzipping starts and runs to the same point each time and then errors out.  The zip-file seems to be valid.  It can be unzipped directly at the cmdln and via a bash-script consistently, and I've run "zip -F" on it and then "zip -T", just in case.

Here's the relevant part of the Vagrantfile ("foo" substituted in, to protect the ... innocent).  Normally, I'd handle only "up" for this, but it's quicker to handle "reload" (with "--no-provision") while testing.
...

I am uncertain about how to properly quote and/or escape everything here.  I haven't worked with Ruby before.  However, the unzipping does consistently start and then runs for about 30 seconds without error.  So, it seems the command-syntax is correct, though the handling of the exit-status might be an issue.  However, it seems to error out quite early relative to how long it usually takes to unzip the whole file.

  config.trigger.after [:reload, :up, :resume] do

      cmd = "/usr/bin/unzip"
      arg1 = File.expand_path('~') + "/.vagrantcache/foo.zip"
      arg2 = "-d " + ENV['FOO']

      run system("#{cmd} #{arg1} #{arg2}")
...

The relevant parts of the plugin's source are:

43: def run(raw_command, options = {})

        command = shellsplit(raw_command)

        options.merge!(@options) { |key, old, new| old }

        info I18n.t("vagrant_triggers.action.trigger.executing_command", :command => command.join(" "))


        ...


      # This is a custom version of Shellwords.shellsplit adapted for handling MS-DOS commands.

      #

      # Basically escape sequences are left intact if the platform is Windows.

      def shellsplit(line)

        words = []

        field = ''

130: line.scan(/\G\s*(?>([^\s\\\'\"]+)|'([^\']*)'|"((?:[^\"\\]|\\.)*)"|(\\.?)|(\S))(\s|\z)?/) do |word, sq, dq, esc, garbage, sep|



Here's the full trace:

/Users/someguy/.vagrant.d/gems/gems/vagrant-triggers-0.5.3/lib/vagrant-triggers/dsl.rb:130:in `shellsplit': undefined method `scan' for false:FalseClass (NoMethodError)

from /Users/someguy/.vagrant.d/gems/gems/vagrant-triggers-0.5.3/lib/vagrant-triggers/dsl.rb:43:in `run'

from /Users/someguy/valtech-accel-hybris-work/Vagrantfile:75:in `block (2 levels) in <top (required)>'

from /Users/someguy/.vagrant.d/gems/gems/vagrant-triggers-0.5.3/lib/vagrant-triggers/dsl.rb:11:in `instance_eval'

from /Users/someguy/.vagrant.d/gems/gems/vagrant-triggers-0.5.3/lib/vagrant-triggers/dsl.rb:11:in `fire!'

from /Users/someguy/.vagrant.d/gems/gems/vagrant-triggers-0.5.3/lib/vagrant-triggers/action/trigger.rb:52:in `block in fire_triggers'

from /Users/someguy/.vagrant.d/gems/gems/vagrant-triggers-0.5.3/lib/vagrant-triggers/action/trigger.rb:51:in `each'

from /Users/someguy/.vagrant.d/gems/gems/vagrant-triggers-0.5.3/lib/vagrant-triggers/action/trigger.rb:51:in `fire_triggers'

from /Users/someguy/.vagrant.d/gems/gems/vagrant-triggers-0.5.3/lib/vagrant-triggers/action/trigger.rb:18:in `call'

from /opt/vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/action/warden.rb:34:in `call'

from /opt/vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/action/builder.rb:116:in `call'

from /opt/vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/action/runner.rb:66:in `block in run'

from /opt/vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/util/busy.rb:19:in `busy'

from /opt/vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/action/runner.rb:66:in `run'

from /opt/vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/machine.rb:225:in `action_raw'

from /opt/vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/machine.rb:200:in `block in action'

from /opt/vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/environment.rb:561:in `lock'

from /opt/vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/machine.rb:186:in `call'

from /opt/vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/machine.rb:186:in `action'

from /opt/vagrant/embedded/gems/gems/vagrant-1.8.5/plugins/commands/reload/command.rb:39:in `block in execute'

from /opt/vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/plugin/v2/command.rb:235:in `block in with_target_vms'

from /opt/vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/plugin/v2/command.rb:229:in `each'

from /opt/vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/plugin/v2/command.rb:229:in `with_target_vms'

from /opt/vagrant/embedded/gems/gems/vagrant-1.8.5/plugins/commands/reload/command.rb:37:in `execute'

from /opt/vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/cli.rb:42:in `execute'

from /opt/vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/environment.rb:302:in `cli'

from /opt/vagrant/embedded/gems/gems/vagrant-1.8.5/bin/vagrant:174:in `<main>'


Alvaro Miranda Aguilera

unread,
Sep 16, 2016, 7:23:55 PM9/16/16
to vagra...@googlegroups.com
hello,

what os is doing the unzip, the host or the guest?

what version of unzip is that? is 32bit or 64bit ?

As a test, try with something different than zip, some zip implementation cant handle 2GB+ size files, etc.

try .tar.gz just as test

Alvaro.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/760284e7-31b8-4123-905e-a966efd7fbe3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages