You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@netbeans.apache.org by Emilian Bold <em...@gmail.com> on 2019/01/01 21:58:32 UTC

Absolute paths written to all-resources.dat which break the IDE if moved entirely

I'm still investigating but it seems to me that under some conditions
absolute paths are saved in all-resources.dat (and the other .dat
files).

Problem is that if the user moves the application to another folder
(like from the Desktop to /Applications) then the IDE doesn't start
because it can't find any module! (Module could not be found...
ignoring).

So, is there something rather obvious to anyone going on here?

I suspect I will best reproduce this with a Platform app packaged as
macOS, but that script has another (unrelated) error which I also have
to report.

--emi

http://coolbeans.xyz/ - CoolBeans: An IDE for Java, JavaEE, PHP and more!

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.incubator.apache.org
For additional commands, e-mail: dev-help@netbeans.incubator.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: Absolute paths written to all-resources.dat which break the IDE if moved entirely

Posted by Jaroslav Tulach <ja...@gmail.com>.
Dne pátek 4. ledna 2019 12:01:58 CET, Emilian Bold napsal(a):
> Oh, I found the bug. I had a script call ./bin/netbeans but it was
> using the full path with a lower-case typo. Now, since macOS usually
> has a case-insensitive filesystem, the script did launch the IDE
> correctly.
> 
> *But*, it seems netbeans.home copied the path with the typo and then
> the Java code could no longer compute the relative path (since the
> strings didn't startWith) and stored the full path.

Great you can reproduce it. Try to insert some "equalsIgnoreCase" or 
"toLowerCase" or rather File.getCanonicalFile() in the caching code. It would 
be great if this got improved and also (if we are lucky) fixed the Windows 
Jenkins job failures.

-jt




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.incubator.apache.org
For additional commands, e-mail: dev-help@netbeans.incubator.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: Absolute paths written to all-resources.dat which break the IDE if moved entirely

Posted by Emilian Bold <em...@gmail.com>.
Oh, I found the bug. I had a script call ./bin/netbeans but it was
using the full path with a lower-case typo. Now, since macOS usually
has a case-insensitive filesystem, the script did launch the IDE
correctly.

*But*, it seems netbeans.home copied the path with the typo and then
the Java code could no longer compute the relative path (since the
strings didn't startWith) and stored the full path.

--emi

http://coolbeans.xyz/ - CoolBeans: An IDE for Java, JavaEE, PHP and more!

On Fri, Jan 4, 2019 at 9:54 AM Jaroslav Tulach
<ja...@gmail.com> wrote:
>
> There should be no absolute paths in the caches for anything under regular
> cluster installation and userdir. There are even tests to make sure that is
> true. They pass OK on Linux. One of them is known to fail on Windows:
>
> https://builds.apache.org/job/incubator-netbeans-windows/lastCompletedBuild/
> testReport/org.netbeans.core.startup.layers/CachingPreventsFileTouchesTest/
> testCachesDontUseAbsolutePaths/
>
> We don't test on Mac OS X as far as I know.
> -jt
>
>
> Dne středa 2. ledna 2019 0:22:29 CET, Emilian Bold napsal(a):
> > If somebody downloads to ~/Downloads and starts the app from there the
> > userdir on macOS will be in ~/Library/Application Support/ so there's
> > no relative path between them and the paths are stored as absolute
> > ("abs" identification).
> >
> > I suspect the saving netbeans.home in lastModified/all-checksum.txt
> > fixes the problem since it will invalidate the cache:
> >
> > diff --git a/platform/o.n.bootstrap/src/org/netbeans/Stamps.java
> > b/platform/o.n.bootstrap/src/org/netbeans/Stamps.java
> > index e41c90897..7231bd827 100644
> > --- a/platform/o.n.bootstrap/src/org/netbeans/Stamps.java
> > +++ b/platform/o.n.bootstrap/src/org/netbeans/Stamps.java
> > @@ -313,6 +313,7 @@ public final class Stamps {
> >          String[] relativeDirs = Clusters.relativeDirsWithHome();
> >          String home = System.getProperty ("netbeans.home"); // NOI18N
> >          if (home != null) {
> > +            sb.append("home=").append(home).append("\n");
> >              long stamp = stampForCluster (new File (home), result,
> > newestFile, processedDirs, checkStampFile, true, null);
> >
> > sb.append(relativeDirs[0]).append('=').append(stamp).append('\n'); }
> >
> > Does this make sense? I wonder why I can't reproduce it with 8.2?
> >
> > --emi
> >
> > http://coolbeans.xyz/ - CoolBeans: An IDE for Java, JavaEE, PHP and more!
> >
> > On Tue, Jan 1, 2019 at 11:58 PM Emilian Bold <em...@gmail.com> wrote:
> > > I'm still investigating but it seems to me that under some conditions
> > > absolute paths are saved in all-resources.dat (and the other .dat
> > > files).
> > >
> > > Problem is that if the user moves the application to another folder
> > > (like from the Desktop to /Applications) then the IDE doesn't start
> > > because it can't find any module! (Module could not be found...
> > > ignoring).
> > >
> > > So, is there something rather obvious to anyone going on here?
> > >
> > > I suspect I will best reproduce this with a Platform app packaged as
> > > macOS, but that script has another (unrelated) error which I also have
> > > to report.
> > >
> > > --emi
> > >
> > > http://coolbeans.xyz/ - CoolBeans: An IDE for Java, JavaEE, PHP and more!
>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.incubator.apache.org
For additional commands, e-mail: dev-help@netbeans.incubator.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: Absolute paths written to all-resources.dat which break the IDE if moved entirely

Posted by Jaroslav Tulach <ja...@gmail.com>.
There should be no absolute paths in the caches for anything under regular 
cluster installation and userdir. There are even tests to make sure that is 
true. They pass OK on Linux. One of them is known to fail on Windows:

https://builds.apache.org/job/incubator-netbeans-windows/lastCompletedBuild/
testReport/org.netbeans.core.startup.layers/CachingPreventsFileTouchesTest/
testCachesDontUseAbsolutePaths/

We don't test on Mac OS X as far as I know.
-jt


Dne středa 2. ledna 2019 0:22:29 CET, Emilian Bold napsal(a):
> If somebody downloads to ~/Downloads and starts the app from there the
> userdir on macOS will be in ~/Library/Application Support/ so there's
> no relative path between them and the paths are stored as absolute
> ("abs" identification).
> 
> I suspect the saving netbeans.home in lastModified/all-checksum.txt
> fixes the problem since it will invalidate the cache:
> 
> diff --git a/platform/o.n.bootstrap/src/org/netbeans/Stamps.java
> b/platform/o.n.bootstrap/src/org/netbeans/Stamps.java
> index e41c90897..7231bd827 100644
> --- a/platform/o.n.bootstrap/src/org/netbeans/Stamps.java
> +++ b/platform/o.n.bootstrap/src/org/netbeans/Stamps.java
> @@ -313,6 +313,7 @@ public final class Stamps {
>          String[] relativeDirs = Clusters.relativeDirsWithHome();
>          String home = System.getProperty ("netbeans.home"); // NOI18N
>          if (home != null) {
> +            sb.append("home=").append(home).append("\n");
>              long stamp = stampForCluster (new File (home), result,
> newestFile, processedDirs, checkStampFile, true, null);
>             
> sb.append(relativeDirs[0]).append('=').append(stamp).append('\n'); }
> 
> Does this make sense? I wonder why I can't reproduce it with 8.2?
> 
> --emi
> 
> http://coolbeans.xyz/ - CoolBeans: An IDE for Java, JavaEE, PHP and more!
> 
> On Tue, Jan 1, 2019 at 11:58 PM Emilian Bold <em...@gmail.com> wrote:
> > I'm still investigating but it seems to me that under some conditions
> > absolute paths are saved in all-resources.dat (and the other .dat
> > files).
> > 
> > Problem is that if the user moves the application to another folder
> > (like from the Desktop to /Applications) then the IDE doesn't start
> > because it can't find any module! (Module could not be found...
> > ignoring).
> > 
> > So, is there something rather obvious to anyone going on here?
> > 
> > I suspect I will best reproduce this with a Platform app packaged as
> > macOS, but that script has another (unrelated) error which I also have
> > to report.
> > 
> > --emi
> > 
> > http://coolbeans.xyz/ - CoolBeans: An IDE for Java, JavaEE, PHP and more!





---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.incubator.apache.org
For additional commands, e-mail: dev-help@netbeans.incubator.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: Absolute paths written to all-resources.dat which break the IDE if moved entirely

Posted by Emilian Bold <em...@gmail.com>.
If somebody downloads to ~/Downloads and starts the app from there the
userdir on macOS will be in ~/Library/Application Support/ so there's
no relative path between them and the paths are stored as absolute
("abs" identification).

I suspect the saving netbeans.home in lastModified/all-checksum.txt
fixes the problem since it will invalidate the cache:

diff --git a/platform/o.n.bootstrap/src/org/netbeans/Stamps.java
b/platform/o.n.bootstrap/src/org/netbeans/Stamps.java
index e41c90897..7231bd827 100644
--- a/platform/o.n.bootstrap/src/org/netbeans/Stamps.java
+++ b/platform/o.n.bootstrap/src/org/netbeans/Stamps.java
@@ -313,6 +313,7 @@ public final class Stamps {
         String[] relativeDirs = Clusters.relativeDirsWithHome();
         String home = System.getProperty ("netbeans.home"); // NOI18N
         if (home != null) {
+            sb.append("home=").append(home).append("\n");
             long stamp = stampForCluster (new File (home), result,
newestFile, processedDirs, checkStampFile, true, null);
             sb.append(relativeDirs[0]).append('=').append(stamp).append('\n');
         }

Does this make sense? I wonder why I can't reproduce it with 8.2?

--emi

http://coolbeans.xyz/ - CoolBeans: An IDE for Java, JavaEE, PHP and more!
On Tue, Jan 1, 2019 at 11:58 PM Emilian Bold <em...@gmail.com> wrote:
>
> I'm still investigating but it seems to me that under some conditions
> absolute paths are saved in all-resources.dat (and the other .dat
> files).
>
> Problem is that if the user moves the application to another folder
> (like from the Desktop to /Applications) then the IDE doesn't start
> because it can't find any module! (Module could not be found...
> ignoring).
>
> So, is there something rather obvious to anyone going on here?
>
> I suspect I will best reproduce this with a Platform app packaged as
> macOS, but that script has another (unrelated) error which I also have
> to report.
>
> --emi
>
> http://coolbeans.xyz/ - CoolBeans: An IDE for Java, JavaEE, PHP and more!

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.incubator.apache.org
For additional commands, e-mail: dev-help@netbeans.incubator.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists