Commit Briefs

Dan Cross

ed: replace magic number (077776, i.e. 32766) with NBLK-1. (#300)

Temp file size is now declared in an enum; changing it from the default introduces a subtle bug in putline(), which expects it to be 32767. Mask with NBLK-1 instead.


Dan Cross

page: fix hang for forward-only postscript files

Page was hanging because ghostscript never closes the fd from which we're reading BMP data. We close our end of the pipe so that ghostscript will close its end. Tested with ghostscript version 9.50. Fixes #124


Dan Cross

9c, 9l: use $TMPDIR if available (#272)

NixOS sandboxed builds (at least on Mac) don't have access to /tmp, and this should be better POSIX.


Dan Cross

plumber: add -f (foreground) option (#288)

In MacOS, services run by launchd must run in the foreground, since launchd manages forking and other resources.


Dan Cross

awk: split record into runes for empty FS (#292)

awk was splitting records into bytes instead of runes for empty FS. For example, this was printing only the first byte of the utf-8 encoding of é: echo é | awk 'BEGIN{FS=""}{print $1}' The change just copies how the `split` function handles runes. Originally reported by kris on twitter: https://twitter.com/p9luv/status/1180436083433201665



Dan Cross

9l: support Linux version 5.0+ (#274)

Update 9l to support Linux 5.x.


Dan Cross

hoc: don't nest calls to follow() when lexing ++/+= and --/-= (#287)

The code had a nested use of the follow() function that could cause +=+ and -=- to register as ++ and --. The first follow() to execute could consume a character and match and then the second follow() could consume another character and match. For example i-=-10 would result in a syntax error and i-=- would decrement i.


Dan Cross

upas/nfs: fix null date when message is sent to plumber (#263)

When fetching, messages are sent to plumber as soon as the ENVELOPE part is read. The date field of the message is sent when the INTERNALDATE part is read and there is no guarantee that this will be read before the ENVELOPE. This bug can be observed when using faces(1) which will retrieve messages with a null date and then always display a 'Jan 1' date instead of the correct one. The fix is to simply send the message to plumber after having read all parts, thus ensuring the message is complete.


Dan Cross

plumber: fix EOF detection on writes to rules file (#257)

Instead of checking Fcall.data==nil, check Fcall.count==0. The former check always fails after `gcc -O2` optimizations (gcc version 8.3.0). Also fix an out-of-bound read detected by valgrind: ``` ==31162== Invalid read of size 1 ==31162== at 0x11005E: morerules (rules.c:739) ==31162== by 0x110254: writerules (rules.c:775) ==31162== by 0x10D2FE: fsyswrite (fsys.c:848) ==31162== by 0x10C304: fsysproc (fsys.c:248) ==31162== by 0x112E8C: threadstart (thread.c:96) ==31162== by 0x4A682BF: ??? (in /usr/lib/libc-2.29.so) ==31162== Address 0x4ea984a is 0 bytes after a block of size 250 alloc'd ==31162== at 0x483AD7B: realloc (vg_replace_malloc.c:826) ==31162== by 0x1196F3: p9realloc (malloc.c:53) ==31162== by 0x10BDFD: erealloc (plumber.c:124) ==31162== by 0x10FCD9: concat (rules.c:642) ==31162== by 0x10FCD9: concat (rules.c:635) ==31162== by 0x110230: writerules (rules.c:773) ==31162== by 0x10D2FE: fsyswrite (fsys.c:848) ==31162== by 0x10C304: fsysproc (fsys.c:248) ==31162== by 0x112E8C: threadstart (thread.c:96) ==31162== by 0x4A682BF: ??? (in /usr/lib/libc-2.29.so) ``` Fixes #256


Dan Cross

auxstats: replace /proc ACPI calls with /sys ones (#245)

According to <https://askubuntu.com/a/309146>, use of `/proc/acpi` to get battery usage is deprecated. This commit replaces the two files from this API with the single file `/sys/class/power_supply/BAT0/capacity`, simultaneously removing the need to calculate battery percentage.


Russ Cox

devdraw: cocoa metal screen adds a delayed update (#270)

The immediate display of the screen sometimes miss the update from the CPU side memory. No obvious synchronization mechanism is available. In order to make sure the screen updates properly, we set needsDisplay again after 16ms delay to ensure a second screen update.


Russ Cox

devdraw: handle windowDidResize on macOS (#212)

This supports non-live window resize.


Russ Cox

acme: accept expanded URLs in look

Just as look expands a click in /etc/passwd to the full name (provided that file exists), it now expands a click in https://9fans.net/ to the full URL (provided the prefix is http:// or https://). Probably more adjustment is needed.


Russ Cox

acme: delete trailing spaces during Put in autoindent mode

Autoident mode is the leading cause of trailing spaces on lines. Remove them during Put to make various picky tools happier. The changes during Put are added as a separate entry to the file history, so that the first Undo after Put restores the spaces.