Commit Graph

1228 Commits

Author SHA1 Message Date
Stefan Assmann
7fc842ddc6 fix UTF-8 characters with more than 2 bytes
Characters are stored as uint32 nowadays. Looking at the lower bytes
only seems to be an oversight from the fontx clean up.

Fixes: f18f5d0da1 get rid of fontx
2019-03-17 14:31:45 +01:00
Amadeusz Sławiński
d2d33f6641 drop unnecessary BEL from bracketed paste mode sequence
there is no BEL in enable/disable bracketed paste mode sequence, so we
shouldn't unnecessarily print it

Bug: #55709

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2019-02-14 20:30:23 +01:00
Nicolas Schodet
9b0243f7ee Fix extra characters when sending a command in one go
This closes bug #52372: Giberish printed to screen window in certain
situations.

When sending "^An", most of the time, screen first receives "^A", then
it receives the "n".  This means that in the ProcessInput2 function,
ilen == 1 after the escape character has been seen, ilen is decremented
and the ProcessInput2 function returns.

When "^An" is sent in one go, for example when pasting or when using a
special shortcut, ilen is not 1 when the escape character is seen.  In
this case, the s variable was incremented, but ilen was not decremented.
This leads the function to read an extra character which does not
exists.

This regression was introduced in 2fab4d6f73, as reported in the bug
report.

This can be tested by having a command in the selection:

echo -ne '\x01n' | xclip -i

And pasting it (in this case, you might see the closing bracketed paste
sequence, but that is another problem).

Bug: #52372
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2019-02-11 21:59:43 +01:00
Amadeusz Sławiński
724297c2c2 make build date reproducible
Based on https://reproducible-builds.org/docs/source-date-epoch/
They suggest "BUILD_DATE ?=", but it seems to be evaluated for each file
separately, so us "BUILD_DATE :=" to set it once.

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2019-02-02 22:35:07 +01:00
Scott Shambarger
e99eb0d101 Fix blanker to work when screen is suid root
* Change RunBlanker to call OpenDevice so permissions on slave
  PTY are correctly set.
* Update handling of file descriptors after fork to be similar to
  ForkWindow on at pty (fixes debug and leaked descriptors)
* Allow display of error message when display blocked by blanker
  (because message is probably from blanker failing to start)

Bug: 55512

Cherry-picked form screen-v4, with some modifications

Signed-off-by: Scott Shambarger <devel@shambarger.net>
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2019-01-27 16:22:20 +01:00
Scott Shambarger
b751a22e83 Prevent Panic causing Panic, and children removing sockets
* Set eff_uid/eff_gid after setuid/setgid to prevent nested Panic
  MakeClientSocket calls xseteuid(eff_uid=0) - results in nested
  Panic and SendErrorMsg not getting sent.
* Set ServerSocket to -1 after fork so that child Panic doesn't
  remove socket in eexit.

Bug: 55511

Cherry-picked from screen-v4 with some modifications

Signed-off-by: Scott Shambarger <devel@shambarger.net>
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2019-01-27 16:06:16 +01:00
Amadeusz Sławiński
30787db417 mark AttacherFinit, AttacherFinitBye & Attacher as noreturn
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2019-01-27 14:34:54 +01:00
Amadeusz Sławiński
244e1205dd mark backticks as static
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2019-01-26 19:41:05 +01:00
Amadeusz Sławiński
62d319b8a9 fix flow of 'at' command
we just returned without freeing 's' and resetting EffectiveAclUser,
which per comment at the beginning should be reset

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2019-01-26 19:40:56 +01:00
Amadeusz Sławiński
711a354ce6 sched() can be marked as noreturn
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2019-01-26 19:40:49 +01:00
Amadeusz Sławiński
b89fcbb69f remove unneeded cast
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2019-01-26 19:40:40 +01:00
Amadeusz Sławiński
8d902468e3 RunBlanker prototype should be in display.h
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2019-01-26 19:40:34 +01:00
Amadeusz Sławiński
d212513fb5 wmb_create takes no parameters
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2019-01-26 19:40:26 +01:00
Amadeusz Sławiński
b53cf27ab2 in verbose command, we can ignore return value from ParseOnOff
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2018-12-06 22:20:30 +01:00
Amadeusz Sławiński
af8b3fc75a in log command toggle log only if we successfully parsed argument
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2018-12-06 22:20:10 +01:00
Amadeusz Sławiński
a66c5fc74b in truecolor command trigger redraw only if passed correct argument
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2018-12-06 22:19:53 +01:00
Amadeusz Sławiński
07512f6abf don't attempt to swap window with itself
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2018-12-06 22:17:32 +01:00
Amadeusz Sławiński
a86b0c40d3 get rid of Wformat-overflow warning
60 characters is plenty enough for reason string

window.c: In function ‘WindowDied’:
window.c:1941:33: warning: ‘%s’ directive writing up to 99 bytes into a region of size 86 [-Wformat-overflow=]
   sprintf(buf, "\n\r=== Command %s (%s) ===", reason, s ? s : "?");
                                 ^~            ~~~~~~
window.c:1941:16: note: assuming directive output of 1 byte
   sprintf(buf, "\n\r=== Command %s (%s) ===", reason, s ? s : "?");
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/stdio.h:862,
                 from logfile.h:33,
                 from window.h:39,
                 from window.c:34:
/usr/include/bits/stdio2.h:33:10: note: ‘__builtin___sprintf_chk’ output 22 or more bytes (assuming 122) into a destination of size 100
   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       __bos (__s), __fmt, __va_arg_pack ());
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2018-11-20 23:31:54 +01:00
Amadeusz Sławiński
2c816e5bc7 fix zombie command
commit f12ada8192 (refactor SwapWindows)
accidentally changed killit variable causing code to never execute

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2018-11-20 23:31:54 +01:00
Amadeusz Sławiński
4818b35dde check if fseek & ftell succeeded
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2018-11-20 23:31:47 +01:00
Amadeusz Sławiński
fb63c184c6 w_tty is an array, so we don't need to perform NULL check on it
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2018-11-18 23:27:40 +01:00
Amadeusz Sławiński
98d688cfb2 fix truecolor escape
it's still a hack, because to do proper detection we would need to
migrate to terminfo functions instead of termcap

Bug: 52667
Bug: 54989

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2018-11-18 16:28:06 +01:00
Ethan Warth
85dd33fb4d added documentation for traversal to parent group
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2018-11-18 16:26:24 +01:00
Ethan Warth
572c43aa83 added function and key binding for traversing to parent
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2018-11-18 16:26:03 +01:00
Ethan Warth
ce86ff580a add persistent bits to window group display options
Windowlist has two toggles that affect its output: the list can be sorted in
either index or MRU order, and the list can contain either just immediate
children windows of all descendant windows.  Since window groups use the same
code for their own output, they also support these toggles.

However, in the current code base, these toggles are reset to index ordering and
display of immediate children only every time a particular window group is
swapped out of and back into a pane.

Amadeusz:
added commit message + changed variable names + some reformatting

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2018-11-18 16:24:43 +01:00
Václav Doležal
cee011a388 Fix for nomem handling in resize.c:ChangeWindowSize()
Move `nomem' label of ChangeWindowSize() to the end of function and
add test for value of `nhlines'

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net
2018-11-18 16:22:03 +01:00
Václav Doležal
a47b9801fb Revert "those 0 assignment made rest of code totally not working"
This reverts commit ff98d7ff58.

This can potentially cause double-free. `nmlines' and `nhlines'
should be freed in preceding lines.

`nmlines' and `nhlines' are not used in the rest of the function
except in `nomem' label and their valuse are copied into `p', so
their value should be zeroed.

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net
2018-11-18 16:22:03 +01:00
Václav Doležal
82f1ea1cba Fix file descriptor leak
Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net
2018-11-18 16:22:03 +01:00
Václav Doležal
23e06fce27 Use memcpy(3) in string substitution
Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net
2018-11-18 16:22:03 +01:00
Therese Godefroy
87394be8ec apply patch by Therese fixing some doc issues
This fixes some issues when documentation is generated for online
viewing.
2018-10-14 21:36:04 +02:00
Jason Simpson
f606916a7a bugfix: crash on dinfo, "stack smashing detected"
This seems to be caused by faulty pointer/buffer-length
tracking. Pointer position 'p', meant to be incremented
by the length of the string written to the buffer, is
instead incremented by (length of the buffer - length of
the string written to the buffer), quickly shooting past
the end of the allocated buffer space.
2018-09-24 22:56:31 +02:00
Svyatoslav Mishyn
b7cf6df01a doc: fix typos
Hi there,

just found a few typos, see attachment.

(please, CC me)

Thanks.

--
https://www.juef.space/

