#139 somehow, "Other modules" gets out of sync with cabal text.

open
nobody
None
5
2012-12-06
2012-02-05
Anonymous
No

I don't know I did this, but somehow I got in a state where my Cabal file had 3 stanzas, all with a full "other-modules" section, and no buildwrapper errors or Problems in the UI. But, in the structured UI view of the Cabal file, all the checkboxes for the stanza #2 where unchecked. As a result, I think that the model for the cabal was not "aware" of these module declarations.

Once the "Other modules" get unchecked in the UI view of the cabal file, but the cabal source text remains, the following misbehavior happens:

:
When I Move or Rename a module, the Cabal file's "other-modules" secion is updated to track the module's new name.

However, in a project with multiple stanzas that use the renamed module, sometimes not every stanza is updated with the new name.

After the Refactor is finished, the Cabal file is invalid, and buildwrapper fails to build, with an error like:

My (bad) guess is that in /net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/refactoring/participants/Util.java
in the loop over stanzas, somehow the some stanzas' changes are not getting saved when a later stanza is processed.

cabal.exe: can't find source for Test\Test in src,

(after renaming Test.Test to a different name)

Unfortunately, I can't reproduce this with a simple test case.

However, I have reproduced the misbehavior many times in one project.

Feel free to close this issue as not-reproducible, but I wanted to file a report that it happened once.

Discussion


  • Anonymous
    2012-02-05

    I just manually re-checked the boxes in the UI, and cleaned the project, and built everything to work, and the project ran, OK.

    Then I right-clicked on a module in Project Explorer (in Haskell Perspective), and chose Rename, and changed the name.
    In the structured UI for Cabal editor, I see the module named change in all three stanzas.

    However, when I go to look at the Cabal text, the stanza #2 (which happens to be for the executable that I have been actively testing today), does not get updated with the new module name.

    I repeated the misbehavior 5 times, fixing the cabal file, getting a build, Rename, fixing the cabal file again, etc.

    Problem persisted even after closing all consoles where the executable is running.

    So somehow, the stanza is getting "locked" or decoupled from the strucured UI model, so that Refactor changes are not being applied to the text file.

    I apologize that I can't provide a self-contained test-case.

     
  • JP Moresmau
    JP Moresmau
    2012-02-05

    Which version are you using? I can't recreate. I have a project with the same module in several stanzas, and renaming works fine. Can you attach your project or your cabal file?

     

  • Anonymous
    2012-03-14

    example .cabal file

     
    Attachments

  • Anonymous
    2012-03-14

    .hsproject file

     
    Attachments

  • Anonymous
    2012-03-14

    .project file

     
    Attachments

  • Anonymous
    2012-03-14

    I apologize, I didn't see your comment.

    I was using 2.2.2.

    I have attached the .cabal, .project, and .hsproject files.
    There are 20+ source files, so I haven't posted all those.

    I will post a smaller project if I can repro on a small example case.

    Another update:

    Today I tried to repro the problem, and I Renamed (F2) a file Test/Test.hs to Test/Test2.hs.

    The .cabal file updated correctly, but I got a build error "cannot find file src/Test/Test2.hs", even though I verified in Windows Explorer that the (new) file exists. Project -> Clean fixed my project. (I can make this problem repeat very easily.)

    Another interesting note: During this experiment of renaming files, sometimes my build fails with spurious errors, errors that refer to code that no longer exists. (Code was wrong *in the recent past*, with the error reported now, but the code that exists now does NOT have that mistake.)

    Anyway, I will upgrade to 2.2.3 and continue my occasional work on this project. I will report if I see this issue again with any new diagnostic information.

     
  • JP Moresmau
    JP Moresmau
    2012-03-15

    The SaveEndo.cabal file has a executable, BuildRna, that has two other-modules section, and a flag in the middle. This is not great. Remove or move the flag declaration and unify the two other-modules section, I'd say things will work better.

     

  • Anonymous
    2012-03-15

    Ah, Thanks!

    I don't see that flag in the UI, so I probably entered that flag myself and accidentally split up or duplicated the other-modules section.

    OK, I'll assume this is fixed for now, and report back if I see trouble in the future.

     
    Last edit: Anonymous 2014-10-06