florianschanda / miss_hit

MATLAB Independent, Small & Safe, High Integrity Tools - code formatter and more
GNU General Public License v3.0
158 stars 21 forks source link

internal compiler error: possibly symlink related ? #256

Closed Remi-Gau closed 2 years ago

Remi-Gau commented 2 years ago

Encountered this error. This is most likely a one in million edge case so feel free to close it right away.

Only reported it because the error message said to do so. :-)

Can try to create MWE if really necessary, this might involve setting up a very specific "environment".


MISS_HIT Component affected

Any from the command: mh_style --fix && mh_metric --ci && mh_lint

Your MATLAB/Octave environment

Your operating system and Python version

Traceback

Traceback (most recent call last):
  File "/home/remi/gin/Christine/olfaction_blind/derivatives/cpp_spm/code/env/lib/python3.8/site-packages/miss_hit_core/command_line.py", line 400, in ice_handler
    main_function()
  File "/home/remi/gin/Christine/olfaction_blind/derivatives/cpp_spm/code/env/lib/python3.8/site-packages/miss_hit/mh_lint.py", line 266, in main_handler
    command_line.execute(mh, options, {}, lint_backend)
  File "/home/remi/gin/Christine/olfaction_blind/derivatives/cpp_spm/code/env/lib/python3.8/site-packages/miss_hit_core/command_line.py", line 352, in execute
    work_package.create(in_test_dir,
  File "/home/remi/gin/Christine/olfaction_blind/derivatives/cpp_spm/code/env/lib/python3.8/site-packages/miss_hit_core/work_package.py", line 182, in create
    return MATLAB_File_WP(in_test_dir, filename, default_encoding,
  File "/home/remi/gin/Christine/olfaction_blind/derivatives/cpp_spm/code/env/lib/python3.8/site-packages/miss_hit_core/work_package.py", line 96, in __init__
    self.cfg = cfg_tree.get_config(self.filename)
  File "/home/remi/gin/Christine/olfaction_blind/derivatives/cpp_spm/code/env/lib/python3.8/site-packages/miss_hit_core/cfg_tree.py", line 342, in get_config
    raise ICE("%s does not exist" % filename)
miss_hit_core.errors.ICE
----------------------------------------------------------------------
- Encountered an internal compiler error. This is a tool
- bug, please report it on our github issues so we can fix it:
-
-    https://github.com/florianschanda/miss_hit/issues
-
- Please include the above backtrace in your bug report, and
- the following information:
-
- MISS_HIT version: 0.9.29
-
- outputs/derivatives/cpp_spm-modelSelection/jobs/olfidolfloc/sub-
- blnd01/batch_specify_ffx_task-olfidolfloc_space-
- MNI152NLin2009cAsym_FWHM-6_2022-01-25T22-25.m does not exist
----------------------------------------------------------------------

The problematic file is a broken symlink (an expected broken symlink as it is a file version controled with git annex and datalad):

ls -l outputs/derivatives/cpp_spm-modelSelection/jobs/olfidolfloc/sub-blnd01/batch_specify_ffx_task-olfidolfloc_space-MNI152NLin2009cAsym_FWHM-6_2022-01-25T22-25.m 

lrwxrwxrwx 1 remi remi 131 Jan 25 22:25 outputs/derivatives/cpp_spm-modelSelection/jobs/olfidolfloc/sub-blnd01/batch_specify_ffx_task-olfidolfloc_space-MNI152NLin2009cAsym_FWHM-6_2022-01-25T22-25.m -> ../../../.git/annex/objects/wP/VV/MD5E-s274164--79018b61acaf721465152a7696ed06c5.m/MD5E-s274164--79018b61acaf721465152a7696ed06c5.m

Funny thing is that running any of the command in the alias I use gives me more or less this:

mh_style --fix outputs/derivatives/cpp_spm-modelSelection/jobs/olfidolfloc/sub-blnd01/batch_specify_ffx_task-olfidolfloc_space-MNI152NLin2009cAsym_FWHM-6_2022-01-25T22-25.m

usage: mh_style [-h] [-v] [--include-version] [--entry-point ENTRY_POINT_NAME] [--single] [--ignore-config]
                [--input-encoding INPUT_ENCODING] [--ignore-pragmas] [--ignore-justifications-with-tickets] [--brief] [--octave]
                [--debug-show-path] [--fix] [--process-slx] [--html HTML] [--json JSON] [--no-style] [--debug-dump-tree FILE]
                [--debug-validate-links] [--file_length N] [--line_length N] [--tab_width N] [--copyright-entity STR [STR ...]]
                [FILE|DIR [FILE|DIR ...]]

mh_style: error: outputs/derivatives/cpp_spm-modelSelection/jobs/olfidolfloc/sub-blnd01/batch_specify_ffx_task-olfidolfloc_space-MNI152NLin2009cAsym_FWHM-6_2022-01-25T22-25.m is neither a file nor directory

Getting the actual file to fix the broken link changes the behavior a a bit:

datalad get outputs/derivatives/cpp_spm-modelSelection/jobs/olfidolfloc/sub-blnd01/batch_specify_ffx_task-olfidolfloc_space-MNI152NLin2009cAsym_FWHM-6_2022-01-25T22-25.m 

mh_style will work as expected

mh_style  outputs/derivatives/cpp_spm-modelSelection/jobs/olfidolfloc/sub-blnd01/batch_specify_ffx_task-olfidolfloc_space-MNI152NLin2009cAsym_FWHM-6_2022-01-25T22-25.m

...

MISS_HIT Style Summary: 1 file(s) analysed, 1118 style issue(s)

mh_style wiht --fix will work as expected too (it is meant to give an error because those version controlled files are "write protected"

mh_style --fix  outputs/derivatives/cpp_spm-modelSelection/jobs/olfidolfloc/sub-blnd01/batch_specify_ffx_task-olfidolfloc_space-MNI152NLin2009cAsym_FWHM-6_2022-01-25T22-25.m
...

PermissionError: [Errno 13] Permission denied: 'outputs/derivatives/cpp_spm-modelSelection/jobs/olfidolfloc/sub-blnd01/batch_specify_ffx_task-olfidolfloc_space-MNI152NLin2009cAsym_FWHM-6_2022-01-25T22-25.m'

Unlocking the file to lift the write protection let's --fix do its job

datalad unlock  outputs/derivatives/cpp_spm-modelSelection/jobs/olfidolfloc/sub-blnd01/batch_specify_ffx_task-olfidolfloc_space-MNI152NLin2009cAsym_FWHM-6_2022-01-25T22-25.m

...

mh_style --fix  outputs/derivatives/cpp_spm-modelSelection/jobs/olfidolfloc/sub-blnd01/batch_specify_ffx_task-olfidolfloc_space-MNI152NLin2009cAsym_FWHM-6_2022-01-25T22-25.m

...

MISS_HIT Style Summary: 1 file(s) analysed, 1114 style issue(s)
florianschanda commented 2 years ago

Excellent, you're the first public user to trigger an ICE, well done :)

It's trivial to reproduce, just have a broken symlink and call mh_style . I will have it fixed in the next release.

Remi-Gau commented 2 years ago

Excellent, you're the first public user to trigger an ICE, well done :)

Do I get a special price? :-)

I will have it fixed in the next release.

You're awesome!

florianschanda commented 2 years ago

Sure, you get a really quick fix. :) So I fixed it by ignoring broken symlinks when they are swept up in the inputs via a directory like that. When you specifically ask on the command-line you get an error.