code icon indicating copy to clipboard operation
code copied to clipboard

Compiling in a terminal causes "modified by external application"

Open tkarhun opened this issue 5 years ago • 2 comments

When the option 'Preferences' -> 'Behavior' -> 'Save files when changed' is not selected, compiling an opened c source file in a terminal causes a notification "<filename> was modified in an external application. Do you want to load it again or continue your editing?" to be shown. Selecting Continue will cause the notification to be shown again until Load is chosen.

If the option 'Preferences' -> 'Behavior' -> 'Save files when changed' is selected, the editor jumps to the top of the file.

The compilation command is: ../opt/mingw32ce/bin/arm-mingw32ce-gcc -x c <filename> -L <libpath> -l <lib> -mno-thumb-interwork -o <outputfile> which shouldn't modify the source file (and doesn't according to the output from ls -lortha).

Screenshot:

Screenshot from 2020-05-16 13-58-15

tkarhun avatar May 16 '20 11:05 tkarhun

Attached auditd watch log for the file. The log format is not too familiar to me, but it appears io.elementary.code is the only one changing the file. There seems to be many operations performed (create, delete, rename), some successful, some not.

audit-log.txt

tkarhun avatar May 17 '20 08:05 tkarhun

There does appear to be a flaw in the way the document is being checked for external changes I'll investigate.

jeremypw avatar Jun 18 '25 11:06 jeremypw

@tkarhun There have been substantial changes to this part of the code in the latest version and I couldn't produce unexpected behaviour with a very simple C program. I cannot exactly reproduce the conditions where you experienced the issue unfortunately.

If you are able could you confirm (or otherwise) the issue with the latest version of Code?

jeremypw avatar Jun 30 '25 16:06 jeremypw