Bug 215958 - skel/dot.shrc: redundant line in .shrc removes functionality
Summary: skel/dot.shrc: redundant line in .shrc removes functionality
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: 11.0-RELEASE
Hardware: Any Any
: --- Affects Many People
Assignee: Jilles Tjoelker
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-11 05:33 UTC by Andras Farkas
Modified: 2017-01-22 21:52 UTC (History)
2 users (show)

See Also:
jilles: mfc-stable11+
jilles: mfc-stable10+


Attachments
diff that solves the problem (375 bytes, patch)
2017-01-12 22:58 UTC, Andras Farkas
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andras Farkas 2017-01-11 05:33:28 UTC
Emacs editing mode is the default mode in sh. When just using the sh command, it is enabled without using the -E mode.
One uses sh -V to enable the vi editing mode instead.
However, $ENV points to /home/user/.shrc and .shrc has a redundant line in it:
set -o emacs
What this does is not only just set default functionality, but overrides a user's command: ``sh -V'' and ``sh -o vi'' and ``sh +o emacs'' don't work as long as this line in .shrc exists, and as long as ENV points to .shrc

The solution is to remove that line and the two commented lines above it in .shrc, as sh uses emacs editing by default. This is confirmed both by actual usage and by the sh(1) man page.
This was actually noticed all the way back in 2010 as bug 153233
This is a very easy fix.
Comment 1 Andras Farkas 2017-01-12 22:58:23 UTC
Created attachment 178844 [details]
diff that solves the problem

This diff solves the problem by commenting out the line.
Comment 2 commit-hook freebsd_committer freebsd_triage 2017-01-15 13:40:45 UTC
A commit references this bug:

Author: jilles
Date: Sun Jan 15 13:40:15 UTC 2017
New revision: 312230
URL: https://svnweb.freebsd.org/changeset/base/312230

Log:
  skel: Do not set -o emacs in .shrc.

  sh has defaulted to 'set -o emacs' since FreeBSD 9.0. Therefore, do not set
  this again in .shrc, since that only serves to prevent invocations like
  'sh -o vi' and 'sh +o emacs' to have the intended effect.

  PR:		215958
  Submitted by:	Andras Farkas
  MFC after:	1 week

Changes:
  head/share/skel/dot.shrc
Comment 3 Jilles Tjoelker freebsd_committer freebsd_triage 2017-01-15 13:47:14 UTC
Fixed in head, thanks.
Comment 4 commit-hook freebsd_committer freebsd_triage 2017-01-22 21:32:38 UTC
A commit references this bug:

Author: jilles
Date: Sun Jan 22 21:31:32 UTC 2017
New revision: 312653
URL: https://svnweb.freebsd.org/changeset/base/312653

Log:
  MFC r312230: skel: Do not set -o emacs in .shrc.

  sh has defaulted to 'set -o emacs' since FreeBSD 9.0. Therefore, do not set
  this again in .shrc, since that only serves to prevent invocations like
  'sh -o vi' and 'sh +o emacs' to have the intended effect.

  PR:		215958
  Submitted by:	Andras Farkas

Changes:
_U  stable/11/
  stable/11/share/skel/dot.shrc
Comment 5 commit-hook freebsd_committer freebsd_triage 2017-01-22 21:34:42 UTC
A commit references this bug:

Author: jilles
Date: Sun Jan 22 21:34:26 UTC 2017
New revision: 312654
URL: https://svnweb.freebsd.org/changeset/base/312654

Log:
  MFC r312230: skel: Do not set -o emacs in .shrc.

  sh has defaulted to 'set -o emacs' since FreeBSD 9.0. Therefore, do not set
  this again in .shrc, since that only serves to prevent invocations like
  'sh -o vi' and 'sh +o emacs' to have the intended effect.

  PR:		215958
  Submitted by:	Andras Farkas

Changes:
_U  stable/10/
  stable/10/share/skel/dot.shrc