Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Unix parser raises an ArgumentError: argument out of range exception for some entries #11

Open
taylorskalyo opened this issue Jan 28, 2015 · 0 comments · May be fixed by #21
Open

Comments

@taylorskalyo
Copy link

I encountered the following error while attempting to parse an FTP list entry.

Net::FTP::List.parse("-rw-r--r--   1 tig tig 39757835 Jan 26  2014 PSA 23 99 May-2010.pdf")
ArgumentError: argument out of range
        from /Users/t/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/1.8/time.rb:184:in `local'
        from /Users/t/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/1.8/time.rb:184:in `make_time'
        from /Users/t/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/1.8/time.rb:243:in `parse'
        from /Users/t/code/vendor/plugins/net-ftp-list/lib/net/ftp/list/unix.rb:56:in `parse'
        from /Users/t/code/vendor/plugins/net-ftp-list/lib/net/ftp/list.rb:26:in `parse'
        from /Users/t/code/vendor/plugins/net-ftp-list/lib/net/ftp/list/parser.rb:9:in `each'
        from /Users/t/code/vendor/plugins/net-ftp-list/lib/net/ftp/list/parser.rb:9:in `with_each_parser'
        from /Users/t/code/vendor/plugins/net-ftp-list/lib/net/ftp/list.rb:25:in `parse'
        from (irb):28

It looks like the Unix parser's regex pattern matched the entry's raw string, but in an unexpected way. "PSA" was classified as the mtime_month_and_day. When this value was passed, along with the current year, to Time::parse, the exception was raised.

@dim dim linked a pull request May 27, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant