comparison src/vim9compile.c @ 29828:6b7020f3d856 v9.0.0253

patch 9.0.0253: a symlink to an autoload script results in two entries Commit: https://github.com/vim/vim/commit/753885b6c5b9021184daa94d32fd8bf025f1b488 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Aug 24 16:30:36 2022 +0100 patch 9.0.0253: a symlink to an autoload script results in two entries Problem: A symlink to an autoload script results in two entries in the list of scripts, items expected in one are actually in the other. Solution: Have one script item refer to the actually sourced one. (closes #10960)
author Bram Moolenaar <Bram@vim.org>
date Wed, 24 Aug 2022 17:45:03 +0200
parents e0259a817d82
children d269dd3cd31d
comparison
equal deleted inserted replaced
29827:db296237ca1d 29828:6b7020f3d856
608 return NULL; 608 return NULL;
609 609
610 ret = find_imported_in_script(name, len, current_sctx.sc_sid); 610 ret = find_imported_in_script(name, len, current_sctx.sc_sid);
611 if (ret != NULL && load && (ret->imp_flags & IMP_FLAGS_AUTOLOAD)) 611 if (ret != NULL && load && (ret->imp_flags & IMP_FLAGS_AUTOLOAD))
612 { 612 {
613 scid_T dummy; 613 scid_T actual_sid = 0;
614 int save_emsg_off = emsg_off; 614 int save_emsg_off = emsg_off;
615 615
616 // "emsg_off" will be set when evaluating an expression silently, but 616 // "emsg_off" will be set when evaluating an expression silently, but
617 // we do want to know about errors in a script. Also because it then 617 // we do want to know about errors in a script. Also because it then
618 // aborts when an error is encountered. 618 // aborts when an error is encountered.
619 emsg_off = FALSE; 619 emsg_off = FALSE;
620 620
621 // script found before but not loaded yet 621 // script found before but not loaded yet
622 ret->imp_flags &= ~IMP_FLAGS_AUTOLOAD; 622 ret->imp_flags &= ~IMP_FLAGS_AUTOLOAD;
623 (void)do_source(SCRIPT_ITEM(ret->imp_sid)->sn_name, FALSE, 623 (void)do_source(SCRIPT_ITEM(ret->imp_sid)->sn_name, FALSE,
624 DOSO_NONE, &dummy); 624 DOSO_NONE, &actual_sid);
625 // If the script is a symlink it may be sourced with another name, may
626 // need to adjust the script ID for that.
627 if (actual_sid != 0)
628 ret->imp_sid = actual_sid;
625 629
626 emsg_off = save_emsg_off; 630 emsg_off = save_emsg_off;
627 } 631 }
628 return ret; 632 return ret;
629 } 633 }