On 2017/12/22 19:47, Nicholas Marriott wrote:
> I don't think we should bring ! back.
>
> I wanted to remove v and | (and some other stuff) shortly afterwards, but
> several people objected.
>
> I did suggest having a lightweight less in base for most people and adding
> the full upstream less to ports for the stuff we don't want to maintain
> (like we do for eg libevent) but other people didn't like that idea.
less(1) can already be made more lightweight by setting LESSSECURE=1.
(I quite like this even without the reduced pledge, my biggest annoyance
with less is when I accidentally press 'v').
Any opinions on switching the default?
Index: main.c
===================================================================
RCS file: /cvs/src/usr.bin/less/main.c,v
retrieving revision 1.35
diff -u -p -u -1 -2 -r1.35 main.c
--- main.c 17 Sep 2016 15:06:41 -0000 1.35
+++ main.c 22 Dec 2017 22:19:04 -0000
@@ -87,17 +87,17 @@ main(int argc, char *argv[])
- secure = 0;
+ secure = 1;
s = lgetenv("LESSSECURE");
- if (s != NULL && *s != '\0')
- secure = 1;
+ if (s != NULL && strcmp(s, "0") == 0)
+ secure = 0;
if (secure) {
if (pledge("stdio rpath wpath tty", NULL) == -1) {
perror("pledge");
exit(1);
}
} else {
if (pledge("stdio rpath wpath cpath fattr proc exec tty", NULL)
== -1) {
perror("pledge");
exit(1);
}
}
Index: less.1
===================================================================
RCS file: /cvs/src/usr.bin/less/less.1,v
retrieving revision 1.52
diff -u -p -r1.52 less.1
--- less.1 24 Oct 2016 13:46:58 -0000 1.52
+++ less.1 22 Dec 2017 22:17:28 -0000
@@ -1674,9 +1674,7 @@ differences in invocation syntax, the
.Ev LESSEDIT
variable can be changed to modify this default.
.Sh SECURITY
-When the environment variable
-.Ev LESSSECURE
-is set to 1,
+Normally,
.Nm
runs in a "secure" mode.
This means these features are disabled:
@@ -1698,6 +1696,10 @@ Metacharacters in filenames, such as "*"
.It " "
Filename completion (TAB, ^L).
.El
+.Pp
+To enable these features, set the environment variable
+.Ev LESSSECURE
+to 0.
.Sh COMPATIBILITY WITH MORE
If the environment variable
.Ev LESS_IS_MORE