Hi Richard

In this mail, I would like to summarize the solutions of Ubuntu and Fedora for 
this issue.

Fedora : Put defaults.vim file in RDepends vim-data.
https://src.fedoraproject.org/fork/vondruch/rpms/vim/blob/f40/f/vim.spec

Ubuntu: Make a patch to skip "source_defaults" error.
https://archive.ubuntu.com/ubuntu/pool/main/v/vim/vim_8.2.3995-1ubuntu2.30.debian.tar.xz
Patch file: 
patches/debian/Support-sourcing-a-vimrc.tiny-when-Vim-is-invoked-as-vi.patch
Modify file: vim-8.2.3995/src/main.c

The  "parmp->vi_mode" is TRUE, so the "emsg(e_failed_to_source_defaults);" will 
be skipped.

3197 #ifdef USR_EXRC_FILE2
3198                 && do_source((char_u *)USR_EXRC_FILE2, FALSE,
3199                                                        DOSO_NONE, NULL) == 
FAIL
3200 #endif
3201 #if defined(SYS_TINYRC_FILE) && defined(TINY_VIMRC)
3202                 && !parmp->vi_mode
3203 #endif
3204                 && !has_dash_c_arg)
3205             {
3206                 // When no .vimrc file was found: source defaults.vim.
3207                 if (do_source((char_u *)VIM_DEFAULTS_FILE, FALSE, 
DOSO_NONE,
3208                                                                  NULL) == 
FAIL)
3209                     emsg(e_failed_to_source_defaults);
3210             }
3211         }


I think the Fedora's solution slightly simpler and easier to maintain, while 
Ubuntu's solution may require further maintaining for this special patch.

What do you think about it?

Zheng

________________________________
From: [email protected] 
<[email protected]> on behalf of zhengruoqin via 
lists.openembedded.org <[email protected]>
Sent: Tuesday, June 2, 2026 14:25
To: Richard Purdie <[email protected]>; 
[email protected] 
<[email protected]>
Subject: Re: [OE-core][PATCH] vim-tiny: bugfix lack of defaults.vim

Hi Richard
   I also refer the solution of fedora
  https://src.fedoraproject.org/fork/vondruch/rpms/vim/blob/f40/f/vim.spec

  1.
Vim-minimal(vim-tiny) depends on vim-data.


        2.vim-data provides defaults.vim file

Zheng

________________________________
From: Zheng, Ruoqin/郑 若钦 <[email protected]>
Sent: Tuesday, June 2, 2026 9:54
To: Richard Purdie <[email protected]>; 
[email protected] 
<[email protected]>
Subject: Re: [OE-core][PATCH] vim-tiny: bugfix lack of defaults.vim

Hi Richard
   I also refer the solution of ubuntu

  1. In ubuntu, vim.tiny depends on vim-common
https://packages.ubuntu.com/en/noble/vim-tiny

2. In vim-common, it includes vimrc needed by vim.tiny.
https://packages.ubuntu.com/en/noble/all/vim-common/filelist

 3. Discussion about this issue of ubuntu
   https://lists.snapcraft.io/archives/foundations-bugs/2022-April/472830.html

 So I think add vim-common as RDEPENDS of  vim.tiny is also a reasonable 
solution.

Zheng

________________________________
From: [email protected] 
<[email protected]> on behalf of zhengruoqin via 
lists.openembedded.org <[email protected]>
Sent: Monday, June 1, 2026 10:04
To: Richard Purdie <[email protected]>; 
[email protected] 
<[email protected]>
Subject: Re: [OE-core][PATCH] vim-tiny: bugfix lack of defaults.vim

Hi Richard

   To fix this issue, I also have another method. To touch empty .vimrc to 
avoid "Failed to source defaults.vim" error

   And the patch will like this
diff --git a/meta/recipes-support/vim/vim-tiny_9.2.bb 
b/meta/recipes-support/vim/vim-tiny_9.2.bb
index e4c26d23f6..33cc481271 100644
--- a/meta/recipes-support/vim/vim-tiny_9.2.bb
+++ b/meta/recipes-support/vim/vim-tiny_9.2.bb
@@ -6,6 +6,15 @@ PACKAGECONFIG += "tiny"

 do_install() {
     install -D -m 0755 ${S}/src/vim ${D}/${bindir}/vim.tiny
+
+    # Add ".vimrc" file to avoid "Failed to source defaults.vim" error
+    # For root user
+    touch ${D}/root/.vimrc
+
+    # For non-root user
+    install -d ${D}/etc/skel
+    touch ${D}/etc/skel/.vimrc
+
 }

Is this method OK?

Zheng

________________________________
From: Richard Purdie <[email protected]>
Sent: Monday, June 1, 2026 1:26
To: Zheng, Ruoqin/郑 若钦 <[email protected]>; 
[email protected] 
<[email protected]>
Subject: Re: [OE-core][PATCH] vim-tiny: bugfix lack of defaults.vim

On Thu, 2026-05-28 at 10:06 +0800, zhengruoqin via lists.openembedded.org wrote:
> When vim-tiny was used in image, it lacks defaults.vim file which will cause 
> following error
> root@qemux86-64:~# vi
> E1187: Failed to source defaults.vim
> Press ENTER or type command to continue
>
> So add vim-common as RDEPENDS to provide defaults.vim file to fix this issue.
>
> Signed-off-by: Zheng Ruoqin <[email protected]>
> ---
>  meta/recipes-support/vim/vim-tiny_9.2.bb | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/meta/recipes-support/vim/vim-tiny_9.2.bb 
> b/meta/recipes-support/vim/vim-tiny_9.2.bb
> index e4c26d23f6..b6ddded381 100644
> --- a/meta/recipes-support/vim/vim-tiny_9.2.bb
> +++ b/meta/recipes-support/vim/vim-tiny_9.2.bb
> @@ -8,5 +8,7 @@ do_install() {
>      install -D -m 0755 ${S}/src/vim ${D}/${bindir}/vim.tiny
>  }
>
> +RDEPENDS:${PN} += "vim-common"
> +
>  ALTERNATIVE_PRIORITY = "90"
>  ALTERNATIVE_TARGET = "${bindir}/vim.tiny"

Doesn't adding dependencies like this defeat the point of vim-tiny in the first 
place?

Can we configure that out instead?

Cheers,

Richard
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#238009): 
https://lists.openembedded.org/g/openembedded-core/message/238009
Mute This Topic: https://lists.openembedded.org/mt/119524274/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to