Bug 157481 - ports-mgmt/portmaster test of IS_INTERACTIVE is implemented incorrectly
Summary: ports-mgmt/portmaster test of IS_INTERACTIVE is implemented incorrectly
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Doug Barton
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-01 01:10 UTC by Carl
Modified: 2011-06-08 07:12 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carl 2011-06-01 01:10:06 UTC
portmaster v3.9 includes a test for the existence of the IS_INTERACTIVE variable in each port's Makefile. If IS_INTERACTIVE is found at the beginning of any line, then it is naively assumed that IS_INTERACTIVE will always be set for the port and portmaster pauses to force the user to acknowledge that the port is interactive. This occurs even if the BATCH variable is set in the environment. This simplistic manner of testing IS_INTERACTIVE is wrong because it may be getting conditionally set or cleared in the port's Makefile. As an example, the mail/procmail port cannot be built non-interactively with portmaster for this very reason, yet its Makefile is designed specifically to support a non-interactive build.

Here is the relevant section of portmaster:

----- begin excerpt -----
3186         if [ -z "$FETCH_ONLY" -a ! "$PM_PACKAGES" = only ]; then
3187                 TESTINT=`grep -l ^IS_INTERACTIVE Makefile`
3188         else
3189                 [ -n "$ALL_FETCH" ] && safe_exit
3190         fi
3191         if [ -n "$TESTINT" ]; then
3192                 echo ''
3193                 echo "===>>> Warning: $portdir is interactive, and will likely"
3194                 echo "       require attention during the build"
3195                 echo ''
3196                 echo -n "===>>> Press the [Enter] or [Return] key to continue "
3197                 read DISCARD
3198                 echo ''
3199                 unset TESTINT DISCARD
3200         fi
------ end excerpt ------

The following excerpt from /usr/ports/mail/procmail/Makefile demonstrates why portmaster is wrong to naively check for a reference to IS_INTERACTIVE:

----- begin excerpt -----
36 # It asks for list of directories to do test for file locking
37 # (defaults to /tmp and ".", so return should suffice in most cases).
38 .if defined(BATCH) # handled in patch-aa
39 MAKE_ARGS+=     -DBATCH
40 .else
41 IS_INTERACTIVE= yes
42 .endif
------ end excerpt ------

As that code shows, setting BATCH for a portmaster build of mail/procmail will prevent IS_INTERACTIVE from being set, yet portmaster will still wrongly conclude that it is set.

Carl                                           / K0802647

Fix: 

My current workaround is simply to excise the IS_INTERACTIVE test from portmaster entirely. Assuming there is a good reason for wanting to test for interactivity in the first place, IS_INTERACTIVE should actually be tested to see if it really is set rather than merely checking to see if it's referenced in Makefi
How-To-Repeat: Set the BATCH variable for the build environment and try to build mail/procmail using portmaster.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2011-06-01 02:19:15 UTC
Responsible Changed
From-To: freebsd-ports-bugs->dougb

Fix synopsis and assign.
Comment 2 Doug Barton freebsd_committer freebsd_triage 2011-06-01 02:35:24 UTC
State Changed
From-To: open->patched


Thanks for your bug report. This is patched in svn version r222553,
Comment 3 dfilter service freebsd_committer freebsd_triage 2011-06-08 07:08:45 UTC
dougb       2011-06-08 06:08:36 UTC

  FreeBSD ports repository

  Modified files:
    ports-mgmt/portmaster Makefile distinfo 
  Log:
  Update to 3.9.1, a minor bugfix version:
  
  In shuffling around the updating of +REQUIRED_BY I forgot to delete
  empty grep_deps files. [1]
  
  While I'm looking at unlink'ing files, bring some sanity to the various
  places that it's done which haven't been reviewed in a while:
  * Fix the pm_unlink* functions to use the builtin test
  * Only/always call the function when we're not sure if the file exists
  * Just use /bin/unlink when we're sure it does
  * In parent_exit the glob pattern in the for loop will return 'pattern-*'
    if there are no matches, so test for that specifically rather than
    returning to the conditional version.
  
  The mere presence of IS_INTERACTIVE in the Makefile is not enough, the
  condition needs to be verified in case it is conditional [2]
  
  We want to make sure that $TMPDIR exists before trying to use it. The
  cheapest way to do this is to just call mkdir -p. Move the umask call
  before this to be safe.
  
  Split the test for the existence of /usr/X11R6 and whether or not it's
  a link for one more micro-optimization.
  
  Submitted by:   olgeni [1]
  
  PR:             ports/157481 [2]
  Submitted by:   Carl <k0802647@telus.net> [2]
  
  Revision  Changes    Path
  2.45      +1 -1      ports/ports-mgmt/portmaster/Makefile
  2.12      +4 -4      ports/ports-mgmt/portmaster/distinfo
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 4 Doug Barton freebsd_committer freebsd_triage 2011-06-08 07:11:22 UTC
State Changed
From-To: patched->closed


Committed in ports version 3.9.1