rejetto forum

Software => HFS ~ HTTP File Server => Bug reports => Topic started by: maverick on November 26, 2007, 05:33:29 AM

Title: beta 146 archivable & browse sub-folders
Post by: maverick on November 26, 2007, 05:33:29 AM
Looks like this was missed from the beta forum:

Quote from: maverick
Something wrong with this build.  I can't say that it actually crashes but on start-up once I start to browse the folders/sub-folders, HFS quits and Exits all of a sudden.  I can reproduce this problem everytime I try to browse a folder/sub-folder.

Quote from: rejetto
it works with subfolders here
find more clues about the problem or pass me your vfs and ini (privately)

Make one or more of the sub-folders archivable.  Then try to browse them.  HFS will quit and Exit.
Title: Re: beta 146 archivable & browse sub-folders
Post by: rejetto on November 26, 2007, 10:58:03 AM
I created a virtual folder, then inside a real folder, which has been marked as archivable.
I removed archivable from the root.
I accessed them at all level. No problem. Tried to download the archive. No problem.
We need something else to reproduce it.
Title: Re: beta 146 archivable & browse sub-folders
Post by: rejetto on November 28, 2007, 09:13:54 PM
I ran #146, applied your change to the default tpl, then created this vfs (attached), clicked here and there but no problems at all.

Can you tell me more?
Title: Re: beta 146 archivable & browse sub-folders
Post by: maverick on November 29, 2007, 01:48:29 AM

My apologies rejetto.  I found the cause to my problem and it was on my end.  A bad cut & paste in my template was causing the problem.  Fixed.
Title: Re: beta 146 archivable & browse sub-folders
Post by: rejetto on November 29, 2007, 02:08:36 AM
But... if HFS quits with a click by the client, it means it has a bug that must be fixed.
Isn't it so?
Title: Re: beta 146 archivable & browse sub-folders
Post by: maverick on November 29, 2007, 02:39:47 AM

Yes, that is what I thought too.  I spent a lot of time tracking down this problem.  This bad cut & paste (partial code that was even remarked) wasn't something that was done recently.  Not sure how that happened and it was in the archive section that I missed before.  I had no errors or anything else running this up to build 145.  But build 146 wouldn't allow it and HFS quit as I explained before.  I removed that entry from the template and now it is working good again.  I'll let you know if something else shows up.
Title: Re: beta 146 archivable & browse sub-folders
Post by: rejetto on November 29, 2007, 02:50:48 AM
I think i was not clear.
I want to reproduce the problem you had.
I want HFS to not quit, if that is not the wish of the user.
Can you provide me the information to reproduce the problem?
Title: Re: beta 146 archivable & browse sub-folders
Post by: maverick on November 29, 2007, 11:27:11 AM
I don't remember exactly what I removed from the template that caused the problem.  However, I added something similar to the default template which reproduces the problem.  See attached.

Let me know if you were able to reproduce it ...
Title: Re: beta 146 archivable & browse sub-folders
Post by: rejetto on November 29, 2007, 12:37:25 PM
ok, it was quite "easy" :)

it's the %item-archive% inside the [item-archive], that is infinite recursion.
i will try to put a solution to this, but it's not obvious, because a simple check on current symbol and section won't do: the cycle may close at depth N.
e.g.

[a]
%c%

[c]
%d%

[d]
%a%
Title: Re: beta 146 archivable & browse sub-folders
Post by: maverick on November 29, 2007, 01:01:29 PM

I'm happy you were able to reproduce the problem and know what causes it.  I hope you are able to find a solution.
Title: Re: beta 146 archivable & browse sub-folders
Post by: maverick on November 29, 2007, 01:16:06 PM

As I mentioned before, this problem started with 2.3 beta 146.  This problem did not existed with earlier betas.

Don't know if you tried it or not, but load beta 145 and the files I attached above and you will see that there is no problem with %item-archive% inside the [item-archive].  The looping problem was introduced in beta 146.
Title: Re: beta 146 archivable & browse sub-folders
Post by: rejetto on November 29, 2007, 02:44:45 PM
thank you for reporting, but the bug is actually introduced because of a new power of the template engine: being able to recur on symbols at any level with no overhead.
before it was at 2 (or 3?) levels and with big overhead.

consider using {{comment}} for your comments if you don't want them to reach the user.
Title: Re: beta 146 archivable & browse sub-folders
Post by: Unknown8063 on November 29, 2007, 03:48:19 PM
ok, it was quite "easy" :)

it's the %item-archive% inside the [item-archive], that is infinite recursion.
i will try to put a solution to this, but it's not obvious, because a simple check on current symbol and section won't do: the cycle may close at depth N.
e.g.

[a]
%c%

[c]
%d%

[d]
%a%

I don't know what your capabilities are inside Delphi, but in PHP I'd push each symbol I expand onto a stack and pop it when I'm done.  Then it is simply a matter of scanning the stack to see if you are already inside an expansion of that symbol.
Title: Re: beta 146 archivable & browse sub-folders
Post by: rejetto on November 29, 2007, 04:06:10 PM
i search symbols, and as i find one, i "expand" it and recur on the expanded text

i'm now inserting some tests that will prevent infinite recursion.
it is just to not crash in case of user's error.
Title: Re: beta 146 archivable & browse sub-folders
Post by: Foggy on November 30, 2007, 05:29:30 AM
if an infinite loop is detected I think it would be a good idea to have hfs create a message box to alert the error.
Title: Re: beta 146 archivable & browse sub-folders
Post by: rejetto on November 30, 2007, 07:02:57 PM
at the moment the loop is suddenly stopped and the symbol/macro is not expanded.

since with macros not every infinite loop can be detected, i put a hard limit of 50.