Bug 208497 - less in 10.3-RELEASE in more compatibility mode cause freebsd-update to page when it shouldn't
Summary: less in 10.3-RELEASE in more compatibility mode cause freebsd-update to page ...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 10.3-RELEASE
Hardware: Any Any
: --- Affects Many People
Assignee: Xin LI
URL: http://www.greenwoodsoftware.com/less...
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-04 05:52 UTC by Derek Schrock
Modified: 2019-03-05 18:21 UTC (History)
3 users (show)

See Also:


Attachments
page the contents of a group not all of the if (1.54 KB, text/plain)
2016-04-04 06:06 UTC, Derek Schrock
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Derek Schrock 2016-04-04 05:52:44 UTC

    
Comment 1 Derek Schrock 2016-04-04 06:05:15 UTC
less's update to 481 in 10.3-RELEASE causes more compatibility more to page output when you reach EOF:

 ...
 - In more-compatible mode, change the -e option to work like -E, not -EF. 
 ...

This didn't happen in <10.3 running freebsd-update without when nothing was to be updated.

less when ran in more compatibility without -e applies as if -e was used.

freebsd-update sends all output to a $PAGER (by default - more) by piping a sh if to $PAGER:

  if
    ....
  fi | $PAGER

I don't think less should change for this (or if it's even a bug in less).

Should freebsd-update to not pipe if's contents but rather a grouped { ... ; } output inside the if block:

  ...
  # Report to the user if any updates were avoided due to local changes
  if [ -s modifiedfiles ]; then
    { echo
    echo -n "The following files are affected by updates, "
    echo "but no changes have" 
    echo -n "been downloaded because the files have been "
    echo "modified locally:"
    cat modifiedfiles; } | $PAGER
  fi
  ...

I believe that's the way PAGER is used in all of freebsd-update.
If so should the attached patch fix this?

PS: I hit return in the subject when I first reported this bug hence the empty comment.
Comment 2 Derek Schrock 2016-04-04 06:06:16 UTC
Created attachment 168951 [details]
page the contents of a group not all of the if

page the contents of a group not all of the if.  That way we only page when we have to.
Comment 3 Andriy Gapon freebsd_committer freebsd_triage 2016-04-06 20:15:32 UTC
I do not like that now "more -e" behaves like "more -E" used to. I have "-e" in $MORE for ages.
Comment 4 Xin LI freebsd_committer freebsd_triage 2016-04-06 20:43:48 UTC
(In reply to Andriy Gapon from comment #3)
Yes this was in discussion at late release cycle and I actually have a patch to address it:

Index: main.c
===================================================================
--- main.c      (revision 296979)
+++ main.c      (working copy)
@@ -57,6 +57,7 @@ static char consoleTitle[256];
 extern int     less_is_more;
 extern int     missing_cap;
 extern int     know_dumb;
+extern int     quit_if_one_screen;
 extern int     no_init;
 extern int     pr_type;

@@ -166,6 +167,8 @@ main(argc, argv)

        if (less_is_more)
                no_init = TRUE;
+       if (less_is_more)
+               quit_if_one_screen = TRUE;

 #if EDITOR
        editor = lgetenv("VISUAL");

The author have indicated that it was intentional and cited it was a POSIX behavior (http://www.unix.com/man-page/posix/1p/more/) which I haven't investigated further yet (OpenBSD behavior change was their main.c,v 1.14 at http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/less/main.c).
Comment 5 commit-hook freebsd_committer freebsd_triage 2019-01-24 18:26:58 UTC
A commit references this bug:

Author: emaste
Date: Thu Jan 24 18:26:31 UTC 2019
New revision: 343407
URL: https://svnweb.freebsd.org/changeset/base/343407

Log:
  freebsd-update: open $PAGER only if necessary

  PR:		194547, 208497
  Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
  Reviewed by:	delphij
  MFC after:	1 month
  Sponsored by:	The FreeBSD Foundation

Changes:
  head/usr.sbin/freebsd-update/freebsd-update.sh
Comment 6 Ed Maste freebsd_committer freebsd_triage 2019-01-24 18:29:13 UTC
https://reviews.freebsd.org/D18913
Comment 7 commit-hook freebsd_committer freebsd_triage 2019-01-24 20:36:50 UTC
A commit references this bug:

Author: ngie
Date: Thu Jan 24 20:35:59 UTC 2019
New revision: 343412
URL: https://svnweb.freebsd.org/changeset/base/343412

Log:
  Fix a typo/wordsmith a description modified in r343407

  r343407 accidentally introduced a typo (folling -> following). While
  reading the change out loud, I realized that the original sentence was
  wordy. almost sounding like a run-on sentence.

  Improve the flow by splitting up the two thoughts into two distinct sentence
  fragments.

  PR:		194547, 208497
  Reviewed by:	emaste
  Approved by:	emaste (mentor)
  MFC after:	1 month
  MFC with:	r343407
  Differential Revision: https://reviews.freebsd.org/D18947

Changes:
  head/usr.sbin/freebsd-update/freebsd-update.sh
Comment 8 commit-hook freebsd_committer freebsd_triage 2019-03-05 18:20:23 UTC
A commit references this bug:

Author: emaste
Date: Tue Mar  5 18:19:27 UTC 2019
New revision: 344803
URL: https://svnweb.freebsd.org/changeset/base/344803

Log:
  MFC r343407: freebsd-update: open $PAGER only if necessary

  PR:		194547, 208497
  Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
  Reviewed by:	delphij
  Sponsored by:	The FreeBSD Foundation

Changes:
_U  stable/12/
  stable/12/usr.sbin/freebsd-update/freebsd-update.sh
Comment 9 commit-hook freebsd_committer freebsd_triage 2019-03-05 18:21:29 UTC
A commit references this bug:

Author: emaste
Date: Tue Mar  5 18:20:17 UTC 2019
New revision: 344804
URL: https://svnweb.freebsd.org/changeset/base/344804

Log:
  MFC r343407: freebsd-update: open $PAGER only if necessary

  PR:		194547, 208497
  Submitted by:   Gerald Aryeetey <aryeeteygerald_rogers.com>
  Reviewed by:	delphij
  Sponsored by:	The FreeBSD Foundation

Changes:
_U  stable/11/
  stable/11/usr.sbin/freebsd-update/freebsd-update.sh