Skip to content

Make sure gems path is regex-safe#7985

Merged
headius merged 1 commit intojruby:masterfrom
headius:quote_gems_dir
Oct 26, 2023
Merged

Make sure gems path is regex-safe#7985
headius merged 1 commit intojruby:masterfrom
headius:quote_gems_dir

Conversation

@headius
Copy link
Member

@headius headius commented Oct 26, 2023

Fixes #7983

@headius headius added this to the JRuby 9.4.5.0 milestone Oct 26, 2023
@jcharaoui
Copy link
Contributor

I've tested this and it doesn't work:

--- gem racc-1.6.0 ---                                                                                    
copy gem content to /<<PKGBUILDDIR>>/lib/ruby/stdlib                                                      
 copying: /<<PKGBUILDDIR>>/lib/target/rubygems/gems/racc-1.6.0-java/lib/racc to /<<PKGBUILDDIR>>/lib/ruby/stdlib
 copying: /<<PKGBUILDDIR>>/lib/target/rubygems/gems/racc-1.6.0-java/lib/racc.rb to /<<PKGBUILDDIR>>/lib/ruby/stdlib
copy executable /<<PKGBUILDDIR>>/lib/target/rubygems/bin/racc to /<<PKGBUILDDIR>>/bin          
copy racc to /<<PKGBUILDDIR>>/lib/ruby/gems/shared/gems/<<PKGBUILDDIR>>/lib/target/rubygems/gems/racc-1.6.0-java/bin/racc
copy to specifications/default: racc-1.6.0-java.gemspec

We shouldn't see the <<PKGBUILDDIR>>/lib/target/rubygems component in the binstub path.

@enebo
Copy link
Member

enebo commented Oct 26, 2023

Seems like it is quoting more than we bargained for

@headius
Copy link
Member Author

headius commented Oct 26, 2023

So it looks like there's some bits in the string that are intended to be processed as a regexp. I'll dig in further.

@headius
Copy link
Member Author

headius commented Oct 26, 2023

After another look at this I think the original proposed change makes more sense anyway: replace the regex with the gems string directly. If we are essentially trying to quote the entire contents of a regex, there's no reason to use a regex. I'll push your proposed fix instead.

@headius
Copy link
Member Author

headius commented Oct 26, 2023

@jcharaoui I assume since this was your proposed fix that this PR is now working for you, yes?

@jcharaoui
Copy link
Contributor

Right, this works for me!

@headius headius merged commit cfff968 into jruby:master Oct 26, 2023
@headius headius deleted the quote_gems_dir branch October 26, 2023 19:40
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 this pull request may close these issues.

Build, test failures when build directory contains special characters

3 participants