On Fri, 2026-06-05 at 18:07 +0800, Zheng Ruoqin 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 a new patch to fix this issue.
> 
> Signed-off-by: Zheng Ruoqin <[email protected]>

Hi,

After looking at this again and having some discussion, I agree we
should take this simpler patch instead of copying the patch from Debian,
as our version of vim is not always in lock-step with Debian.

I have a couple of comments below...

> ---
>  ...e_defaults-when-Vim-is-invoked-as-vi.patch | 61 +++++++++++++++++++
>  meta/recipes-support/vim/vim.inc              |  3 +
>  2 files changed, 64 insertions(+)
>  create mode 100644 
> meta/recipes-support/vim/files/0001-skip-source_defaults-when-Vim-is-invoked-as-vi.patch
> 
> diff --git 
> a/meta/recipes-support/vim/files/0001-skip-source_defaults-when-Vim-is-invoked-as-vi.patch
>  
> b/meta/recipes-support/vim/files/0001-skip-source_defaults-when-Vim-is-invoked-as-vi.patch
> new file mode 100644
> index 0000000000..7e7bfe0a6d
> --- /dev/null
> +++ 
> b/meta/recipes-support/vim/files/0001-skip-source_defaults-when-Vim-is-invoked-as-vi.patch
> @@ -0,0 +1,61 @@
> +From 7dad45f751d4adbee480005a5546b32a97fdbfb2 Mon Sep 17 00:00:00 2001
> +From: Zheng Ruoqin <[email protected]>
> +Date: Fri, 5 Jun 2026 09:34:18 +0000
> +Subject:[PATCH] Skip sourcing defaults.vim when Vim is invoked as
> + vi
> +
> +This is used only in the vim-tiny package to skip "source_defaults" error
> + E1187: Failed to source defaults.vim
> +Press ENTER or type command to continue
> +
> +Upstream-Status: Inappropriate [oe specific]
> +
> +Signed-off-by: Zheng Ruoqin <[email protected]>
> +---
> + src/main.c    | 7 +++++++
> + src/structs.h | 4 ++++
> + 2 files changed, 11 insertions(+)
> +
> +diff --git a/src/main.c b/src/main.c
> +index d4019ff51e..685fae2a02 100644
> +--- a/src/main.c
> ++++ b/src/main.c
> +@@ -2059,6 +2059,10 @@ parse_command_name(mparm_T *parmp)
> +     }
> +     else if (STRNICMP(initstr, "vim", 3) == 0)
> +     initstr += 3;
> ++#ifdef TINY_VIMRC
> ++    else if (STRNICMP(initstr, "vi", 2) == 0)
> ++       parmp->vi_mode = TRUE;
> ++#endif

We should drop the #ifdef guards from the patch as we will only apply it
when building vim-tiny.

> + 
> +     // Catch "[r][g]vimdiff" and "[r][g]viewdiff".
> +     if (STRICMP(initstr, "diff") == 0)
> +@@ -3426,6 +3430,9 @@ source_startup_scripts(mparm_T *parmp)
> + # ifdef USR_EXRC_FILE2
> +             && do_source((char_u *)USR_EXRC_FILE2, FALSE,
> +                                                    DOSO_NONE, NULL) == FAIL
> ++#endif
> ++#if defined(TINY_VIMRC)
> ++                && !parmp->vi_mode
> + # endif
> +             && !has_dash_c_arg)
> +         {
> +diff --git a/src/structs.h b/src/structs.h
> +index 955b9f1001..09a0f7f7a8 100644
> +--- a/src/structs.h
> ++++ b/src/structs.h
> +@@ -4874,6 +4874,10 @@ typedef struct
> + #ifdef FEAT_DIFF
> +     int             diff_mode;              // start with 'diff' set
> + #endif
> ++#ifdef TINY_VIMRC
> ++    int         vi_mode;                /* started as "vi" */
> ++#endif
> ++
> + } mparm_T;
> + 
> + /*
> +-- 
> +2.43.0
> +
> diff --git a/meta/recipes-support/vim/vim.inc 
> b/meta/recipes-support/vim/vim.inc
> index b00b2602ed..1af8a1d6a1 100644
> --- a/meta/recipes-support/vim/vim.inc
> +++ b/meta/recipes-support/vim/vim.inc
> @@ -16,6 +16,7 @@ SRC_URI = 
> "git://github.com/vim/vim.git;branch=master;protocol=https;tag=v${PV}
>             file://disable_acl_header_check.patch \
>             file://0001-src-Makefile-improve-reproducibility.patch \
>             file://no-path-adjust.patch \
> +           ${@bb.utils.contains('PACKAGECONFIG', 'tiny', 
> 'file://0001-skip-source_defaults-when-Vim-is-invoked-as-vi.patch', '', d)} \

Conditional entries in SRC_URI are unfortunate as they make things less
predictable. In this case we have a separate vim-tiny recipe, so we can
add in vim-tiny_9.2.bb:

    SRC_URI += 
"file://0001-skip-source_defaults-when-Vim-is-invoked-as-vi.patch"

>             "
>  
>  PV .= ".0569"
> @@ -32,6 +33,8 @@ inherit autotools-brokensep update-alternatives mime-xdg 
> pkgconfig
>  
>  CLEANBROKEN = "1"
>  
> +CFLAGS:append = " ${@bb.utils.contains('PACKAGECONFIG', 'tiny', 
> '-DTINY_VIMRC', '', d)}"

We can drop this CFLAGS modification with the above changes made.

Best regards,

-- 
Paul Barker

Attachment: signature.asc
Description: This is a digitally signed message part

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

Reply via email to