Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 922614

Summary: vim-doc.eclass: Installs wrong symlinks when run with ROOT
Product: Gentoo Linux Reporter: Esteve Varela Colominas <esteve.varela>
Component: EclassesAssignee: Vim Maintainers <vim>
Status: UNCONFIRMED ---    
Severity: normal CC: esteve.varela, jstein
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Esteve Varela Colominas 2024-01-21 12:53:57 UTC
When one runs something along the lines of:
    ROOT=/var/tmp/newroot emerge -n app-vim/gentoo-syntax

The following symlink is created:
    $ ls -l /var/tmp/newroot/usr/share/vim/vim90/doc/gentoo-syntax.txt
    lrwxrwxrwx 1 root root 66 Jan 17 22:25 /var/tmp/newroot/usr/share/vim/vim90/doc/gentoo-syntax.txt -> /var/tmp/newroot/usr/share/vim/vimfiles/doc/gentoo-syntax.txt

Of course, when chrooted, this doesn't work, and the file is treated as non-existing.
More annoyingly, however, any rebuild of a package that includes vim-doc.eclass is hit by the following error:

ln: failed to create symbolic link '/usr/share/vim/vim90/doc/eselect-syntax.txt': File exists                                                                                              
 * ERROR: app-vim/gentoo-syntax-11::gentoo failed (postinst phase):                                                                                                                        
 *   (no error message)                                                                                                                                                                    
 *                                                                                                                                                                                         
 * Call stack:                                                                                                                                                                             
 *     ebuild.sh, line 136:  Called pkg_postinst                                                                                                                                           
 *   environment, line 547:  Called vim-plugin_pkg_postinst                                                                                                                                
 *   environment, line 721:  Called update_vim_helptags
 *   environment, line 647:  Called die
 * The specific snippet of code:
 *                       ln -s "${helpfile}" "${d}/doc" || die;
 * 
 * If you need support, post the output of `emerge --info '=app-vim/gentoo-syntax-11::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=app-vim/gentoo-syntax-11::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/app-vim/gentoo-syntax-11/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/app-vim/gentoo-syntax-11/temp/environment'.
 * Working directory: '/var/tmp/portage/app-vim/gentoo-syntax-11/empty'
 * S: '/var/tmp/portage/app-vim/gentoo-syntax-11/work/gentoo-syntax-11'
 * FAILED postinst: 1


What needs to happen is twofold:

1. Run `ln` with the `-f` parameter, or otherwise check if a link exists to a non-existing file to warn about before erroring out

2. The link should target a file that exists under the ROOT. Either by replacing the ln line with `ln -s "/usr/share/vim/vimfiles/$(basename "${helpfile}")"` or creating a relative symlink (probably better, anyway).
Comment 1 Esteve Varela Colominas 2024-01-21 12:57:37 UTC
To expand on "1.", I think that while existing links may be better left alone, links pointing to nonexisting files may be replaced automatically, while reporting them with `ewarn`.