aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2020-01-08lib9: add getcallerpc.c (fixes build)Russ Cox1-0/+13
2020-01-08libhtml: plug a memory leak in addtextNeven Sajko1-0/+3
Change-Id: I9b8a4430e7d26008ba9508095f8eb4b124a93b9b
2020-01-08libhtml: plug quite a few memory leaksNeven Sajko2-4/+13
Change-Id: I45bd62a590373669e90183cc2b2ee56570c007f5
2020-01-08mk: plan9 style.Dan Cross1-7/+8
In general, no space after `if` etc, and no braces for a single statement inside of a loop or conditional. Signed-off-by: Dan Cross <cross@gajendra.net>
2020-01-07mk: fix out of bounds accessNeven Sajko1-7/+21
A loop is added for each structure field instead of accessing the other fields through the first one in one loop. Updates #313 Change-Id: I0e27e15feacb77391bc1decee7cf720d64d14586
2020-01-07lib9, libndb: exclude terminating null from strncpy boundNeven Sajko2-2/+2
GCC pointed this out with some "warning: ‘strncpy’ specified bound NUM equals destination size [-Wstringop-truncation]" warnings. Change-Id: Id8408b165f6e4ae82c96a77599d89f658d979b32
2020-01-07lib9: remove getcallerpc implementationsRuss Cox8-55/+1
These make no sense and are not really needed at all. Add a best-effort attempt to get at the gcc/clang macro in lib9.h, but if it fails, no big deal. Fixes #324.
2020-01-07libmach: plug another memory leakNeven Sajko1-0/+2
Change-Id: Ia5c888db1f0ded2aa92238d994239e46bf52667a
2020-01-07libmach: plug memory leakNeven Sajko1-1/+4
Change-Id: I08cb7227c071c7fc2e30f43e07bcf599fc1d174a
2020-01-079term: add a "look" menu item (#299)Fazlul Shahriar3-0/+32
Add a menu item which functions similar to acme's `Look` command. This is copied from 9front. See: https://code.9front.org/hg/plan9front/rev/1f1596dbca51 https://code.9front.org/hg/plan9front/rev/d2de1d2f7b48
2020-01-07all: sync and dedup the creation of the SYSNAME and OBJTYPE env vars (#321)Neven Sajko1-19/+1
This should prevent the issues of dist/buildmk and src/mkhdr getting out of synchronization yet again. I also add a rule for arm64 to the OBJTYPE sed command. Fixes #243 Fixes #320 Change-Id: I60f69a1f32b5ed5ae5ac8a1659c38e29debed005
2020-01-02cmd/htmlroff: fix buffer overflow in t2.c getqargNeven Sajko1-1/+1
This is actually from 2016: https://plan9port-review.googlesource.com/c/plan9/+/1590 Change-Id: I6f2a3d71a9dd589eff7ab15b3c1d3997254b3c35
2020-01-02ls: check that pointer is not nil before calling qsortNeven Sajko1-1/+1
Passing a null pointer to qsort is an error in C (GCC and Clang agree with the standards there, so this is no joke). Change-Id: Ia2b015793a75ea4e85ae8f47da6beead9c4290e6
2020-01-02acme: do not pass null pointers where disallowedNeven Sajko2-1/+4
The C standards disallow passing null pointers to memmove and memcmp. Change-Id: I1c88c2adbc32a23ef742f206038b8f7c4e0540c7
2020-01-02cmd/rc: fix declarations of some externally linked variablesNeven Sajko2-3/+2
Change-Id: If8fe1afecb9fe55f85e8e5af37521b83e787d718
2020-01-02cb: fix a null pointer dereferenceNeven Sajko1-3/+3
Just added a pair of parentheses. I also ran cb on cb.c to beautify the code. This is actually on Gerrit from 2016: https://plan9port-review.googlesource.com/c/plan9/+/1574 Change-Id: I5e234adba0f95c13d6eecb121bf11bba4bf54566
2019-12-19sam: report close errorRuss Cox3-1/+9
2019-12-19acme: report close failure during PutRuss Cox1-2/+6
2019-12-19libbio: report Bflush/close error from BtermRuss Cox1-3/+5
2019-12-10ed: formatting tweak (remove redundant tab). (#301)Marc Simpson1-1/+1
2019-12-08page: fix pdf prolog for ghostscript >= 9.27 (#296)Fazlul Shahriar2-4/+2
Ghostscript 9.27 removed GS_PDF_ProcSet and pdfdict due to a security issue (see https://security-tracker.debian.org/tracker/CVE-2019-3839). This fix was contributed by @onyxperidot (see #279). Fixes #279
2019-12-08ed: replace magic number (077776, i.e. 32766) with NBLK-1. (#300)Marc Simpson1-1/+1
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.
2019-11-14page: fix hang for forward-only postscript filesFazlul Shahriar2-1/+7
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
2019-10-29plumber: add -f (foreground) option (#288)Jason Felice3-4/+11
In MacOS, services run by launchd must run in the foreground, since launchd manages forking and other resources.
2019-10-29awk: split record into runes for empty FS (#292)Fazlul Shahriar1-4/+9
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
2019-09-19hoc: don't nest calls to follow() when lexing ++/+= and --/-= (#287)deepcube1-2/+2
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.
2019-09-19upas/nfs: fix null date when message is sent to plumber (#263)telephil1-1/+1
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.
2019-09-19plumber: fix EOF detection on writes to rules file (#257)Fazlul Shahriar1-3/+3
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
2019-09-19auxstats: replace /proc ACPI calls with /sys ones (#245)Zach Scott1-22/+8
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.
2019-06-19devdraw: cocoa metal screen adds a delayed update (#270)Xiao-Yong1-0/+7
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.
2019-06-11devdraw: handle windowDidResize on macOS (#212)Pocket78781-1/+7
This supports non-live window resize.
2019-06-10acme: accept expanded URLs in lookRuss Cox1-9/+39
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.
2019-05-17acme: delete trailing spaces during Put in autoindent modeRuss Cox1-41/+64
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.
2019-05-17devdraw: cocoa metal screen updates (#215)Xiao-Yong1-63/+27
* devdraw: cocoa metal screen uses a dirty hack to make everything smooth * devdraw: cocoa metal screen uses a layer to make fullscreen applications behave * devdraw: macOS cocoa metal fix resizeimg without img * devdraw: macOS cocoa metal uses blit instead of render We directly use the blit command encoder to copy texture to the framebuffer. We no longer need to compile the metal shader every time the application starts just for rendering a flat 2D surface. * travis: add osx images covering 10.13 and 10.14
2019-04-19acme: do not trim spaces during PutRuss Cox1-4/+8
The commit that introduced this was pushed accidentally. It is not a good idea to do this. (It breaks programs that think that a clean window means the body matches the on-disk file.)
2019-04-05samterm: stop ignoring all keys >= KcmdPocket78781-2/+3
2019-04-05devdraw: stop redirecting ^H in cocoa-metal (#209)Xiao-Yong1-1/+0
2019-04-05libdraw,devdraw: fix compatibility with old 16x16 cursor protocol (#217)Fazlul Shahriar4-1/+33
Some libraries that depend on devdraw don't know about 32x32 cursor -- mainly 9fans.net/go/draw.
2019-04-05devdraw: prefer low-power GPU for macOS metal rendering (#231)Chris Schultz1-2/+13
2019-04-05devdraw: avoid deadlock on pre-Mojave macOSRuss Cox1-0/+6
2019-04-05acme: Update tag after receiving menu/nomenu control event (#251)Martin Kühl1-0/+2
2019-04-05devdraw: fix cocoa metal _flushmemscreen for invalid rectangles (#240)Xiao-Yong1-0/+4
It is possible to receive multiple screen resize events, and resizeimg would be called for different sizes, before _flushmemscreen actually gets called with rectangle sizes different from the most recent resizeimg call. The size mismatch would trigger illegal memory access inside _flushmemscreen. This commit protects _flushmemscreen by returning early if the requested rectangle is outside of the current texture rectangle.
2019-04-05devdraw: respond to windowDidBecomeKey on darwin (#239)Jacob Vosmaer1-0/+5
Fixes bug where devdraw does not "notice" mouse position after task switch. Fixes https://github.com/9fans/plan9port/issues/232.
2019-02-25page: handle EPS without showpageRuss Cox2-1/+6
2019-02-01rio: delete ancient Imakefile (use mk instead)Russ Cox1-27/+0
Fixes #235.
2019-02-01acme: drop trailing spaces during Put of auto-indent windowRuss Cox1-3/+38
Auto-indent mode leaves trailing spaces on blank lines as you type past them, so silently elide them from the window content as it gets written back to disk. Another option would be to remove them from the window entirely during Put, but they're actually nice to have while editing, and to date Put has never modified the window content.
2018-11-16libdraw: redo default font construction to be hidpi-safeRuss Cox16-570/+372
If $font is not set, the default font is constructed from font data linked into every libdraw binary. That process was different from the usual openfont code, and so it was not hidpi-aware, resulting in very tiny fonts out of the box on hidpi systems, until users set $font. Fix this by using openfont to construct the default font, by recognizing the name *default* when looking for font and subfont file contents. Then all the hidpi scaling applies automatically. As a side effect, the concept of a 'default subfont' is gone, as are display->defaultsubfont, getdefont, and memgetdefont.
2018-11-15file: recognize Mach-O binaries and Java class filesMartin Kühl1-0/+3
2018-11-15file: add missing newlines to file typesMartin Kühl1-3/+3
2018-11-15paint: add drawing program from 9front (#112)Tobias Heinicke3-0/+1128
Paint first appeared in 9front. The 9front license is reproduced in the related source files - the original repository is located at https://code.9front.org/hg/plan9front.