Bug 245460

Summary: editors/vim: Makefile incomplete and missing eview
Product: Ports & Packages Reporter: Andy Mender <andymenderunix>
Component: Individual Port(s)Assignee: Adam Weinberger <adamw>
Status: Closed FIXED    
Severity: Affects Only Me CC: obrien
Priority: --- Flags: bugzilla: maintainer-feedback? (adamw)
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Makefile diff
none
build log
none
libcanberra switch
none
Makefile diff none

Description Andy Mender 2020-04-08 19:40:52 UTC
Created attachment 213199 [details]
Makefile diff

I tried building editors/vim version 8.2.0491 via portmaster and portlint reported that vim relies on audio/libcanberra and it's not defined in the Makefile. I find it slightly strange that even when selecting the CONSOLE UI option it requires a UI library, but it's mentioned here: https://github.com/vim/vim/issues/4531.

The attached diff fixes this and another issue with USES.

Also, the /usr/local/bin/eview binary is not created by the port, even though it's listed in the pkg-plist file.

Let me know what else should I try before submitting a more complete diff :).
Comment 1 Adam Weinberger freebsd_committer freebsd_triage 2020-04-09 16:23:30 UTC
I'm not understanding. The console-only port doesn't require libcanberra at all. Portlint doesn't check for that sort of thing at all, so I'm not sure in what context you got that message. eview is only listed in the plist if you selected a GUI library.

It sounds to me like you have something other than "CONSOLE" selected for your GUI library. I'd need a full build log, output of 'make showconfig', and the output of 'portlint -C' to understand where the problems are coming from.
Comment 2 Andy Mender 2020-04-09 19:01:25 UTC
Created attachment 213227 [details]
build log

Output of portlint -C:
WARN: Makefile: unless this is a master port, COMMENT has to be set by "=", not by "?=".
WARN: Makefile: "USES" has to appear earlier.
WARN: .Makefile.swp: dotfiles are not preferred. If this file is a dotfile to be installed as an example, consider importing it as "dot.Makefile.swp".
0 fatal errors and 3 warnings found.

Output of make showconfig:
===> The following configuration options are available for vim-8.2.0491:
     CSCOPE=on: cscope support
     DEFAULT_VIMRC=on: Install bundled vimrc as default setting
     MAKE_JOBS=on: Enable parallel build
     NLS=off: Native Language Support
     XTERM_SAVE=on: Restore xterm screen after exit
====> Optional language bindings
     LUA=off: Lua scripting language support
     PERL=on: Perl scripting language support
     PYTHON=on: Python bindings or support
     RUBY=on: Ruby bindings or support
     SCHEME=off: MzScheme (Racket) bindings
     TCL=off: Tcl scripting language support
====> Options available for the single CTAGS: you have to select exactly one of them
     CTAGS_BASE=on: Use system ctags
     CTAGS_EXUBERANT=off: Use exctags instead of ctags
     CTAGS_UNIVERSAL=off: Use uctags instead of ctags
====> User interface: you have to select exactly one of them
     ATHENA=off: Athena GUI toolkit
     CONSOLE=on: Console/terminal mode
     GNOME=off: GNOME desktop environment support
     GTK2=off: GTK+ 2 GUI toolkit support
     GTK3=off: GTK+ 3 GUI toolkit support
     MOTIF=off: Motif widget library support
     X11=off: X11 (graphics) support
===> Use 'make config' to modify these settings

I attached the build log as a file, since the output is much longer.
Comment 3 Adam Weinberger freebsd_committer freebsd_triage 2020-04-10 01:10:33 UTC
Thanks for the logs, Andy.

Vim definitely shouldn’t be linking to libcanberra without an appropriate GUI build. Ports with home-built (i.e. non-autotools, non-cmake) configure scripts are highly susceptible to environment poisoning, picking up dependencies where it shouldn’t. It also makes these sorts of errors hard to catch until they manifest in the wild, so I’m glad you reported it!
Comment 4 Andy Mender 2020-04-10 13:08:31 UTC
(In reply to Adam Weinberger from comment #3)
You're very welcome and I'm glad I could help :). Since I turned the developer mode ON in my make.conf file, I pay more attention to build logs.

If you'd like me to, I can investigate this issue further and submit a proper patch/diff for the Makefile (and possibly the pkg-plist file?).
Comment 5 Adam Weinberger freebsd_committer freebsd_triage 2020-04-10 16:47:34 UTC
Created attachment 213250 [details]
libcanberra switch

Try the attached patch. It should fix the libcanberra issue.

I don't see the eview issue you reported, nor can I replicate it. eview gets created during the build, but is specifically excluded in the plist for console-only builds.
Comment 6 Andy Mender 2020-04-12 08:47:22 UTC
Created attachment 213320 [details]
Makefile diff

I applied your patch and tried a CONSOLE build, but at the end of the build make still complains:
====> Compressing man pages (compress-man)
====> Running Q/A tests (stage-qa)
Warning: you need USES=desktop-file-utils
Notice: Please install sysutils/rubygem-bundler for additional Gemfile-checks
Warning: Possible REINPLACE_CMD issues
sed failed: file content unchanged from backup: src/auto/config.h

I attached another diff which adds the missing USES entry.
Comment 7 Adam Weinberger freebsd_committer freebsd_triage 2020-04-12 14:56:41 UTC
No, those messages are harmless and the lack of desktop-file-utils is intentional.
Comment 8 Andy Mender 2020-04-12 15:55:29 UTC
(In reply to Adam Weinberger from comment #7)
I see. Apologies for the confusion then and thank you again for helping me address this issue :).

The bug report can be closed.
Comment 9 commit-hook freebsd_committer freebsd_triage 2020-04-12 16:11:28 UTC
A commit references this bug:

Author: adamw
Date: Sun Apr 12 16:10:59 UTC 2020
New revision: 531528
URL: https://svnweb.freebsd.org/changeset/ports/531528

Log:
  vim: Fix environment contamination from libcanberra

  Vim will link against libcanberra if it's present, leading to an
  undeclared link and breakage risk if canberra is removed. It only really
  makes sense for it to do this during a gnome build, so explicitly
  enable it there and disable it elsewhere.

  PR:		245460
  Reported by:	Andy Mender
  MFH:		2020Q2

Changes:
  head/editors/vim/Makefile
Comment 10 commit-hook freebsd_committer freebsd_triage 2020-04-12 16:12:29 UTC
A commit references this bug:

Author: adamw
Date: Sun Apr 12 16:12:07 UTC 2020
New revision: 531529
URL: https://svnweb.freebsd.org/changeset/ports/531529

Log:
  MFH: r531528
  Approved by:	portmgr (with hat)

  vim: Fix environment contamination from libcanberra

  Vim will link against libcanberra if it's present, leading to an
  undeclared link and breakage risk if canberra is removed. It only really
  makes sense for it to do this during a gnome build, so explicitly
  enable it there and disable it elsewhere.

  PR:		245460
  Reported by:	Andy Mender

Changes:
_U  branches/2020Q2/
  branches/2020Q2/editors/vim/Makefile
Comment 11 Adam Weinberger freebsd_committer freebsd_triage 2020-04-12 16:20:12 UTC
No, I'm glad you reported this! First of all, that libcanberra issue definitely needed to be fixed, and there was no way I was ever going to stumble upon that dependency problem myself.

Regarding desktop-file-utils, the files get installed, but the plist comments them out for non-GTK/GNOME installs. Desktop-file-utils is utilized in the GTK2, GTK3, and GNOME builds (check out the GTK3_USES= line, for example). The QA script (which is running for you because you've set DEVELOPER=yes in your /etc/make.conf) sees the icons in the stage dir and assumes they're being installed.