-
Notifications
You must be signed in to change notification settings - Fork 422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
regression tests fail if /etc/tidy.conf or ~/.tidyrc exists #778
Comments
@ler762 thank you for adding this issue... this takes over from Tests Issue 30... And showing an easy way to But it is not just an issue of our This could yield strange results for Do not see the removal of I have not yet had a chance to study it in detail, but there could be important issues with config consistency that are addressed by this function... that, in itself, needs to be checked, understood, and reported... So I completely agree Look forward to further feedback... thanks... |
@geoffmcl htacg/tidy-html5-tests#30 is a different problem The fix for htacg/tidy-html5-tests#30 is to add a And adding a This problem is different. Calling
Now try removing the
I gave up on trying to figure out exactly what correct behavior would be for Turns out I got lucky & removing the
and all the tests pass. |
@ler762 this is the problem I faced when I opened Tests 30 - It is the SAME problem! And as expressed at length, would never paper over the problem by adding say a If you can not understand the need for the That is, try again My method, is to sort of write research notes, as reading the code, and this is some of my thoughts... I hope they help... The default state of
In
However, if the option This suggests the
I would really appreciate it if someone could test, try, improve this code, maybe in an The simple
Look forward to further feedback... thanks... |
@geoffmcl I see two different problems: Issue 1: don't adjust the config until you have the complete config If So it sure seems like the fix for this problem is not calling AdjustConfig until tidy has the complete config - which means all the init files and command line options. Issue 2: need the ability to ignore the default init files when tidy is called in a script
The fix for this problem is not reading |
@ler762 we seem to have a big problem in communication... ;=)) Have I not tried to imply just deleting And Take a chained command like In other words, there is no moment when tidy has the complete config... Configuration is an additive process, and at the end of each config file read, but we do not know yet if there will be more, that complete config must be checked for consistency... to be used on the next html input... and so on... If you still do not get it, what else can I explain? But please do not repeat things over, and over... Have suggested a fix, on which I need help... I will get to this soonest... Look forward to further constructive feedback... thanks... |
@geoffmcl yes, we do seem to be doing a bit of talking past each other :(
I'd say that just before tidy starts processing the file to be tidy'ed it has, by definition, the complete config. It's run out of options, config files to be read, whatever else there is and it's to the point of ok - time to process this file. Start tracing the procedure calls beginning at console/tidy.c where it starts processing the file:
Let's add a bunch of print statements to tidy & come up with an extreme example:
Looks like tidy did the right thing each time. |
@ler762 now it becomes move Why, I do not exactly know... some discussion about I do not have time to build, and debug now... not against maybe better logic here, but at what Is after But this should be a separate issue, if you want to pursue it... Moving it may or may not solve the problem addressed here... I don't think it will... maybe harder to setup... That is, in one special case where the Such code presently resides only in It has an action to be performed, however it finds the Hope I can get some help in this... thanks... PS: Have you tried |
Ok, found another way to show this "loss of indent" bug... It is really nothing to do with The title should be something like "indent is not restored if it gets zeroed", or something... But to test, first make sure runtime init config files are all removed...
Setup, and run the following...
Now, I hope it can be clearly seen moving Sorry about allowing the misleading current title to stand... but it was through the I certainly seek some help in solving this "loss of indent" bug... thanks... |
20210225: First I tried, moving But I have found a simple diff --git a/src/config.c b/src/config.c
index bae56b8..5db8e28 100644
--- a/src/config.c
+++ b/src/config.c
@@ -739,6 +739,10 @@ void TY_(ResetConfigToSnapshot)( TidyDocImpl* doc )
}
if ( needReparseTagsDecls )
ReparseTagDecls( doc, changedUserTags );
+
+ if (cfg(doc, TidyIndentSpaces) < 2) /* Is. #778 */
+ TY_(SetOptionInt)(doc, TidyIndentSpaces, 2);
+
}
Maybe that Perhaps that patch should be expanded to - if (cfg(doc, TidyIndentSpaces) < 2) /* Is. #778 */
if (cfgBool(doc, TidyPPrintTabs))
TY_(SetOptionInt)(doc, TidyIndentSpaces, 1);
else
TY_(SetOptionInt)(doc, TidyIndentSpaces, 2); or something... Incidentally, I also ran the regression tests, using this Will do some more testing before pushing say an Meantime, look forward to further feedback, comments, patches, etc... thanks... |
AdjustConfig moved to be called only a single time after all configuration is loaded. |
Just doing
touch ~/.tidyrc
ortouch /etc/tidy.conf
is enough to make some the regression tests fail.If tidy is going to have multiple init files it needs to wait until all are read before calling AdjustConfig.
Or not call AdjustConfig at all & make the user responsible for specifying a consistent set of options.
Or fix AdjustConfig to not bork the config.
Or .. what?
Not calling AdjustConfig is enough to have all the regression tests pass if /etc/tidy.conf and/or ~/.tidyrc exist:
The text was updated successfully, but these errors were encountered: