Community
Participate
Working Groups
After making a file/folder read-only an exception is thrown sometimes. Usually see it when making a file/folder not read-only. Steps to Reproduce: 1. Create an SSH connection 2. Create a directory 3. Make it read-only. 4. Make it not read-only. ----> Sometimes an exception is thrown and the Remote Systems View is not refreshed. So the read-only attribute is incorrect when going back to Preferences. Stacktrace: org.eclipse.rse.services.files.RemoteFileSecurityException: Operation failed. Security violation at org.eclipse.rse.internal.services.ssh.files.SftpFileService.makeSystemMessageException(SftpFileService.java:235) at org.eclipse.rse.internal.services.ssh.files.SftpFileService.setReadOnly(SftpFileService.java:873) at org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem.setReadOnly(FileServiceSubSystem.java:635) at org.eclipse.rse.internal.files.ui.propertypages.SystemFilePropertyPage.performOk(SystemFilePropertyPage.java:490) at org.eclipse.jface.preference.PreferenceDialog$12.run(PreferenceDialog.java:922) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.core.runtime.Platform.run(Platform.java:850) at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:46) at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:193) at org.eclipse.jface.preference.PreferenceDialog.okPressed(PreferenceDialog.java:902) at org.eclipse.ui.internal.dialogs.FilteredPreferenceDialog.okPressed(FilteredPreferenceDialog.java:374) at org.eclipse.jface.preference.PreferenceDialog.buttonPressed(PreferenceDialog.java:230) at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:616) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3673) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3284) at org.eclipse.jface.window.Window.runEventLoop(Window.java:820) at org.eclipse.jface.window.Window.open(Window.java:796) at org.eclipse.ui.dialogs.PropertyDialogAction.run(PropertyDialogAction.java:156) at org.eclipse.jface.action.Action.runWithEvent(Action.java:498) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:545) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:490) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:402) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3673) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3284) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2365) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2329) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2204) at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:497) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:436) at org.eclipse.equinox.launcher.Main.run(Main.java:1162) at org.eclipse.equinox.launcher.Main.main(Main.java:1137) -----------Enter bugs above this line----------- TM 2.0RC1 Testing installation : eclipse-SDK-3.3M7 RSE install : RSE 2.0 RC1 java.runtime : Sun 1.5.0_11-b03 os.name: : Windows XP, Service Pack 2 ------------------------------------------------
The SystemMessageException should include the original SftpException that caused it. But I do not see it in the backtrace below. Was there a "caused by..." entry in the backtrace? Was an error dialog shown that would include the cause? If not, we'll need to imporve error reporting to ensure we get the real cause of this displayed to the user. Tentatively targeting 2.0RC3, but I'll need more info to address this.
No error dialog is shown. It looks like in SystemFilePropertyPage.performOk() we catch the exceptions and display them in the dialog, but ok = true so the dialog still closes. The SftpException that is wrapped shows the error message: 4: Failure.
Assigning 2.0.1 since this does not happen consistently and is not critical. We should add a unit test for this (potentially exercising the function through EFS) and set folders and files read-only / writable repeatedly.
Bulk update target milestone 2.0.1 -> 3.0
Created attachment 102052 [details] Patch fixing the issue Attached patch fixes the issue. Problem was that JSch.setStat(SftpATTR) doesn't really work properly because the flags in SftpATTR cannot be re-set with API as needed. The ChannelSftp.chmod() call must be done instead. Unittest for the fix is RSEFileStoreTest.testDeleteSpecialCases()
Patch committed: [190904] Changing read-only attribute throws exception Rado please review. This is a simple small one :-)
Looks good to me. It's nice to also have a unit test.
Verified Fixed with 3.0RC2.