Skip to content
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: hintConf exclusion no longer prevents hints #13912

Closed
disruptek opened this issue Apr 7, 2020 · 5 comments
Closed

Regression: hintConf exclusion no longer prevents hints #13912

disruptek opened this issue Apr 7, 2020 · 5 comments

Comments

@disruptek
Copy link
Contributor

I have this code in Nimph:

result = newConfigRef()
result.notes.excl hintConf

In 1.2 and not 1.0, I now see config file hints during the numerous parses that Nimph performs:

$ nimph clone lua
Hint: used config file '/home/adavidoff/nims/1.2/config/nim.cfg' [Conf]
Hint: used config file '/home/adavidoff/nims/1.2/config/config.nims' [Conf]
Hint: used config file '/home/adavidoff/git/nimmer/nim.cfg' [Conf]
👭cloning git://github.com/jangko/nimLUA.git...
Hint: used config file '/home/adavidoff/nims/1.2/config/nim.cfg' [Conf]
Hint: used config file '/home/adavidoff/nims/1.2/config/config.nims' [Conf]
Hint: used config file '/home/adavidoff/git/nimmer/nim.cfg' [Conf]
Hint: used config file '/home/adavidoff/nims/1.2/config/nim.cfg' [Conf]
Hint: used config file '/home/adavidoff/nims/1.2/config/config.nims' [Conf]
Hint: used config file '/home/adavidoff/git/nimmer/nim.cfg' [Conf]
@timotheecour
Copy link
Member

the hint processing logic has been updated since 1.0 to fix several issues, see:

since the main use case of hint to to use in in cfg files or on cmdline and not via result.notes.excl hintConf (implementation detail of the compiler), your use case was not taken into account as a regression test.
But it should be easy to adapt your use case result.notes.excl hintConf to work with the current hint implementation, see how it's done in processSpecificNote; if you can't make it work, please provide a minimal example for how to run your use case (including dependencies if your use case can't be minimized without them)

@disruptek
Copy link
Contributor Author

Are you serious?

@disruptek
Copy link
Contributor Author

Unfortunately, this is not the end of the story. The processing of NimScript fails as Nimph tries to read the environment's configuration.

$ nimph doctor                                                                     10:48
Hint: used config file '/home/adavidoff/nims/1.3/config/nim.cfg' [Conf]
Hint: used config file '/home/adavidoff/nims/1.3/config/config.nims' [Conf]
Hint: used config file '/home/adavidoff/git/golden/nim.cfg' [Conf]
/home/adavidoff/git/golden/deps/packages_official.json not found
couldn't get nimble's package list from /home/adavidoff/git/golden/deps/
Downloading Official package list
    Success Package list downloaded.
nimble refreshed the package list
  5ce53f       golden   move devel out
👭cloning https://github.com/disruptek/foreach...
... into /home/adavidoff/git/golden/deps/pkgs/foreach-1.0.2
rolled to #1.0.2 to meet foreach>=1.0.2
👭cloning https://github.com/disruptek/bump...
... into /home/adavidoff/git/golden/deps/pkgs/bump-1.8.15
Traceback (most recent call last)
/home/adavidoff/git/nimph/src/nimph.nim(896) nimph
/home/adavidoff/git/nimph/deps/pkgs/cligen-0.9.41/cligen.nim(640) rundoctor
/home/adavidoff/git/nimph/src/nimph.nim(149) fixer
/home/adavidoff/git/nimph/src/nimph/doctor.nim(353) doctor
/home/adavidoff/git/nimph/src/nimph/doctor.nim(169) fixDependencies
/home/adavidoff/git/nimph/src/nimph/dependency.nim(801) rollTowards
/home/adavidoff/git/nimph/src/nimph/project.nim(893) relocateDependency
/home/adavidoff/git/nimph/src/nimph/project.nim(846) addMissingSearchPathsTo
/home/adavidoff/git/nimph/src/nimph/config.nim(156) loadAllCfgs
/home/adavidoff/nims/1.3/compiler/nimconf.nim(255) loadConfigs
/home/adavidoff/nims/1.3/compiler/scriptconfig.nim(228) runNimScript
/home/adavidoff/nims/1.3/compiler/modules.nim(124) compileSystemModule
/home/adavidoff/nims/1.3/compiler/modules.nim(84) compileModule
/home/adavidoff/nims/1.3/compiler/passes.nim(210) processModule
/home/adavidoff/nims/1.3/compiler/passes.nim(86) processTopLevelStmt
/home/adavidoff/nims/1.3/compiler/sem.nim(602) myProcess
/home/adavidoff/nims/1.3/compiler/sem.nim(570) semStmtAndGenerateGenerics
/home/adavidoff/nims/1.3/compiler/semstmts.nim(2308) semStmt
/home/adavidoff/nims/1.3/compiler/semexprs.nim(1014) semExprNoType
/home/adavidoff/nims/1.3/compiler/semexprs.nim(2776) semExpr
/home/adavidoff/nims/1.3/compiler/semstmts.nim(2248) semStmtList
/home/adavidoff/nims/1.3/compiler/semexprs.nim(2818) semExpr
/home/adavidoff/nims/1.3/compiler/semstmts.nim(2176) evalInclude
/home/adavidoff/nims/1.3/compiler/semstmts.nim(2154) incMod
/home/adavidoff/nims/1.3/compiler/modules.nim(111) includeModule
/home/adavidoff/nims/1.3/compiler/syntaxes.nim(174) parseFile
/home/adavidoff/nims/1.3/compiler/syntaxes.nim(38) parseAll
/home/adavidoff/nims/1.3/compiler/parser.nim(2316) parseAll
/home/adavidoff/nims/1.3/compiler/ast.nim(1098) add
/home/adavidoff/nims/1.3/lib/system/gc.nim(447) newSeq
/home/adavidoff/nims/1.3/lib/system/gc.nim(439) newObj
/home/adavidoff/nims/1.3/lib/system/alloc.nim(786) rawAlloc
SIGSEGV: Illegal storage access. (Attempt to read from nil?)

@timotheecour
Copy link
Member

@disruptek take a look at the current processSpecificNote

...
    of "off":
      if state == wWarningAsError:
        excl(conf.warningAsErrors, n)
      else:
        excl(conf.notes, n)
        excl(conf.mainPackageNotes, n)
        excl(conf.foreignPackageNotes, n)

can you try in your code:

result.notes.excl hintConf
result.mainPackageNotes.excl hintConf
result.foreignPackageNotes.excl hintConf

however, these APi's are not exposed, they're implementation details subject to change (eg to fix this timotheecour#58 (comment)); the hint/warning logic could've been implemented differently but right now it is what it is.

@disruptek
Copy link
Contributor Author

Thanks, it works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants