AdaCore / adareducer

GNU General Public License v3.0
13 stars 2 forks source link

Libadalang crash on deleted source file #27

Closed yannickmoy closed 2 years ago

yannickmoy commented 2 years ago

On a project, I get the following error, which seems to happen because adareducer tries to analyze a file it has deleted (a_strings.ads has been replaced in the directory by a_strings.ads.deleted:

    1/31: analyzing .../flatrepro2/a_strings.ads
??? cannot find a root node for .../flatrepro2/a_strings.ads
Traceback (most recent call last):
  File "/home/moy/anod/e3/bin/adareducer", line 8, in <module>
    sys.exit(main())
  File "/home/moy/anod/e3/lib/python3.9/site-packages/click/core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
  File "/home/moy/anod/e3/lib/python3.9/site-packages/click/core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "/home/moy/anod/e3/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/moy/anod/e3/lib/python3.9/site-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/home/moy/anod/e3/lib/python3.9/site-packages/ada_reducer/main.py", line 34, in main
    gui.GUI.run(r)
  File "/home/moy/anod/e3/lib/python3.9/site-packages/ada_reducer/gui.py", line 19, in run
    self.engine.run()
  File "/home/moy/anod/e3/lib/python3.9/site-packages/ada_reducer/engine.py", line 251, in run
    self.sort_ads_files()
  File "/home/moy/anod/e3/lib/python3.9/site-packages/ada_reducer/engine.py", line 143, in sort_ads_files
    self.attempt_delete(x)
  File "/home/moy/anod/e3/lib/python3.9/site-packages/ada_reducer/engine.py", line 107, in attempt_delete
    buf = Buffer(file)
  File "/home/moy/anod/e3/lib/python3.9/site-packages/ada_reducer/types.py", line 31, in __init__
    self.load()
  File "/home/moy/anod/e3/lib/python3.9/site-packages/ada_reducer/types.py", line 38, in load
    with open(self.filename, "rb") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/moy/tests/5823-005/flatrepro2/a_strings.ads'

Is it a known issue? I could resume the call to adareducer afterwards.

setton commented 2 years ago

this is probably an unintended side effect of the brute force deletion pass that was added, I'll fix