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

Regexp error in reloader #565

Closed
luikore opened this issue Jun 4, 2011 · 5 comments
Closed

Regexp error in reloader #565

luikore opened this issue Jun 4, 2011 · 5 comments
Assignees
Milestone

Comments

@luikore
Copy link

luikore commented Jun 4, 2011

In development environment, I usually met with things like this when there's syntax error or something wrong in my source code:

RegexpError at /
premature end of char-class: /^\x1B[1m\x1B[1m/
file: reloader.rb location: block in remove_constant line: 154

Then the reloader refused to work even after my code fixed, then I had to restart server.

https://github.com/padrino/padrino-framework/blob/master/padrino-core/lib/padrino-core/reloader.rb#L154

I don't have time to investigate the root cause... However when monkey patched the method to change (const.to_s =~ %r{^#{base}}) to (const.to_s =~ %r{^#{base}}) rescue nil, everything works fine for me...

@ghost ghost assigned DAddYE Jun 5, 2011
@DAddYE
Copy link
Member

DAddYE commented Jun 5, 2011

Thanks for reporting that.

Can you boot in console mode and tell me what is the result of:

puts Padrino::Reloader.exclude_constants

Thanks!

DAddYE added a commit that referenced this issue Jun 5, 2011
%r{} works different than Regex.escape... great to know.
@DAddYE
Copy link
Member

DAddYE commented Jun 5, 2011

Can you confirm that latest edge now works well?

@luikore
Copy link
Author

luikore commented Jun 6, 2011

puts produces some colorful output.
p Padrino::Reloader.exclude_constants yields the following:

["Rake", "Gem", "RubyToken", "Thor", "ERB", "StringScanner", "Temple", "Date", "BSON", "Complex", "Rational", "FiberError", "Fiber", "ThreadError", "Mutex", "ThreadGroup", "RubyVM", "Thread", "Enumerator", "StopIteration", "ObjectSpace", "GC", "Math", "Binding", "UnboundMethod", "Method", "SystemStackError", "LocalJumpError", "Proc", "Process", "Struct", "Signal", "Random", "Time", "Dir", "File", "FileTest", "ARGF.class", "IO", "EOFError", "IOError", "Range", "Marshal", "Encoding", "MatchData", "Regexp", "RegexpError", "Hash", "Array", "Errno", "Bignum", "Float", "Fixnum", "Integer", "Numeric", "FloatDomainError", "ZeroDivisionError", "SystemCallError", "EncodingError", "NoMemoryError", "SecurityError", "RuntimeError", "NoMethodError", "NameError", "NotImplementedError", "LoadError", "SyntaxError", "ScriptError", "RangeError", "KeyError", "IndexError", "ArgumentError", "TypeError", "StandardError", "Interrupt", "SignalException", "fatal", "SystemExit", "Exception", "Symbol", "String", "Enumerable", "Comparable", "FalseClass", "TrueClass", "Data", "NilClass", "Kernel", "Class", "Module", "Object", "BasicObject", "Deprecate", "TSort", "RbConfig", "BigDecimal", "Tempfile", "#<Class:0x000001010c85a8>", "SizedQueue", "Queue", "ConditionVariable", "Mongoid", "ActiveSupport", "URI", "IRB", "Syck", "Benchmark", "OpenSSL", "#<Class:0x00000101148460>", "Shellwords", "Padrino", "Bundler", "Digest", "Psych", "YAML", "Zlib", "REXML", "StringIO", "Exception2MessageMapper", "OpenURI", "DateTime", "#<Module:0x000001011c1e28>", "SimpleDelegator", "#<Module:0x000001011c4628>", "Delegator", "FileUtils", "Socket", "HttpRouter", "Etc", "Addrinfo", "UNIXServer", "UNIXSocket", "UDPSocket", "TCPServer", "TCPSocket", "IPSocket", "SocketError", "BasicSocket", "EventMachine", "Rack", "Slim", "Boolean", "Binary", "#<Module:0x000001013be320>", "CoffeeScript", "I18n", "OpenID", "BufferedTokenizer", "Tilt", "OpenStruct", "SortedSet", "Set", "Monitor", "MonitorMixin", "#<Module:0x00000101438148>", "Singleton", "MultiJson", "OptionParser", "ActiveModel", "Open3", "ExecJS", "BCrypt", "Mongo", "CGI", "ClassInheritableAttributes", "FileSet", "SupportLite", "JSON", "Iconv", "Sinatra", "Fcntl", "LuckySneaks", "Readline", "RubyLex", "\e[1m\e[1m", "Pathname", "Logger", "HTMLTag", "HTMLComment", "HTMLText", "HTMLToken", "HTMLTokenizerError", "HTMLTokenizer", "MIME", "Rseg", "CBson", "RsegFilter", "Net", "RsegEngine", "Timeout", "Base64", "UrlMount", "Mail", "#<Class:0x00000103b5d660>", "Resolv", "SecureRandom", "quoted-printable", "base64", "7bit", "8bit", "binary", nil, "Treetop", "IntervalSkipList", "#<Class:0x000001052a0fc0>", "SOCKSError", "Socksify", "\e[1m\e[33m", "\e[1m\e[32m", "\e[1m\e[31m", "\e[0m\e[37m", "Admin", "MyApp", "UserApp"]

The edge works, thank you!

@DAddYE
Copy link
Member

DAddYE commented Jun 7, 2011

Interesting to know what do you do to have

"\e[1m\e[33m", "\e[1m\e[32m", "\e[1m\e[31m", "\e[0m\e[37m", as your constant :D

@DAddYE DAddYE closed this as completed Jun 7, 2011
@luikore
Copy link
Author

luikore commented Jun 7, 2011

Found why, It's socksify ...
https://github.com/astro/socksify-ruby/blob/master/lib/socksify/debug.rb

def SomeClass.to_s >_<

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

No branches or pull requests

2 participants