Bug 273660 - ports/portmaster with -P or --packages option stops after installation of each and every port
Summary: ports/portmaster with -P or --packages option stops after installation of eac...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Stefan Eßer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-09 15:34 UTC by Vlad Markov
Modified: 2023-09-22 18:02 UTC (History)
1 user (show)

See Also:
linimon: maintainer-feedback? (se)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vlad Markov 2023-09-09 15:34:11 UTC
When using the -P or --package option to portmaster, portmaster stops after the installation of each port. Entering a CR makes it continue.

This happens because $DI_FILES is the empty string at this point so "head" expects input from stdin.

I made the following change locally which fixed the issue to my satisfaction.

diff -u /usr/local/sbin/portmaster pmaster/portmaster
--- /usr/local/sbin/portmaster	2023-05-31 15:30:07.762985000 -0400
+++ pmaster/portmaster	2023-09-09 11:14:36.062073000 -0400
@@ -1223,7 +1223,7 @@
 
 di_file_complete=
 pm_wait_di_file_complete () {
-	if [ -z "$di_file_complete" ] && [ `head -1 $DI_FILES` = '############' ]; then
+	if [ -z "$di_file_complete" ] && [ -n "$DI_FILES" ] && [ `head -1 $DI_FILES` = '############' ]; then
 		echo "===>>> Waiting for background read of distinfo files to finish"
 		while [ `head -1 $DI_FILES` = '############' ]; do
 			sleep 1

uname -a
FreeBSD happy 13.2-RELEASE-p3 FreeBSD 13.2-RELEASE-p3 GENERIC amd64

pkg info portmaster
portmaster-3.26
Comment 1 Stefan Eßer freebsd_committer freebsd_triage 2023-09-22 18:02:30 UTC
Thank you for reporting and diagnosing this issue.

This case can only happen (AFAIK) when all updates can be performed using existing packages. If no ports need to be built, then $DI_FILES may be empty and the reported issue occurs.

The suggested patch has been applied to the portmaster repository, and the port update to version 3.27 will be committed next.
Comment 2 commit-hook freebsd_committer freebsd_triage 2023-09-22 18:02:47 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=a7ed2d6d98970d9415bd5eafbfa7addf3f25277c

commit a7ed2d6d98970d9415bd5eafbfa7addf3f25277c
Author:     Stefan Eßer <se@FreeBSD.org>
AuthorDate: 2023-09-22 17:55:43 +0000
Commit:     Stefan Eßer <se@FreeBSD.org>
CommitDate: 2023-09-22 17:58:38 +0000

    ports-mgmt/portmaster: Fix issue when updating from packages only

    When using the -P or --package option to portmaster and all updates
    can be performed without building at least one port, the $DI_FILES
    variable may be unset.

    In this situation portmaster stops after the installation of each
    port. Entering a CR makes it continue.

    This was reported by Vlad Markov with a suggested fix that has been
    applied (with a white-space change).

    PR:             273660
    Reported by:    dvoich@aim.com (Vlad Markov)

 ports-mgmt/portmaster/Makefile | 2 +-
 ports-mgmt/portmaster/distinfo | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)