This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 108252

Summary: Changing file permissions on startup
Product: ruby Reporter: Michal Zlamal <mzlamal>
Component: PlatformAssignee: Martin Krauskopf <mkrauskopf>
Status: RESOLVED FIXED    
Severity: blocker CC: jrechtacek
Priority: P3    
Version: 6.x   
Hardware: All   
OS: Linux   
Issue Type: DEFECT Exception Reporter:
Bug Depends on: 24357    
Bug Blocks:    

Description Michal Zlamal 2007-06-27 10:07:18 UTC
the 6.0 M10 - 200706262201 build:
full install on Linux as a root.

While runing as user, the Ruby tries to change file permissions, which is of course impossible.
I see this also as a security issue - user software tries to modify file permissions.
This exception is raised on every startup => P1

java.io.IOException: could not run [/bin/chmod, u+rx, gem, jirb, rake, rdoc, spec, jruby.bat, jirb_swing.bat,
generate_yaml_index.rb, gemri, jruby, rails, gem_mirror, jruby.rb, jrubycli, jrubysrv, spec_translator, gem_server,
gemwhich.bat, gemwhich, gem.bat, gemlock, update_rubygems, jirb_swing, jrubyc, _jrubycleanup.bat, testrb,
gem_server.bat, _jrubysetcp.bat, _jrubyvars.bat, jirb.bat, jrubyd.bat, jrubyw.bat, index_gem_repository.rb,
_jrubyvmopts.bat, gem_mirror.bat] : Exit value=1
	at org.netbeans.api.ruby.platform.RubyInstallation.ensureExecutable(RubyInstallation.java:887)
	at org.netbeans.modules.ruby.rubyproject.RubyProjectModuleInstaller.restored(RubyProjectModuleInstaller.java:40)
	at org.netbeans.core.startup.NbInstaller.loadCode(NbInstaller.java:354)
	at org.netbeans.core.startup.NbInstaller.load(NbInstaller.java:273)
	at org.netbeans.ModuleManager.enable(ModuleManager.java:903)
	at org.netbeans.core.startup.ModuleList.installNew(ModuleList.java:380)
	at org.netbeans.core.startup.ModuleList.trigger(ModuleList.java:316)
	at org.netbeans.core.startup.ModuleSystem.restore(ModuleSystem.java:260)
	at org.netbeans.core.startup.Main.getModuleSystem(Main.java:149)
	at org.netbeans.core.startup.Main.start(Main.java:300)
	at org.netbeans.core.startup.TopThreadGroup.run(TopThreadGroup.java:88)
[catch] at java.lang.Thread.run(Thread.java:595)
Comment 1 Tomas Danek 2007-06-27 14:11:59 UTC
reproducible.
Permissions modifications in module installer are not necessary at the moment when it is guaranteed that jruby binaries
have executable permissions set, no matter where user got the build (installer, hudson, some custom build, ...)
Comment 2 Torbjorn Norbye 2007-06-27 16:36:16 UTC
The module is doing a chmod in the ModuleInstall on all the JRuby files because that is the only* way to make JRuby work with Auto Update.

*=Only way I know of, and I did ask around. There was also a similar question on nbdev two days ago where Jesse gave pretty much the same answer.

   Gordon Prieur wrote:
    >is there any way I can install an nbm with execution bits turned on
    >or do I have to do that from my module?

    I think you need to use ModuleInstall + InstalledFileLocator.

I would love to be able to annotate these bits with executable permission somehow in the NBM and have the Auto Update client restore this state when the 
NBM is installed, rather than doing this each and every time.

One thing I could do now is to just -silently- try chmodding - in other words, catch and swallow any IO exceptions that result.

I'm not sure what the security implications are here.

(Btw this is a duplicate, I should dig up the others and combine them)
Comment 3 Torbjorn Norbye 2007-06-27 18:33:04 UTC
I'm silently logging IO exceptions now rather than causing the printstacktrace popup. Reducing priority. Fixing this completely will depend on issue 24357. 

IDE:-------------------------------------------------
IDE: [6/27/07 10:28 AM] Committing started
Checking in src/org/netbeans/api/ruby/platform/RubyInstallation.java;
/cvs/scripting/ruby/platform/src/org/netbeans/api/ruby/platform/RubyInstallation.java,v  <--  RubyInstallation.java
new revision: 1.30; previous revision: 1.29
done
Checking in manifest.mf;
/cvs/scripting/ruby/platform/manifest.mf,v  <--  manifest.mf
new revision: 1.22; previous revision: 1.21
done
IDE: [6/27/07 10:28 AM] Committing finished
Comment 4 Torbjorn Norbye 2007-06-27 18:33:51 UTC
*** Issue 107410 has been marked as a duplicate of this issue. ***
Comment 5 Torbjorn Norbye 2007-06-27 18:34:40 UTC
*** Issue 104385 has been marked as a duplicate of this issue. ***
Comment 6 Jiri Kovalsky 2007-07-03 14:00:18 UTC
Reassigning this issue to newly created 'ruby' component.
Comment 7 Torbjorn Norbye 2007-08-10 01:29:48 UTC
I can't fix this until the plugin manager supports file permissions
Comment 8 Martin Krauskopf 2008-09-25 15:06:03 UTC
Nothing else to fix here. We can't do more here.

BTW NetBeans runs JRuby through 'java', so no issue from NetBeans + JRuby.