Bug 1969936 - Failed to source defaults.vim
Summary: Failed to source defaults.vim
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: vim
Version: 34
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Karsten
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1970721 (view as bug list)
Depends On: 1970330
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-06-09 13:43 UTC by cagney
Modified: 2022-07-11 08:26 UTC (History)
7 users (show)

Fixed In Version: vim-8.2.2956-2.fc34 vim-8.2.2956-2.fc33
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-06-16 01:03:59 UTC
Type: Bug


Attachments (Terms of Use)

Description cagney 2021-06-09 13:43:24 UTC
Description of problem:

$ vi /tmp/x
E1187: Failed to source defaults.vim
Press ENTER or type command to continue
$ ls -d ~/.vi*
ls: cannot access '/home/cagney/.vi*': No such file or directory
$ printenv | grep VI
$ printenv | grep -e VI -e EDITOR

Version-Release number of selected component (if applicable):

$ rpm -qif /usr/bin/vi
Name        : vim-minimal
Epoch       : 2
Version     : 8.2.2932
Release     : 1.fc34
Architecture: x86_64
Install Date: Mon 07 Jun 2021 10:19:03 AM

How reproducible:

110%, extra 10% for annoyance level

Workaround:

$ sudo dnf install vim-minimal-2:8.2.2637-1.fc34
$ vi /tmp/x
... everything back to normal ...

Comment 1 Markus Teuber 2021-06-10 05:52:43 UTC
Hi,

for me it works until Version 8.2.2879-1.fc34.

Version 8.2.2932-1.fc34 got this bug for me, too.

Comment 2 Markus Teuber 2021-06-10 05:54:49 UTC
I see that the most recent Version (8.2.2956-1.fc34) throws this error too.

Comment 3 Zdenek Dohnal 2021-06-10 06:03:09 UTC
Hi cagney and Markus,

thank you for reporting the issue!

Actually I found out two issues:

1) vi generates the error you reported - it is because upstream added this error once defaults.vim isn't loaded (patchlevel 2905), which isn't by design in case vi, because defaults.vim is shipped only in vim-common, which is dependency of vim-enhanced.

2) /etc/virc isn't loaded at all in case of 'vi'


I'll look into this issue further.

Comment 4 Zdenek Dohnal 2021-06-10 06:04:52 UTC
FYI the error is harmless, but annoying - you get into 'vi' after you press any key.

Comment 5 Zdenek Dohnal 2021-06-10 07:32:13 UTC
Actually, I take back the 2) - /etc/virc is read by:

3162		(void)do_source((char_u *)SYS_VIMRC_FILE, FALSE, DOSO_NONE, NULL);

The error is reported by this part of code:

3169         /*
3170          * Try to read initialization commands from the following places:
3171          * - environment variable VIMINIT
3172          * - user vimrc file (s:.vimrc for Amiga, ~/.vimrc otherwise)
3173          * - second user vimrc file ($VIM/.vimrc for Dos)
3174          * - environment variable EXINIT
3175          * - user exrc file (s:.exrc for Amiga, ~/.exrc otherwise)
3176          * - second user exrc file ($VIM/.exrc for Dos)
3177          * The first that exists is used, the rest is ignored.
3178          */
3179         if (process_env((char_u *)"VIMINIT", TRUE) != OK)
3180         {
3181             if (do_source((char_u *)USR_VIMRC_FILE, TRUE,
3182                                                       DOSO_VIMRC, NULL) == FAIL
.
.
.
3202                 && !has_dash_c_arg)
3203             {
3204                 // When no .vimrc file was found: source defaults.vim.
3205                 if (do_source((char_u *)VIM_DEFAULTS_FILE, FALSE, DOSO_NONE,
3206                                                                  NULL) == FAIL)
3207                     emsg(e_failed_to_source_defaults);
3208             }

which means defaults.vim is tried to be loaded if there is no user's .vimrc/.exrc files.

But the same error happens once you call 'vi --clean'.

I'll try to ship defaults.vim with vim-minimal too - I will need to change Conflicts between vim-common and vim-minimal again.

Comment 6 Zdenek Dohnal 2021-06-10 08:50:35 UTC
If anyone wants to turn off defaults.vim for vim-minimal, you can add:

let skip_defaults_vim = 1

into /etc/virc or into your personal ~/.virc.

Comment 7 Zdenek Dohnal 2021-06-10 09:26:17 UTC
Sorry, the rebuild is blocked in rawhide. Vim started to fail with new Python3.10.

I'll look into that too - reported here https://bugzilla.redhat.com/show_bug.cgi?id=1970330 .

Comment 8 Zdenek Dohnal 2021-06-10 11:52:00 UTC
Pushed into rawhide for now, thought building it blocked - so the correct status is MODIFIED.

Comment 9 Zdenek Dohnal 2021-06-11 04:46:12 UTC
*** Bug 1970721 has been marked as a duplicate of this bug. ***

Comment 10 Fedora Update System 2021-06-14 14:16:58 UTC
FEDORA-2021-e31e9c85c7 has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2021-e31e9c85c7

Comment 11 Fedora Update System 2021-06-14 14:32:47 UTC
FEDORA-2021-9aac6c044c has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2021-9aac6c044c

Comment 12 Markus Teuber 2021-06-14 19:11:50 UTC
It works now. I am deeply impressed how friendly and fast you did this. Thanks a lot.

Comment 13 Fedora Update System 2021-06-15 01:08:38 UTC
FEDORA-2021-e31e9c85c7 has been pushed to the Fedora 34 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-e31e9c85c7`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-e31e9c85c7

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 14 Fedora Update System 2021-06-15 01:53:45 UTC
FEDORA-2021-9aac6c044c has been pushed to the Fedora 33 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-9aac6c044c`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-9aac6c044c

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 15 Zdenek Dohnal 2021-06-15 04:29:06 UTC
(In reply to Markus Teuber from comment #12)
> It works now. I am deeply impressed how friendly and fast you did this.
> Thanks a lot.

No problem, you're welcome - I can just hope you didn't mean it as a sarcasm :) .

Thank you for reporting the issue!

Comment 16 Markus Teuber 2021-06-15 04:48:13 UTC
Seriously, no sarcasm.

Comment 17 Fedora Update System 2021-06-16 01:03:59 UTC
FEDORA-2021-e31e9c85c7 has been pushed to the Fedora 34 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 18 cagney 2021-06-17 17:23:18 UTC
tks

Comment 19 Fedora Update System 2021-06-23 01:13:39 UTC
FEDORA-2021-9aac6c044c has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 20 John Ruckstuhl 2022-06-30 14:06:07 UTC
Hi,
I think a workaround to use until fix bubbles down to all ...
touch ~/.exrc
In other words, if vim is able to read even an empty .exrc, then it won't complain.
If I'm misunderstanding something, pls let me know :)

Comment 21 Zdenek Dohnal 2022-07-11 08:26:23 UTC
Hi John,

the fix should be in Fedora for a year right now - do you still get the error?

I've briefly checked F36 and the error is not shown, because defaults.vim is now provided by vim-data subpackage, which contains files needed by all Vim versions (vi/vim/gvim), which solves the issue for most people.

But sure, your way works as well, although it requires user intervention, which I cannot imitate during packaging.


Note You need to log in before you can comment on or make changes to this bug.