Commit Graph

3800 Commits

Author SHA1 Message Date
Russ Cox dd7c4e5104 fontsrv(4): update man page for size of fontsrv subfonts
Fixes #432.
2020-07-22 20:03:55 -04:00
Igor Böhm afa34a73a9
devdraw, libdraw: fix memory leaks by freeing getns() malloced string (#431) 2020-07-22 14:59:58 -04:00
Russ Cox 057d8a76a9 acme: add font control message 2020-07-18 21:54:06 -04:00
Russ Cox 951446a774 draw: use int for Cacheinfo x field
With very large fonts (72pt or so) I see bad cache glyphs,
and this fixes it. Not entirely sure exactly which code
is overflowing, but something is.
2020-07-18 19:51:24 -04:00
Russ Cox 95ab1308b4 src/cmd: rm dformat
Unclear why it is here (wkj added it long ago).
It has never been installed into $PLAN9/bin,
so it's doubtful that anyone has ever used it.

Arnold Robbins has an alternate version at
https://github.com/arnoldrobbins/dformat.

Fixes #421.
2020-06-22 11:22:27 -04:00
Xiao-Yong 329831171d
libthread: use libc functions in ucontext for macOS (#417) 2020-06-15 23:18:03 -04:00
Gregor Best c3d31baca0
fontsrv: fix compilation on X11 (#420) 2020-06-04 13:55:26 -04:00
Russ Cox 799f330f6d osxvers: use swvers -productVersion to skip one awk call
Fixes #406. Suggested by nms42.
2020-05-30 06:36:14 -04:00
Russ Cox 01b5056135 ed(1): fix documentation for list mode
I changed from 6 to 8 digits but forgot to update the man page.
2020-05-29 21:43:10 -04:00
sean 95220bf887 ed: handle Unicode beyond the BMP correctly in list mode.
List mode was constrained to the BMP. This change introduces
the following new list mode convention, using Go string literal syntax:

Non-printing ASCII characters display as \xhh.
Non-ASCII characters in the BMP display as \uhhhh.
Characters beyond the BMP display as \Uhhhhhhhh.
2020-05-29 21:42:23 -04:00
Russ Cox 3850e6e177 devdraw: accept 5- and 6-byte Unicode hex values
Alt X 1234 for U+1234
Alt X X 12345 for U+12345
Alt X X X 103456 for U+103456.
2020-05-29 21:28:59 -04:00
dzklaim 2c70acc3ab
fontsrv: scale f->originy to match f->height on x11
Co-authored-by: dzklaim <smmoth.rp@gmail.com>
2020-05-29 21:02:10 -04:00
Russ Cox 5f0fa185d0 fontsrv: handle non-BMP runes on X11
Have to adjust algorithms to deal with
much larger number of subfont files as well.
2020-05-29 20:58:37 -04:00
Russ Cox a6ad39aaaa libdraw: handle larger number of subfonts 2020-05-29 20:58:37 -04:00
Russ Cox bfe4377e40 man: update man pages to say $HOME when accurate
Fixes #386.
2020-05-18 23:51:35 -04:00
Russ Cox d25d0ca1a3 devdraw, libdraw: handle keyboard runes > U+FFFF
Runes in Plan 9 were limited to the 16-bit BMP when I drew up
the RPC protocol between graphical programs and devdraw
a long time ago. Now that they can be 32-bit, use a 32-bit wire
encoding too. A new message number to avoid problems with
other clients (like 9fans.net/go).

Add keyboard shortcut alt : , for U+1F602, face with tears of joy,
to test that it all works.
2020-05-18 23:45:03 -04:00
Russ Cox b4cc38f943 build: drop _XOPEN_SOURCE in u.h on AIX 2020-05-18 22:58:09 -04:00
Russ Cox 6c1235d234 build: use installbsd instead of install on AIX
Even in mkmk.sh.
2020-05-18 22:46:42 -04:00
Russ Cox fa157263c8 9c: fix tab 2020-05-18 22:38:54 -04:00
Ben Huntsman 53bf1f1ccf 9l: xlc_r automatically adds -lpthread. 2020-05-18 22:36:53 -04:00
Ben Huntsman 7a371bf936 lib9: use __builtin_return_address on IBM XL/C 2020-05-18 22:36:17 -04:00
Russ Cox 20c841bac1 rc: avoid problematic internal names "var", "thread"
For AIX.
2020-05-18 22:35:17 -04:00
Russ Cox dea4dbdba6 acme: avoid global named "class"
For AIX.
2020-05-18 22:35:17 -04:00
Russ Cox 079f5e9445 libdiskfs: avoid problematic internal constant names
AIX defines some of these constants in its C header files.
2020-05-18 22:35:17 -04:00
Russ Cox d4a4b66a40 diff: rename class to fix AIX
math.h defines a function named class on AIX.
2020-05-18 21:41:35 -04:00
Gabriel Diaz 84167be4ad devdraw: use indirect impl interface in x11 2020-05-18 17:07:25 -04:00
Russ Cox c53ad837a7 lib9: avoid unportable use of d_namlen in dirread
Fixes #395.
2020-05-18 17:04:36 -04:00
Russ Cox 587933c161 devdraw: use global drawlk instead of per-client
Setting up for a real window system.
2020-05-17 23:24:29 -04:00
Russ Cox 94d381ec9d devdraw: use indirect impl interface
Setting up for a real window system.
2020-05-17 23:19:24 -04:00
Russ Cox 162d0d5cd9 libthread: handle spurious _procsleep wakeups, fix $LIBTHREAD handling 2020-05-17 23:18:33 -04:00
Russ Cox baef953da2 libthread: add pthreadperthread mode and use under ASAN
ASAN can't deal with the coroutine stacks.
In theory we can call into ASAN runtime to let it know about them,
but ASAN still has problems with fork or exit happening from a
non-system stack. Bypass all possible problems by just having
a full OS thread for each libthread thread. The threads are still
cooperatively scheduled within a proc (in thos mode, a group of OS threads).

Setting the environment variable LIBTHREAD=pthreadperthread
will enable the pthreadperthread mode, as will building with
CC9FLAGS='-fsanitize=address' in $PLAN9/config.

This solution is much more general than ASAN - for example if
you are trying to find all the thread stacks in a reproducible crash
you can use pthreadperthread mode with any debugger that
knows only about OS threads.
2020-05-17 20:15:41 -04:00
Russ Cox 06687f70ba INSTALL: build mk all the time
If mk gets into a bad state, it's not obvious that you can
remove the binary to force the rebuild. Also, not rebuilding
means that bugs in mkmk.sh are not noticed.
Just rebuild from scratch every time. It doesn't take too long
compared to the rest of INSTALL.
2020-05-17 20:15:41 -04:00
Russ Cox 9444b8e4bc 9c, 9l: accept CC9FLAGS from config
Also, if CC9FLAGS includes -fsanitize=address (ASAN),
predefine PLAN9PORT_ASAN for use by programs that need
to know (mainly libthread).

The 9c script used to have a variable called ngflags, which
was ccflags except -g (ng stood for "no g"), but nothing needs
it split out anymore, so simplify to just ccflags.
2020-05-17 20:15:41 -04:00
Russ Cox 154140a22b mk: replace overlapping strcpy with memmove
Found by ASAN.
2020-05-17 20:15:41 -04:00
Russ Cox 8cb7308f3a lib9: use opendir/readdir to read directories
getdirentries(2) has been deprecated on macOS since 10.5 (ten releases ago).
Using it requires disabling 64-bit inodes, but that in turn makes binaries
incompatible with some dynamic libraries, most notably ASAN.

At some point getdirentries(2) will actually be removed.

For both these reasons, switch to opendir/readdir.
A little clunky since we have to keep the DIR* hidden away
to preserve the int fd interfaces, but it lets us remove a bunch
of OS-specific code too.
2020-05-17 20:15:41 -04:00
Russ Cox 16f60479e1 lib9: move seek into open.c
More preparation for opendir.
2020-05-17 20:15:41 -04:00
Russ Cox 6fd4e901ce lib9: add close
More preparation for opendir.
2020-05-17 20:15:41 -04:00
Russ Cox 58fdc083ad lib9: merge create, open, dirread into open.c
Preparation for using opendir.
2020-05-17 20:15:41 -04:00
Kurt H Maier bd6f12068b fmt: adjust GCC version check
atomics were added in GCC 4.9:  https://gcc.gnu.org/gcc-4.9/changes.html
2020-05-08 10:36:29 -04:00
Ben Huntsman 5802b09e9d all: fix #includes for AIX, add a few AIX "implementation" files 2020-05-07 20:36:03 -04:00
Ben Huntsman f84d54a033 mk: support Big Archive Format under AIX 2020-05-07 20:36:03 -04:00
Ben Huntsman 4982d4ebc3 all: update build scripts to fix AIX XL/C compatibility 2020-05-07 20:36:03 -04:00
Russ Cox c3c9c7b6ae fmt: disable use of stdatomic on AIX XL C and old GCC
C11 is apparently too new for these systems.

Fixes #55.
2020-05-07 20:17:53 -04:00
Russ Cox acffdcb6ee 9term.app: respect user-set shell instead of forcing bash 2020-05-05 09:30:39 -04:00
Russ Cox b962b25eca rc(1): mention /etc/shells in BUGS section 2020-05-05 08:35:56 -04:00
Russ Cox 601e07b636 rc: clean up parser levels, disallow free carats on lists 2020-05-05 08:30:14 -04:00
Russ Cox ff74f7cdda rc: allow unquoted = in command arguments
dd fans rejoice!

Also helps with commands like go test -run=x.
2020-05-04 23:41:15 -04:00
Russ Cox 7d6a248f2c rc: move free carat handling into parser
This fixes at least one shell script (printfont) that expected

	'x'`{y}'z'

to mean

	'x'^`{y}^'z'

as it now does. Before it meant:

	'x'^`{y} 'z'

One surprise is that adjacent lists get a free carat:

	(x y z)(1 2 3)

is

	(x1 y2 z3)

This doesn't affect any rc script in Plan 9 or plan9port.
2020-05-04 23:41:15 -04:00
Russ Cox 3caf5c238a rc: move newline handling into parser 2020-05-04 23:41:15 -04:00
Russ Cox 47d4646eeb rc: add recursive descent parser
The old yacc-based parser is available with the -Y flag,
which will probably be removed at some point.

The new -D flag dumps a parse tree of the input,
without executing it. This allows comparing the output
of rc -D and rc -DY on different scripts to see that the
two parsers behave the same.

The rc paper ends by saying:

	It is remarkable that in the four most recent editions of the UNIX
	system programmer’s manual the Bourne shell grammar described in the
	manual page does not admit the command who|wc. This is surely an
	oversight, but it suggests something darker: nobody really knows what
	the Bourne shell’s grammar is. Even examination of the source code is
	little help. The parser is implemented by recursive descent, but the
	routines corresponding to the syntactic categories all have a flag
	argument that subtly changes their operation depending on the context.
	Rc’s parser is implemented using yacc, so I can say precisely what the
	grammar is.

The new recursive descent parser here has no such flags.
It is a straightforward translation of the yacc.

The new parser will make it easier to handle free carats
in more generality as well as potentially allow the use of
unquoted = as a word character.

Going through this exercise has highlighted a few
dark corners here as well. For example, I was surprised to
find that

	x >f | y
	>f x | y

are different commands (the latter redirects y's output).

It is similarly surprising that

	a=b x | y

sets a during the execution of y.

It is also a bit counter-intuitive

	x | y | z
	x | if(c) y | z

are not both 3-phase pipelines.

These are certainly not things we should change, but they
are not entirely obvious from the man page description,
undercutting the quoted claim a bit.

On the other hand, who | wc is clearly accepted by the grammar
in the manual page, and the new parser still handles that test case.
2020-05-04 23:41:15 -04:00