glynn icon indicating copy to clipboard operation
glynn copied to clipboard

FTPPermError

Open paulocesarpcfj opened this issue 8 years ago • 16 comments

I'm getting this error. How can i fix it?

Successfully generated site
Sending site over FTP (host: 72.29.66.216, port: 21, ftps: false)
Connected to server. Sending site
 -> about
 -> index.html
 -> assets
 -> main.css
 -> bitbucket-pipelines.yml
 -> docker-compose.yml
 -> Dockerfile
 -> feed.xml
 -> feed.xslt.xml
 -> index.html
 -> jekyll
 -> update
 -> 2016
 -> 10
 -> 22
 -> welcome-to-jekyll.html
 -> README.md
/Users/paulocesarpcfj/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/net/ftp.rb:342:in `getresp': 501 No file name (Net::FTPPermError)
    from /Users/paulocesarpcfj/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/net/ftp.rb:367:in `block in sendcmd'
    from /Users/paulocesarpcfj/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
    from /Users/paulocesarpcfj/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/net/ftp.rb:365:in `sendcmd'
    from /Users/paulocesarpcfj/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/net/ftp.rb:1002:in `delete'
    from /Users/paulocesarpcfj/.rvm/gems/ruby-2.3.0/gems/glynn-1.3.0/lib/glynn/ftp.rb:70:in `block in remove_files'
    from /Users/paulocesarpcfj/.rvm/gems/ruby-2.3.0/gems/glynn-1.3.0/lib/glynn/ftp.rb:69:in `each'
    from /Users/paulocesarpcfj/.rvm/gems/ruby-2.3.0/gems/glynn-1.3.0/lib/glynn/ftp.rb:69:in `remove_files'
    from /Users/paulocesarpcfj/.rvm/gems/ruby-2.3.0/gems/glynn-1.3.0/lib/glynn/ftp.rb:19:in `block in sync'
    from /Users/paulocesarpcfj/.rvm/gems/ruby-2.3.0/gems/glynn-1.3.0/lib/glynn/ftp.rb:29:in `block in connect'
    from /Users/paulocesarpcfj/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/net/ftp.rb:150:in `open'
    from /Users/paulocesarpcfj/.rvm/gems/ruby-2.3.0/gems/glynn-1.3.0/lib/glynn/ftp.rb:25:in `connect'
    from /Users/paulocesarpcfj/.rvm/gems/ruby-2.3.0/gems/glynn-1.3.0/lib/glynn/ftp.rb:17:in `sync'
    from /Users/paulocesarpcfj/.rvm/gems/ruby-2.3.0/gems/glynn-1.3.0/bin/glynn:80:in `<top (required)>'
    from /Users/paulocesarpcfj/.rvm/gems/ruby-2.3.0/bin/glynn:23:in `load'
    from /Users/paulocesarpcfj/.rvm/gems/ruby-2.3.0/bin/glynn:23:in `<main>'
    from /Users/paulocesarpcfj/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
    from /Users/paulocesarpcfj/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'

Thanks.

paulocesarpcfj avatar Oct 25 '16 22:10 paulocesarpcfj

Paulo,

Looks like you're facing an issue with the new feature of deleting files missing locally. I just pushed a commit logging which file we're trying to delete before doing so: 71a7d62fc465feee705a8f5f2bf20202e1131335

Could you try using glynn from the github repository to get that log and paste it here?

Thanks

dmathieu avatar Oct 26 '16 08:10 dmathieu

@dmathieu I traced what is happening here. NLST command from FTP protocol does not support recursive listing, as Dir.Glob function. I have 1:1 copy on the server and this is happening:

ftp.nlst("#{distant}/**/*") result:

["", "", "/blog/public/css:", "", ".", "..", "animate.min.css", "main.css", "responsive.gs.12col.css", "", "", "/blog/public/images:", "", ".", "..", "eagle.png", "favicon.ico", "flower.png", "logo.png", "", "", "/blog/public/js:", "", ".", "..", "jquery.fitvids.js"]

Dir.glob("#{local}/**/*") result:

["C:/Users/Kamil/_dev/blog/_site/404.html", "C:/Users/Kamil/_dev/blog/_site/ecto-strange-error.html", "C:/Users/Kamil/_dev/blog/_site/feed.xml", "C:/Users/Kamil/_dev/blog/_site/Gemfile", "C:/Users/Kamil/_dev/blog/_site/Gemfile.lock", "C:/Users/Kamil/_dev/blog/_site/hello-world.html", "C:/Users/Kamil/_dev/blog/_site/index.html", "C:/Users/Kamil/_dev/blog/_site/LICENSE.md", "C:/Users/Kamil/_dev/blog/_site/public", "C:/Users/Kamil/_dev/blog/_site/public/css", "C:/Users/Kamil/_dev/blog/_site/public/css/animate.min.css", "C:/Users/Kamil/_dev/blog/_site/public/css/main.css", "C:/Users/Kamil/_dev/blog/_site/public/css/responsive.gs.12col.css", "C:/Users/Kamil/_dev/blog/_site/public/images", "C:/Users/Kamil/_dev/blog/_site/public/images/eagle.png", "C:/Users/Kamil/_dev/blog/_site/public/images/favicon.ico", "C:/Users/Kamil/_dev/blog/_site/public/images/flower.png", "C:/Users/Kamil/_dev/blog/_site/public/images/logo.png", "C:/Users/Kamil/_dev/blog/_site/public/js", "C:/Users/Kamil/_dev/blog/_site/public/js/jquery.fitvids.js", "C:/Users/Kamil/_dev/blog/_site/README.md", "C:/Users/Kamil/_dev/blog/_site/serial-port-details-in-c-sharp.html", "C:/Users/Kamil/_dev/blog/_site/stm-hal-usb-library-hard-fault.html", "C:/Users/Kamil/_dev/blog/_site/stm32-unique-id.html"]

So diff (ftp.nlst("#{distant}/**/*") - Dir.glob("#{local}/**/*")) is:

["", "", "/blog/public/css:", "", ".", "..", "animate.min.css", "main.css", "responsive.gs.12col.css", "", "", "/blog/public/images:", "", ".", "..", "eagle.png", "favicon.ico", "flower.png", "logo.png", "", "", "/blog/public/js:", "", ".", "..", "jquery.fitvids.js"]

In order to this function work properly you must make some changes:

  • make recursive FTP listing functionality
  • filter list out of dots, empty entries, etc.
  • strip local and remote paths to relative matching part
  • after that you can make subtraction, and delete unnecessary elements

Also, I think that this missing file removal should be optional, to activate in the .yml file. I personally don't want to delete any data from my server without confirmation.

If you want some additional logs just let me know.

freakone avatar Oct 26 '16 12:10 freakone

+1

paulocesarpcfj avatar Oct 26 '16 12:10 paulocesarpcfj

All right, I've yanked the 1.3.0 version. Any PR fixing this is more than welcome. I will not do it myself though, as I don't have any FTP server handy, and won't ever be able to verify this as working properly.

dmathieu avatar Oct 26 '16 13:10 dmathieu

Also, I'm declaring bankruptcy on this repo. I haven't touched an FTP server in over 5 years, and there are much better ways of deploying static websites than with FTP today.

If anyone wants ownership of this repository, I will transfer it to whoever fixes this issue.

dmathieu avatar Oct 26 '16 13:10 dmathieu

Then the error will still occurring or will have a rollback?

Thanks!

paulocesarpcfj avatar Oct 26 '16 13:10 paulocesarpcfj

You must uninstall and reinstall the gem. The error will not occur anymore. Files missing locally will not be deleted in your FTP server anymore either.

dmathieu avatar Oct 26 '16 13:10 dmathieu

Thanks, it worked!

paulocesarpcfj avatar Oct 26 '16 13:10 paulocesarpcfj

I'm leaving this issue open, as yanking a gem is not a long-term solution :)

dmathieu avatar Oct 26 '16 13:10 dmathieu

@dmathieu you mention that there are better methods for deploying a static website than over FTP. What other 'recommended' methods are there?

128keaton avatar Oct 26 '16 17:10 128keaton

GitHub Pages; Heroku static; Amazon S3 are the ones that come out of my mind.

dmathieu avatar Oct 26 '16 17:10 dmathieu

@dmathieu I get some ridiculously cheap hosting from DirectNic (with excellent uptime and support), but without any command-line access. I guess for me, FTP is still the way to go then

128keaton avatar Oct 26 '16 17:10 128keaton

Feel free to fix this issue and I'll gladly transfer this repository to you :)

Note: GitHub Pages is free too.

dmathieu avatar Oct 26 '16 17:10 dmathieu

@dmathieu , i don't have much experience with github pages and these others mentioned. How about the domain ? For example, i want www.somesite.com, with the github page i can use this ? Or I need let the domain be www.somesite.github.com ?

But thanks for the information, i'm studying the possibilities of migrations.

paulocesarpcfj avatar Oct 26 '16 17:10 paulocesarpcfj

@dmathieu I'd love to, but I don't understand Ruby that well. Thanks anyway! I'll look at GitHub pages, but the last time I checked, I couldn't get it working and for image hosting, it was terrible. On top of that, the documentation wasn't straightforward/helpful/clear

128keaton avatar Oct 26 '16 17:10 128keaton

@paulocesarpcfj https://help.github.com/articles/using-a-custom-domain-with-github-pages/

dmathieu avatar Oct 26 '16 17:10 dmathieu