From 745ba353867142d3e00f4d2ab06962ba0d3aaaab Mon Sep 17 00:00:00 2001
From: Svyatoslav Mishyn <svyatoslav.mishyn@gmail.com>
Date: Wed, 4 Jul 2018 21:40:48 +0300
Subject: [PATCH] doc: fix typos
2018-07-24 23:18:54 +02:00
Amadeusz Sławiński
60893c465b add %T escape to show current tty for window 2018-06-25 20:22:32 +02:00
Amadeusz Sławiński
60d458b40c remove character substitution
it may be not compatible with some man page viewers
2018-06-21 21:45:43 +02:00
Eric S. Raymond
90c3f41ca9 fix manpage 2018-06-21 21:42:35 +02:00
Marcin Cieślak
c94fdfe968 manpage: Explain window permissions in a table 2018-05-31 14:36:05 +02:00
Marcin Cieślak
6a6f5e061b manpage: Use monospaced font to render example of "displays" 2018-05-31 14:36:05 +02:00
Marcin Cieślak
6e43960772 manpage: Indent both examples for readreg 2018-05-31 14:36:05 +02:00
Marcin Cieślak
7051148079 manpage: keep nonblock and status parameters on the same line 2018-05-31 14:36:05 +02:00
Marcin Cieślak
0285fd2d0e manpage: explain flow control state indicators with a table 2018-05-31 14:36:05 +02:00
Marcin Cieślak
6fe22d6506 manpage: Remove horizontal lines on large tables
Remove "allbox" tbl option from large keybinding table.
When formatting for print, large tbl tables need to be handled
specially to split nicely across the pages; instead we
just add horizontal lines and we let them overflow the pages.

The input translation table seems to fit nicely on one page
and is left as is with the "allbox" option.
2018-05-31 14:36:05 +02:00
Marcin Cieślak
7ef6811606 manpage: add vertical space after bindkey examples
bindkey examples seem to be glued to their following descriptions.
This looks bad in the printable versions, so give it some space.

Alternatively we could possibly reverse the indentation and use
something like this:

bindkey -d

      Show all of the default key bindings.

but this is inconsistent with other examples.
2018-05-31 14:36:05 +02:00
Marcin Cieślak
456581932e manpage: Print = instead of double horizontal line
"Keypad =" table entry had a double horizontal line instead of a single "="
when printed with troff.

From "Tbl -- A Program to Format Tables" by M. E. Lesk:

Single column horizontal lines
    -- An input table entry containing only the character (...) = is
    taken to be a single or double line extending the full width of the
    column. Such lines are extended to meet horizontal or vertical
    lines adjoining this column. To obtain these characters explicitly
    in a column, either precede them by \& or follow them by a space
    before the usual tab or newline.
2018-05-31 14:36:05 +02:00
Amadeusz Sławiński
e2a3b9ba24 check if we succeeded in SttyMode
should detect invalid parameters, like bad baud modes

Bug: 50849
2018-05-31 14:34:29 +02:00
Amadeusz Sławiński
dbe1eb72b2 make sure we get all Panic messages
move reassociating streams to after we get display, otherwise there
is short window where we printf to /dev/null if we fail
2018-05-31 14:34:24 +02:00
Amadeusz Sławiński
55b7006260 clean up hostname mangling in utmp
we shouldn't mangle hostname name as it may break if host is ipv6 address

Bug: 48661
2018-05-22 21:30:59 +02:00
Amadeusz Sławiński
f2f5fd49d3 macro formatting 2018-05-22 21:30:59 +02:00
Amadeusz Sławiński
8613a96fa7 fix gcc warning
screen.c: In function ‘main’:
screen.c:940:4: warning: ‘strncpy’ output truncated before terminating nul copying 6 bytes from a string of the same length [-Wstringop-truncation]
    strncpy(ap, "SCREEN", 6); /* name this process "SCREEN-BACKEND" */
    ^~~~~~~~~~~~~~~~~~~~~~~~
2018-05-22 21:30:59 +02:00
Amadeusz Sławiński
c82d70de9c this actually should be 3 dots
they are part of syntax
2018-05-15 21:20:27 +02:00
Amadeusz Sławiński
d6c05f5e41 fix job control on FreeBSD
this is readded based on code which already was there
in older versions

we need TIOCSCTTY ioctl to set session control terminal

I'm not adding any system ifdefs, as it doesn't seem
like it should break anything on linux

Bug: 49170
2018-05-15 20:02:37 +02:00