Page MenuHomeFreeBSD

freebsd-update.sh: EDITOR: if not set, prefer ee
Needs ReviewPublic

Authored by grahamperrin on Sep 29 2022, 2:33 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Dec 10, 6:30 PM
Unknown Object (File)
Tue, Dec 3, 6:44 AM
Unknown Object (File)
Sun, Dec 1, 3:43 PM
Unknown Object (File)
Fri, Nov 29, 4:03 PM
Unknown Object (File)
Nov 24 2024, 6:11 PM
Unknown Object (File)
Nov 23 2024, 8:18 AM
Unknown Object (File)
Nov 22 2024, 5:41 AM
Unknown Object (File)
Nov 21 2024, 9:13 AM

Details

Summary

Reduce the risk of end users stumbling whilst attempting to upgrade the operating system.

Test Plan
  1. https://www.freebsd.org/where/#past
  2. download and install an end-of-life FreeBSD 13.0-RELEASE that supports binary updates
  3. use freebsd-update(8) to update, but not upgrade
  4. boot 13.0-RELEASE-p13
  5. add a user to the video group
  6. https://www.freebsd.org/releases/13.1R/installation/#upgrade-binary use freebsd-update(8) to begin an upgrade to 13.1-RELEASE
  7. when prompted, edit files
  8. check the end result.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

For those of you who have not already seen the related pull request:

As far as I can tell, the misrepresentations are a somewhat avoidable side-effect of using forks for pull requests. Postscript:

The tail of today's https://old.reddit.com/r/freebsd/comments/18gtb5r/-/:

Is there any reason why I'm forced to use vi? Talk about a ginormous headache. It isn't something that I want to learn or even know exists. This is super frustrating.

Maybe the people that did the installer/upgrade utility should ask which is the preferred editor prior to bringing up the merge conflict prompt.

I have no objection (ee would at least give user some hint about how to use it, e.g. use Esc to get a menu, etc.), but I doubt if this change would have any actual effect, because EDITOR is set to vi in .profile as well as .cshrc so the user gets vi anyway...

@delphij thanks for the context.

I probably opened this at a time when I was struggling to understand which multiple files combine to reliably avoid unwanted appearance of vi.

I forgot:

https://github.com/freebsd/freebsd-src/blob/main/bin/sh/profile

# System-wide .profile file for sh(1).

If I'm not mistaken:

  • /etc/profile does not set EDITOR

I forgot:

https://github.com/freebsd/freebsd-src/blob/main/bin/sh/profile

# System-wide .profile file for sh(1).

If I'm not mistaken:

  • /etc/profile does not set EDITOR

/etc/profile is not .profile.

On a fresh FreeBSD 14.0 test install no EDITOR is set for root. I see setenv EDITOR vi in /root/.cshrc. New user accounts will inherit EDITOR=vi via .profile from /usr/share/skel/dot.profile.

Thanks. I ran a few tests. One test result below.


12.4-RELEASE-p9 with the root user shell temporarily changed to sh(1), and with modification to one line of /usr/sbin/freebsd-update.

ttyv0, logged in as grahamperrin (a member of wheel). su - prior to freebsd-update -r 14.0-RELEASE upgrade:

12.4-RELEASE-p9, vi, su -, , freebsd-update -r 14.0-RELEASE upgrade.png (400×738 px, 17 KB)

Result:

12.4-RELEASE-p9, vi, su -, , freebsd-update -r 14.0-RELEASE upgrade, ee.png (400×720 px, 21 KB)

  • /usr/bin/ee

(A contrived test, hopefully enough for me to check my own understanding of the applicability/scope of what's currently proposed.)