Skip to content

regression tests fail if /etc/tidy.conf or ~/.tidyrc exists #778

@ler762

Description

@ler762

Just doing touch ~/.tidyrc or touch /etc/tidy.conf is enough to make some the regression tests fail.

$ ls -l /etc/tidy.conf ~/.tidyrc
ls: cannot access '/etc/tidy.conf': No such file or directory
ls: cannot access '/home/Lee/.tidyrc': No such file or directory
 $ tidy -q -export-config | grep -i indent
indent: no
indent-attributes: no
indent-cdata: no
indent-spaces: 2
indent-with-tabs: no
$ touch ~/.tidyrc
$ tidy -q -export-config | grep -i indent
indent: no
indent-attributes: no
indent-cdata: no
indent-spaces: 0
indent-with-tabs: no

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:

$ git diff
diff --git a/src/config.c b/src/config.c
index f5e8379..67fc804 100644
--- a/src/config.c
+++ b/src/config.c
@@ -1056,8 +1056,6 @@ int TY_(ParseConfigFileEnc)( TidyDocImpl* doc, ctmbstr file, ctmbstr charenc )
     if ( fname != (tmbstr) file )
         TidyDocFree( doc, fname );

-    AdjustConfig( doc );
-
     /* any new config errors? If so, return warning status. */
     return (doc->optionErrors > opterrs ? 1 : 0);
 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions