Skip to content

Same SID used for different script files in Docker #3353

Description

@blueyed

I've noticed that source will re-use the previous script ID in Docker.

Vader uses :source with temporary files, and inside of Docker the previous s: context is kept.

The behavior in Docker can be simulated by using the same temporary file always, but overwriting it - but I think it is better to have a new script context for every test.

It seems to be related to the following code:

vim/src/ex_cmds2.c

Lines 4475 to 4496 in 167ae42

# ifdef UNIX
stat_ok = (mch_stat((char *)fname_exp, &st) >= 0);
# endif
for (current_SID = script_items.ga_len; current_SID > 0; --current_SID)
{
si = &SCRIPT_ITEM(current_SID);
if (si->sn_name != NULL
&& (
# ifdef UNIX
/* Compare dev/ino when possible, it catches symbolic
* links. Also compare file names, the inode may change
* when the file was edited. */
((stat_ok && si->sn_dev_valid)
&& (si->sn_dev == st.st_dev
&& si->sn_ino == st.st_ino)) ||
# endif
fnamecmp(si->sn_name, fname_exp) == 0))
break;
}
if (current_SID == 0)
{
current_SID = ++last_current_SID;

I.e. if Docker would reuse inodes aggresively this would explain it, and the condition for UNIX should be using && at the end instead of || ?

I have no test case (except for Neomake's test suite) to reproduce this easily, and it might be something else then Docker therefore after all.

Any pointers would be appreciated to debug this further, since it is also not trivial to get a patched Vim inside the Docker image used for tests.

Activity

  1. blueyed commented on Aug 20, 2018

    @blueyed
    Author

    This is caused by Vader deleting the temporary file itself already, and indicates that Docker (or rather its FS) re-uses inodes (or something in this regard) more aggressively / in a different way.

  2. brammool commented on Aug 21, 2018

    @brammool
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions