Commit graph

3571 commits

Author SHA1 Message Date
cinap_lenrek 68572ab451 diff: revert last change, this breaks git/diff 2021-11-09 01:29:30 +00:00
Igor Böhm efa6937460 acme: fix leaking memory allocated by getenv("font")
If the font chosen for acme is retrieved via `getenv("font")` its
memory is leaked:

<snip>
	if(fontnames[0] == nil)
		fontnames[0] = getenv("font");
		^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> getenv(…) mallocs memory

	if(fontnames[0] == nil)
		fontnames[0] = "/lib/font/bit/vga/unicode.font";
	if(access(fontnames[0], 0) < 0){
		fprint(2, "acme: can't access %s: %r\n", fontnames[0]);
		exits("font open");
	}
	if(fontnames[1] == nil)
		fontnames[1] = fontnames[0];
	fontnames[0] = estrdup(fontnames[0]);
	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> if the `getenv("font")` path was taken above, this assignment
> will leak its memory.
</snap>

The following leak/acid session demonstrates the issue:

<snip>
cpu% leak -s 212252
src(0x002000cb); // 1
cpu% acid 212252
/proc/212252/text:amd64 plan 9 executable
/sys/lib/acid/port
/sys/lib/acid/amd64
acid: src(0x002000cb)
/sys/src/cmd/acme/acme.c:107
 102			fprint(2, "usage: acme [-aib] [-c ncol] [-f font] [-F fixedfont] [-l loadfile | file...]\n");
 103			exits("usage");
 104		}ARGEND
 105
 106		if(fontnames[0] == nil)
>107			fontnames[0] = getenv("font");
 108		if(fontnames[0] == nil)
 109			fontnames[0] = "/lib/font/bit/vga/unicode.font";
 110		if(access(fontnames[0], 0) < 0){
 111			fprint(2, "acme: can't access %s: %r\n", fontnames[0]);
 112			exits("font open");
acid:
</snap>

The fix tries to first check if a font has been set via
command line options in which case the font string is
malloced via estrdup(…).

If no font has been selected on the command line getenv("font")
is used. If no getenv("font") var is found we malloc a default
font via estrdup(…).

<snip>
	if(fontnames[0] != nil)
		fontnames[0] = estrdup(fontnames[0]);
	else
		if((fontnames[0] = getenv("font")) == nil)
			fontnames[0] = estrdup("/lib/font/bit/vga/unicode.font");
	if(access(fontnames[0], 0) < 0){
		fprint(2, "acme: can't access %s: %r\n", fontnames[0]);
		exits("font open");
	}
	if(fontnames[1] == nil)
		fontnames[1] = fontnames[0];
	fontnames[1] = estrdup(fontnames[1]);
</snap>

This resolves the memory leak reported by leak(1).
2021-11-05 23:51:55 +00:00
Kyle Milz cd7480f68f diff: fix -u when comparing identical files 2021-11-05 19:03:20 +00:00
cinap_lenrek 6c70026fa4 acme: fix plumb message leaks (thanks igor) 2021-11-05 18:49:40 +00:00
Kyle Milz e2e4a46f26 git/revert: fix empty invocation
git/revert requires a file name argument, but when none is given
it fails in a strange way:

	% git/revert
	usage: cleanname [-d pwd] name...
	/bin/git/revert:15: null list in concatenation
2021-11-04 19:08:02 +00:00
Stuart Morrow 3f49507786 mainly just spelling and typos 2021-11-01 20:49:43 +00:00
cinap_lenrek cdf3be65ea snoopy: dns: add caa record type, fix rrtypestr() 2021-11-03 21:44:24 +00:00
cinap_lenrek c37de33463 ndb/dns: use decimal encoding for txt rr string escapes
rfc883 suggests to use decimal digits to escape txt rr strings,
and unix dig appears to use the same.
so change from octal to decimal.
2021-11-03 20:38:23 +00:00
cinap_lenrek 6285c19b33 snoopy: adjust for new dns txt rr format 2021-11-03 20:21:03 +00:00
cinap_lenrek 5de1f3d9cf ndb/dns: handle txt rr strings as binary, remove nullrr ndb code
txt and caa rr strings might contain binary control characters
such as newlines and double quotes which mess up the output
in ndb(6) format.
so handle them as binary blobs internally and escape special
characters as \DDD where D is a octal digit when printing.

txtrr() will unescape them when reading into internal
binary representation.

remove the undocumented nullrr ndb attribute parsing code.
2021-11-03 20:09:02 +00:00
cinap_lenrek 2899b719ae libndb: move mkptrname() into libndb to avoid duplication 2021-11-03 19:38:36 +00:00
Sigrid Solveig Haflínudóttir 2d56837b2f zuke: fix search function ignoring matching artist name 2021-11-03 14:45:27 +00:00
cinap_lenrek 498d86b921 ndb/dnsquery: make ! bang work with reverse lookups, document in ndb(8) 2021-11-01 16:31:39 +00:00
cinap_lenrek 3cd87bc3fb ndb/dns: use correct attribute when serializing caa record in ndb format 2021-11-01 15:12:17 +00:00
cinap_lenrek 5e3ded2242 ndb/dnsdebug: dont duplicate rrfmt()
introduce our own RR* format %P for pretty
printing and call %R format internally,
then use it to print the rest of the line
after the tab, prefixed with the padded
output.
2021-11-01 14:39:18 +00:00
cinap_lenrek 28f67bba84 ndb/dns: fix ndb serialization of RR*
have todo multiple fmtprint() calls for idnname()
as the buffer is shared.

do not idnname() rp->os and rp->cpu, these are symbols.

always quote txt= records.
2021-11-01 14:37:19 +00:00
qwx 987d15e7b2 tinc: fix typo in unknown host error message 2021-10-31 22:48:20 +00:00
Sigrid Solveig Haflínudóttir 023882f0a4 libtags: no tags is still fine if format is known 2021-10-31 17:38:18 +00:00
cinap_lenrek aebf92224f acmed: pass original utf8 subject domain to challengefn, simplify
try to keep everything in utf8 format.
2021-10-31 02:16:17 +00:00
cinap_lenrek a9e533ad1e acmed: handle international domain names 2021-10-31 00:12:36 +00:00
Sigrid Solveig Haflínudóttir 35a8152ebc git/pack: check pf->pack for nil before Bterming it 2021-10-28 15:26:57 +00:00
Sigrid Solveig Haflínudóttir 18521fc8c6 mkplist: add -s option to enable "simple" sort (thanks qwx) 2021-10-28 15:20:13 +00:00
Sigrid Solveig Haflínudóttir a84f3ef581 zuke: simplify volume control logic 2021-10-28 14:59:46 +00:00
Sigrid Solveig Haflínudóttir 4b7e72689d zuke: reset before tokenize, increase player thread stack 2021-10-27 22:02:31 +00:00
Ori Bernstein c5a0909b67 acmed: remove unused define
we don't use or care about the user agent.
2021-10-27 19:34:29 +00:00
Ori Bernstein d8a1437cf4 acmed: move from ip/ to auth/
Getting certs is more tied to authentication than it
is to ip.
2021-10-27 19:33:22 +00:00
cinap_lenrek 96560abe44 acmed: reject -t flag when -e is given, dup stderr to stdout of -e cmd 2021-10-27 17:08:20 +00:00
Sigrid Solveig Haflínudóttir e8083eca17 zuke: do not change volume with delta == 0 2021-10-26 15:37:04 +00:00
Sigrid Solveig Haflínudóttir 8c6daa778a zuke: support other volume handles, update volume when /dev/audio is opened 2021-10-26 15:08:35 +00:00
cinap_lenrek 79c6a0f342 acmed: tokenize domains from subject also with spaces (fixed multidom cert) 2021-10-25 18:15:53 +00:00
cinap_lenrek 87eb9bc2b7 acmed: add external command flag -e, improvements, bugs
- allow for external command to be run to install a challenge using -e flag
- remove the challengedom argument, it is given by the subject in the csr
- fix some filedescriptor leaks in error paths
2021-10-25 16:59:29 +00:00
cinap_lenrek 20cff04fd2 ndb/dns: implement caa record type in ndb
this allows the caa records to be specified
in ndb as:

caa=<value> tag=<tag> flags=<flags>

where tag defaults to "issue" and flags to 0
when omited.
2021-10-24 22:15:26 +00:00
Ori Bernstein c2661f86fc git/serve: one more silencing of non-interactive prints 2021-10-24 14:37:36 +00:00
Ori Bernstein a7f6b58d0d git/serve: don't show progress when not interactive
this prevents console spam
2021-10-24 01:36:46 +00:00
Ori Bernstein 4c7745b202 acmed: import acme (RFC8555) client 2021-10-15 00:32:32 +00:00
cinap_lenrek b3c3c3e63d cc: do not expand function-like macros for non-function invocations
It is a bit of a annoyance that kenc will try to expand
function like macros on any symbol with the same name
and then complain when it doesnt see the '(' in the
invocation.

test case below:

void
foo(int)
{
}

struct Bar
{
	int	baz;	/* <- should not conflict */
};

void
main(void)
{
	baz(123);
}
2021-10-12 03:06:20 +00:00
Igor Böhm 24bd67f990 acme: remove superfluous print arguments (patch from plan9port) 2021-10-05 09:40:30 +00:00
Igor Böhm a73f41bf4e sam: fix spurious overwrite message (patch from plan9port)
Fixes:

% sam -d
 -.
w /tmp/foo
/tmp/foo: (new file) #0
w /tmp/foo
?warning: write might change good version of `/tmp/foo'
2021-10-05 09:27:45 +00:00
Igor Böhm 659496081e tweak: add missing return to fix double close(…) on file descriptor…
… and avoid printing conflicting messages.
2021-10-06 13:37:39 +00:00
james palmer a13c5c3dda realemu: fix typo in usage message. 2021-10-11 18:26:14 +00:00
risto.salminen@gmx.com d280f411f6 upas/fs: add missing newline to a debug print
Noticed while doing some debugging.
2021-10-09 10:53:39 +00:00
james palmer a8ad3fb3d0 acme: don't let tag button draw over tag border. 2021-10-06 09:19:58 +00:00
Igor Böhm b638114186 vncv: enable connecting to Darwin hosts
Tested on MacOS Catalina and Big Sur releases.

Update man page to highlight weak encryption of vnc, recommending to
tunnel via ssh (thanks unobe).
2021-09-25 20:40:47 +00:00
Sigrid Solveig Haflínudóttir bd63aeb60d libtags: opus: fix duration on truncated files 2021-09-28 01:17:10 +00:00
Noam Preil df25039bb3 venti: fix fprint format string 2021-09-27 04:19:00 +00:00
Ori Bernstein 235ef367d7 vmx: update openbsd kernel heuristics
in OpenBSD 6.9 and up, the kernel (bsd, bsd.mp) still has
the ostype symbols, but bsd.rd appears to have lost them,
even when decompressed.

so, as a result, we should use what we have, which isn't
much.
2021-09-25 16:57:58 +00:00
Ori Bernstein 8f4842d346 git: when stealing from the old packs list, keep what we stole.
we were missing a return after stealing, which killed the point
of doing the theft.
2021-09-14 16:13:58 +00:00
Ori Bernstein c7dcc82b0b git/query: fix spurious merge requests
Due to the way LCA is defined, a using a strict LCA
on a graph like this:

 <--a--b--c--d--e--f--g
     \               /
       +-----h-------

can lead to spurious requests to merge. This happens
because 'lca(b, g)' would return 'a', since it can be
reached in one step from 'b', and 2 steps from 'g', while
reaching 'b' from 'a' would be a longer path.

As a result, we need to implement an lca variant that
returns the starting node if one is reachable from the
other, even if it's already found the technically correct
least common ancestor.

This replaces our LCA algorithm with one based on the
painting we do while finding a twixt, making it give
the resutls we want.
git/query: fix spurious merge requests

Due to the way LCA is defined, a using a strict LCA
on a graph like this:

 <--a--b--c--d--e--f--g
     \               /
       +-----h-------

can lead to spurious requests to merge. This happens
because 'lca(b, g)' would return 'a', since it can be
reached in one step from 'b', and 2 steps from 'g', while
reaching 'b' from 'a' would be a longer path.

As a result, we need to implement an lca variant that
returns the starting node if one is reachable from the
other, even if it's already found the technically correct
least common ancestor.

This replaces our LCA algorithm with one based on the
painting we do while finding a twixt.
2021-09-11 17:46:26 +00:00
qwx e279699344 plumber: remove $plumbsrv, add optional srvname, usage check
Plumber both posts a service to /srv and sets a $plumbsrv environment
variable.  Our libplumb no longer uses $plumbsrv and nothing else
does.  It's a silly hack;  rc doesn't update /env immediately, and
scripts, which for instance set up subrios, cannot rely on it to
clean up the plumber at the end.

Instead, add the option to specify a srvname, actually check for some
common errors and print a usage string.

Thanks to Ori for input and a preliminary patch.
2021-09-10 21:03:47 +00:00
cinap_lenrek df66e62842 ndb/dns: make dblookup() consistent with cachedb operation, bring back txtrr for compatibility
- enforce same behaviour as cachedb server in dblookup():
	- force Taaaa record type on ipv6= attributes, regardless of value
	- return Taaaa records for ip= attributes containing ipv6 values
	- return Ta records only for ip= attributes containing ipv4 values

- for compatibility, bring back support for txtrr= type, but handle consistently
2021-09-08 17:34:04 +00:00
cinap_lenrek 1299ea4d89 ndb/dnsdebug: make usage flags consistent 2021-09-08 17:26:31 +00:00
Ori Bernstein 7ea6821a83 rc: revert 2f8a59f4b5
this patch doesn't pull its weight; it's not worth it.
2021-09-08 14:24:25 +00:00
cinap_lenrek 41369692bf ndb/dns: fix wrong ndb attribute "txtrr" vs. "txt" for caching server 2021-09-08 13:34:23 +00:00
Ori Bernstein d9564c0642 git: separate author and committer
Git has the ability to track the person who
creates a commit separately from the person
who wrote the commit. For git9, we ignored
this feature.

However, as we start using git/import more,
it will be useful to figure out who imported
a commit, as well as who wrote it.

This change adds support for seeing this
information in git, as well as setting the
author and committer separately in git/import.
2021-09-03 02:47:18 +00:00
Amavect 485b334608 cmd/mkfile: major cleanup
Target generation is revised, split into $YTARG and $TARG.
$PROGS is inlined to the cmd target.
%.cpus is added to allow chaining: mk all.cpus
$POWERLESS is added, since dtracy doesn't build yet on ppc.
$DIRS regexp is simplified, simplifing $NOMK.
$cpuobjtype is replaced with cp's recipe for copying itself on $cputype.
$APEDIRS is removed.
The none target is renamed to usage, since it prints out usage.
The ape target is removed.
The dirs target is replaced by all.dirs
%.directories is replaced by %.dirs
The all target serializes directories after cmds to match the install target recipe.
All regexp rules are replaced with nonregexp versions for clarity.
The &:n: rule is removed. Just build the $O.$cmd file.
.y files now build .c files, not .tab.c files, and remove (bc|units|mpc|pc).c:R:
All safeinstall rules are removed.
The cleanfiles rule is renamed to cleancmds and simplified.
%.clean is removed. Just use mk cleancmds.
The install rule serializes cp and yacc before building anything else, avoiding races.
The installall recipe is simplified with the install.cpus prereq.
%.installall is removed. Just use mk $cmd.install.cpus
The $O.cj, %.update, and compilers rules are removed.
2021-08-28 13:15:02 +00:00
kemal 1a444750d6 ssh: use RSA/SHA-256 instead of RSA/SHA-1 as the public key algorithm
openssh now disables RSA/SHA-1 by default, so using RSA/SHA-1 will
eventually cause us problems:

https://undeadly.org/cgi?action=article;sid=20210830113413

in addition, github will disable RSA/SHA-1 for recently added RSA keys:

https://github.blog/2021-09-01-improving-git-protocol-security-github/

this patch modifies ssh.c to use RSA/SHA-256 (aka rsa-sha2-256)
instead of RSA/SHA-1 (aka ssh-rsa) as the public key algorithm.

NOTE: public rsa keys and thumbprints are ***NOT AFFECTED***
by this patch.

while we're here, remove the workaround for github.com. it seems
that github has fixed their implementation, and does not look into
macalgs when we're using an aead cipher.
---
2021-09-02 13:28:48 +00:00
cinap_lenrek 6c94627105 vga: add eeepc1005ha graphics (thanks Andrew Eggenberger)
> This patch enables use of the igfx controller rather than vesa on the
> eeepc1005ha netbook. This means using the full screen resolution of
> 1024x600.

> *Andrew Eggenberger*
2021-08-31 15:53:37 +00:00
Ori Bernstein 0741147eab git/serve: add a '\n' after HEAD
Per the docs:

	the sender SHOULD include a LF, but the
	receiver MUST NOT complain if it is not
	present.

I typoed away the SHOULD, and got missed the
MUST NOT.

thanks qbit.
2021-08-25 22:15:34 +00:00
Ori Bernstein 9ca6ca345f git/compat: add support for ls-remote [-d]
This is used by 'go get' sometimes, so add it.
2021-08-25 02:24:15 +00:00
Ori Bernstein fb2e0a1987 git/diff: clean up diffs
We were overzealous about showing the changed
header, as well as setting a junk variable for
files that didn't exist; fix both.
2021-08-23 01:22:04 +00:00
Ori Bernstein 9a69a2bf2a git/commit: remove trailing 'subst -g'
the subst utility no longer supports a '-g'
flag, but this was left behind in commit;

this means that the lines listing modified
files were not correctly commented in the
commit header.

This is mostly harmless, but when using an
editor like sam to edit the commit message,
the modified lines would have to be removed
manually.
2021-08-23 00:22:04 +00:00
ori@eigenstate.org abe0534492 git/{diff,import}: make it easier to handle manually-asembled patch emails
Often, people (including myself) will write emails that
can almost be applied with git/import.  This changes
git/diff and git/import so that things will generally
work even when assembling diffs by hand:

1.	git/import becomes slightly more lax:

		^diff ...
		^--- ...

	will both be detected as the start of a patch.

2.  git/diff produces the same format of diff
	as git/export, starting with paths:

		--- a/path/to/file
		+++	b/path/to/file

	which means that the 'ape/patch -p1' used
	within git/import will just work.

So with this, if you send an email to the mailing list,
write up a committable description, and append the
output of git/diff to the end of the email, git/import
should just work.

[this patch was send through the mailing list using the
above procedure, and will be committed with git/import
to verify that it works as advertised]
2021-08-22 17:18:35 +00:00
amavect 0f58e47551 exportfs, oexportfs, iostats: make -d log to stderr
exportfs -d logs 9p traffic to /tmp/exportdb.
-f allows writing to a different file.
exportfs silently continues if it doesn't have
permissions to create or write to /tmp/exportdb.
These are poor behaviors.

A better default is to write to stderr, since it
is 9P debug info that is better immediately printed,
and not user info that is better handled by syslog().
As a result, -f is obsolete and thus removed.
Redirect responsibility is now on rc.
As a side effect, rc will fail if it doesn't
have permissions to write.

exportfs(4) is updated to reflect all changes
and with a better Synopsis.

oexportfs is changed to match exportfs.
oexportfs(4) is updated to reflect all changes.
The Synopsis is not changed due to the number of flags.

Removed -f from iostats.
iostats(4) is updated to reflect all changes.
---
2021-08-18 17:51:40 +00:00
Noam Preil 2eadf1fa17 venti: fix memory layers 2021-07-21 05:06:05 +00:00
Sigrid Solveig Haflínudóttir 82c7251dc3 mixfs: add reading (audio loopback) 2021-08-21 22:51:11 +00:00
cinap_lenrek 7fd9be0f08 snoopy: ... and fix the memory leak for new dns rr types 2021-08-18 19:37:44 +00:00
cinap_lenrek 97c6a1dd52 snoopy: fix dns nil pointer crashes when formating dns packets (thanks sl)
snoopy shares ndb/dns's dns parser code, but has its own
copy of rralloc() function, which is responsible to allocating
auxiolary data structures on an RR depending on the type.

ndb/dns gained some support for some new types, but snoopy's
copy of rralloc() was not updated, resulting the auxiolary
structures to be nil, and the shared parsing routines crashes
when trying to dereference them.

this just syncs the copies, we might consider moving rralloc()
into its own file so it can be completely shared.
2021-08-18 17:59:50 +00:00
Ori Bernstein b0ae37013c exportfs: revert e524e8d65a
It turns out that the '-f' flag was being used, and removing
it broke things.
2021-08-18 14:44:29 +00:00
Ori Bernstein cfebf83947 git: better handling of absolute paths, regex metachars
Git currently gets a bit confused if you try to
manipulate files by absolute path.  There were also a
number of places where user-controlled file paths ended
up getting passed to regex interpretation, which could
confuse things.

This change mainly does 2 things:

	- Adds a 'drop' function which drops
	  a non-regex prefix from a string, and uses
	  that to manipulate paths, simplifies 'subst',
	  and removes 'subst -g', which was only used
	  with fixed regexes; sed does this job fine.
	- When getting a path from a user, we
	  make it absolute and then strip out the head

Along the way it cleans up a couple of stupids:

	- 'for(f in $list) if(! ~ $#f 0) use $f:
	  $f can't be a nil list because of
	  list flattening.
	- removes a useless substitution here:

	 	all=`$nl{{git/query -c $1 $2; git/query -c $2 $3} | sed 's/^..//' | \
			gsubst '^('$ourbr'|'$basebr'|'$theirbr')/*' | sort | uniq}

	  where git/query -c doesn't produce
	  paths prefixed with the query.
2021-08-17 04:31:15 +00:00
amavect e524e8d65a exportfs: make -d log to stderr
exportfs -d logs 9p traffic to /tmp/exportdb.
-f allows writing to a different file.
exportfs silently continues if it doesn't have
permissions to create or write to /tmp/exportdb.
These are poor behaviors.

A better default is to write to stderr, since it
is 9P debug info that is better immediately printed,
and not user info that is better handled by syslog().
As a result, -f is obsolete and thus removed.
Redirect responsibility is now on rc.
As a side effect, rc will fail if it doesn't
have permissions to write.

exportfs(4) is updated to reflect all changes
and with a better Synopsis.
2021-08-14 19:50:23 +00:00
cinap_lenrek 913fdf2497 tinc: fix spelling and update manpage (thanks unobe)
Update tinc(8) man page to:
    1.  state the implementation aligns with 1.0.36 of tinc.org;
    2.  use same hostname as mentioned in usage line.
  Fix typos in tinc.c.
2021-08-15 09:54:09 +00:00
Ori Bernstein da085a2d4c git/branch: make '-n' use HEAD when '-b' unspecified
This brings the behavior in line with the manual page,
and makes things less surprising for users.
2021-08-13 05:16:50 +00:00
Ori Bernstein 2af46e406b date: remove '-m' flag
It's only ever been used by git, and is obsoleted
by 'date -f'. Remove it.
2021-08-13 01:27:17 +00:00
Ori Bernstein 758067ee56 git/export: use 'date -f' instead of 'date -m'
The '-m' flag was added to date largely
to support git scripts. It predates the
tmdate code, which is why it exists, but
it's a recent enough addition that nothing
I'm aware of uses it, other than git.

As a result, it would be good to remove
it, so let's do that.
2021-08-12 14:42:47 +00:00
Ori Bernstein 54993a1f5b git: fix non-interruptible temporary warning
harmless, but annoying.
2021-08-11 15:00:48 +00:00
Ori Bernstein 3909b83a90 git/save: leave submodules unmangled
When modifying a submodule, we would garble the
mode, leading to an apparently dangling object.

This fixes the issue.
2021-08-07 18:01:22 +00:00
Jacob Moody 08bcc4bcec aux/cddb: include album name and correct track number key 2021-08-05 15:54:29 +00:00
cinap_lenrek 8820b3d9ea cat: remove stupid long cast 2021-08-04 17:21:54 +00:00
Ori Bernstein 7f832df53d libpanel: rename to match clean rule
when running 'mk clean', we get a stray
libpanel.$O.a, because our 'mk clean'
rule expects libpanel.a$O.

This causes build failures after mk clean
on a symbol change.
2021-08-03 02:10:10 +00:00
cinap_lenrek edfc72b500 [PATCH] Support for igfx on Celeron(R) 2957U (thanks Lorenzo Bivens)
> After some tinkering I managed to get igfx working on this device.
> hw cursor works.
> The only caveat is that I can only get video over hdmi...
> will revisit displayport later
2021-07-31 12:05:29 +00:00
Ori Bernstein 70d173bfa4 git/fetch: be more robust
currently, git/fetch prints the refs
to update before it fully fetches the
pack files; this can lead to updates
to the refs before we're 100% certain
that the objects are present.

This change prints the updates after
the packfile has been successfully
indexed.
2021-07-27 15:05:45 +00:00
cinap_lenrek e4b5f170cf libc: change usize to 64-bit for amd64 and arm64, make memory(2) functions use usize 2021-07-25 15:54:22 +00:00
cinap_lenrek 403149d7de gzip, bzip2: add -n flag to suppress modification timestamp 2021-07-21 17:36:02 +00:00
Jacob Moody 28057f67a0 ssh: fix typo (thanks izaki) 2021-07-21 16:16:29 +00:00
cinap_lenrek 90ce513fb0 merge 2021-07-18 20:21:06 +00:00
cinap_lenrek 187806ad20 screenlock: don't poll to top window (thanks Stuart Morrow)
> String becomes stringbg so we have guaranteed max contrast in case the
> user changes the picture. (If you don't change the picture, it's
> white-on-black-on-black (sic) and you would never notice the change.)
2021-07-18 19:54:58 +00:00
Ori Bernstein 07c32fb3da auth/rsa2jwk: add code to produce jwk rsa keys
This is useful for acmed, and possibly other web
technologies.
2021-07-18 15:30:35 +00:00
Ori Bernstein acc504c319 git/fetch: fix overly eager 's/pack/idx/g' in refactor
This would break pulling. We would try to index into
a place that didn't exist.
2021-07-18 14:59:51 +00:00
Jacob Moody be36c092ac aux/cddb: Provide -e option to print commands to rip audio with tags.
Also parse title/track artist and year.
2021-07-17 18:56:11 +00:00
Ori Bernstein 2204634275 git/fetch: ensure we clean packfiles on failure
When pulling into a git repository that is group
writable as a non-owner, the pack file is left
in place because we do not have permission to
remove it.

We also leave it behind if we bail out early due
to an error, or due to only listing the changes.

This pushes down the creation of the file, and
cleans it up on error.

thanks to Anthony Martin for spotting the bug.
git/fetch: ensure we clean packfiles on failure

When pulling into a git repository that is group
writable as a non-owner, the pack file is left
in place because we do not have permission to
remove it.

We also leave it behind if we bail out early due
to an error, or due to only listing the changes.

This pushes down the creation of the file, and
cleans it up on error.

Also, while we're here, clean up index caching,
and ensure we close the fd in all cases.

thanks to Anthony Martin for spotting the bug.
2021-07-17 00:10:44 +00:00
cinap_lenrek fad1b3f7f7 kbdfs: allow to escape ctlr-alt-del with shift for vmx and vnc. 2021-07-16 23:36:40 +00:00
cinap_lenrek ad37339a1c vmx: reset virtio queue state on device reset
when a virtio device gets reset, we have to also reset the device
shadow indices: availableidx and usedidx. for extra safetly,
we also reset the buffer descriptor table addresses.

this is accomplished by adding a vioqreset(VIOQueue*) function
that brings the queue to its initial reset state.

this fixes non functional ethernet after reboot(8).
2021-07-11 12:12:51 +00:00
Jacob Moody 51a351e845 aux/cddb: freedb.org is dead, use gnudb.org 2021-07-10 15:57:46 +00:00
Ori Bernstein 2f8a59f4b5 rc: add subshell-function syntax
fn foo @{bar} is now equivalent to
fn foo {@{bar}}. As a side effect,
this disallows creating functions
named after keywords without first
quoting them.
2021-07-08 21:35:34 +00:00
kvik a0e65ca075 git: create .git/objects/ on git/init 2021-07-06 16:21:18 +00:00
Sigrid Solveig Haflínudóttir 16da8c0529 vmx: emulate ps/2 intellimouse scrolling 2021-07-06 15:44:16 +00:00
cinap_lenrek 78cf847bfb rsa(8): document auth/x5092pub, fix usage lines 2021-07-04 22:38:22 +00:00
cinap_lenrek 88060e7501 libsec: add X509reqtoRSApub() function and return subject alt names in X509to*pub() name buffer
We need a way to parse a rsa certificate request and return the public
key and subject names. The new function X509reqtoRSApub() works the
same way as X509toRSApub() but on a certificate request.

We also need to support certificates that are valid for multiple domain
names (as tlshand does not support certificate selection). For this
reason, a comma separated list is returned as the certificate subject,
making it symmetric to X509rsareq() handling.

A little helper is provided with this change (auth/x5092pub) that takes
a certificate (or a certificate request when -r flag is provided) and
outputs the RSA public key in plan 9 format appended with the subject
attribute.
2021-07-04 22:00:24 +00:00
Ori Bernstein 7010ad85c5 git/export: make output pipable to /bin/mail
git/export *almost* produces output that can be
emailed with upas using

	git/export $commit | mail maintainer@site.com

but, the

	From: commit-id date

line that git generates trips it up. Luckily,
'git am' doesn't seem to care much if that line
is missing, so we can simply omit it with no issue.
2021-07-04 20:18:37 +00:00
Alex Musolino 2929a3bf67 upas/Mail: avoid showing empty To: and CC: lines in compose windows 2021-06-30 12:23:45 +00:00
Alex Musolino a5c4ac4804 upas/Mail: fix CC addresses in "Reply All" compose windows 2021-06-30 12:22:28 +00:00
Ori Bernstein dd7352fd35 git/revert: revert
the old implementation was correct; we want to
mark it dirty and let walk sort it out.
2021-06-29 20:03:26 +00:00
Ori Bernstein ca6058e0e1 git/revert: fix previous commit (helps if you save the file, thanks qwx)
git/revert: fix previous commit (helps if you save the file, thanks qwx)
2021-06-28 23:40:40 +00:00
Ori Bernstein 682aabf9f6 git/branch: mark files we couldn't update as dirty 2021-06-28 18:28:08 +00:00
Ori Bernstein 819bec22cc vt: allow scrolling with the mouse. 2021-06-26 17:39:13 +00:00
Ori Bernstein b68b3a6e19 vt, ssh: don't send interrupts on window resize
When resizing windows, vt would signal ssh by updating
the window size and sending an interrupt. Ssh reacted
by forwarding both the winch and an interrupt.

This change adds a WINCH generation counter so that
ssh can differentiate between resizes and interrupts.
If an interrupt comes in, and the WINCH generation
changes, then the interrupt is taken as signalling a
WINCH.
2021-06-26 17:29:27 +00:00
cinap_lenrek 4fd09def0f kencc: revert back to "set but not used"
The change to "assignment not used" breaks symmetry with
"used and not set" and removes the reference to the
specific warning mentioned in /sys/doc/comp.ms.

Also, the patch was half-assed as that it left some typos
in like "used an not set", which this change also fixed.
2021-06-26 13:16:36 +00:00
Ori Bernstein 759aafa007 rc: skip arguments to Xsrcline, Xsrcfile in codefree
We weren't correctly skipping the location operators
in codefree. This would mostly be work, but sometimes
you'd get unlucky and have one of the argmuents mismatch,
and that would lead to an invalid free.

This correctly skips the args in codefree.
2021-06-25 23:10:07 +00:00
Jacob Moody 88a8ca5c8d cc: create .$O files with DMTMP 2021-06-24 13:53:37 +00:00
Ori Bernstein b904edadd8 git/fs: use a better heuristic for permissions.
Since we now store /dist/plan9front in git, the
initial assumption that the owner of the repo
is the person touching it is not always true.

This change gives us a better heuristic for the
file permissions we should have in the files we
copy around, basing it off of the permissions of
the .git directory.
2021-06-22 23:55:54 +00:00
Ori Bernstein 5770332282 rc: correct line numbers
When loading a file using ".", we could
end up with our line numbers thrown off
due to the mutation of lexline. Putting
lexline into the runq beside the file
that we're reading from causes it to get
pushed and popped correctly, so that we
no longer lose track of our location.
2021-06-22 23:40:11 +00:00
Ori Bernstein 214dc1ec6c venti: make error messages consistent, remove duplicate messages.
removes duplicate messaes about restrictions, and duplicate
checks, makes the error match the rest of the errors.
2021-06-21 12:29:52 +00:00
Noam Preil 065cf0b708 venti: warn when opening /dev/swap fails 2021-06-21 03:56:14 +00:00
Noam Preil e7715ce2c6 venti: fix detection of available RAM (fixes -m) 2021-06-21 03:52:09 +00:00
Noam Preil a22697039d venti: inform user when reducing memory consumption 2021-06-21 03:49:42 +00:00
Noam Preil 1a09421f7d kencc: clarify warning for unused assignments 2021-06-21 03:29:58 +00:00
Ori Bernstein 21075859e4 git/revert: handle absolute paths gracefully (thanks deuteron)
when reverting files, absolute paths would get concatenated with
$gitrel; use `cleanname -d` to fix this.
2021-06-21 02:12:58 +00:00
Ori Bernstein eeb0f9a9da git/log: handle absolute paths gracefully.
strip off the repo prefix if the path given
is absolute, and then look up as though it
was rooted in the repo.
2021-06-20 17:07:33 +00:00
cinap_lenrek 57d95c7325 libsec: move zero check to curve25519_dh_finish()
As checking for all zero has to be done in a timing-safe
way to avoid a side channel, it is best todo this here
instead of letting the caller deal with it.

This adds a return type of int to curve25519_dh_finish()
where returning 0 means we got a all zero shared key.

RFC7748 states:

The check for the all-zero value results from the fact
that the X25519 function produces that value if it
operates on an input corresponding to a point with small
order, where the order divides the cofactor of the curve.
2021-06-20 14:41:26 +00:00
kvik 5e098228ac cal: fix days of week alignment for year view (thanks igor@9lab.org)
term% cal -s1 2021
                                  2021

           Jan                    Feb                    Mar
   M Tu  W Th  F Sa Su     M Tu  W Th  F Sa Su     M Tu  W Th  F Sa Su
               1  2  3    1  2  3  4  5  6  7    1  2  3  4  5  6  7
   4  5  6  7  8  9 10    8  9 10 11 12 13 14    8  9 10 11 12 13 14
  11 12 13 14 15 16 17   15 16 17 18 19 20 21   15 16 17 18 19 20 21
  18 19 20 21 22 23 24   22 23 24 25 26 27 28   22 23 24 25 26 27 28
  25 26 27 28 29 30 31                          29 30 31
  …

Note how the days (i.e. ' M Tu  W Th  F Sa Su') for Feb and Mar
do not align with the day numbers.

This is because an extra space is left *before* adding the terminating
'\0' via the pointer `dayw`.

With the patch applied the calendar aligns nicely for the year view:

  term% cal -s1 2021
                                  2021

           Jan                    Feb                    Mar
   M Tu  W Th  F Sa Su    M Tu  W Th  F Sa Su    M Tu  W Th  F Sa Su
               1  2  3    1  2  3  4  5  6  7    1  2  3  4  5  6  7
   4  5  6  7  8  9 10    8  9 10 11 12 13 14    8  9 10 11 12 13 14
  11 12 13 14 15 16 17   15 16 17 18 19 20 21   15 16 17 18 19 20 21
  18 19 20 21 22 23 24   22 23 24 25 26 27 28   22 23 24 25 26 27 28
  25 26 27 28 29 30 31                          29 30 31
  …
2021-06-19 12:00:52 +00:00
Ori Bernstein 1da1ac52d2 git/branch: resolve implicit branch switch before using it
When switching a branch implicitly -- ie, creating a local
branch off of a remote branch -- we would get the list of
changed files before we would resolve the implicit branch
switch, leading to an empty list of changes.
2021-06-16 15:25:02 +00:00
Ori Bernstein 7f697e822b lex: fix uninitialized fds (thanks きゐ) 2021-06-16 00:28:01 +00:00
Anthony Martin 1210b12f28 troff: fix mangled fonts and character files
All of these files appear to have been imported from sources in a
case-insensitive manner and consequently lost their original content.

- Hx, Hb, and Hi fonts should be narrow versions of Helvetica

- c[1-3] fonts should be condensed versions of Century Old Style

- the lH character should be a filled left hand symbol

- the rh character should be a stroked right hand symbol

- the rc character should be the right ceiling symbol

I've verified that these are the only files that collide with others
when ignoring case (aside from rc/bin/[Kk]ill but those are correct).
2021-06-15 16:13:59 +00:00
Ori Bernstein 7c3ff53574 git/import: handle mails with line wrapping and mime
git/import expected a patch, however upas/fs serves
either a raw file without any of the mime decoding
and line joining, or a directory, with the headers
and body split out.

This makes it a pain to apply some mails.

So, here we teach git to import upas dirs natively,
making it easy to handle all patches that come in
as emails.
2021-06-15 21:29:22 +00:00
Ori Bernstein a73a964e51 python, hg: tow outside the environment.
they've served us well, and can ride off into the sunset.
2021-06-14 00:00:37 +00:00
Ori Bernstein 8ab397c23c git/push, git/send: get better about erroring out early
git/push died within a subshell, which prevented the
whole program from exiting, and lead to an incorrect
ref update line that confused people.

git/send would eventually error out, but would push
all the data before that happened; this was annoying.
2021-06-13 12:48:49 +00:00
Ori Bernstein 4aef95e205 git/branch: preserve checked in permissions on branch update
we need to copy the files, and we should copy them with the
permissions that exist in the repo.
2021-06-13 01:20:46 +00:00
Fulton Browne 1c30bd451e B, sam: remove sam srv file
No need for 2 programs doing the same job.
2021-06-12 17:20:53 +00:00
Ori Bernstein 73db7a20f7 git/add: clear qid cache as side effect
this is an occasionally useful side effect when
doing surgery on repos, so let's have it.
2021-06-12 14:57:58 +00:00
Ori Bernstein aacf368c6d mothra: read the content-type header over file(1) to determine type (thanks james palmer)
this fixes some pages being classified as xml by file(1),
meaning they would be rendered as plain text rather than as html.
2021-06-12 14:32:16 +00:00
kemal 09b0eb0d1a git/conf: check in /sys/lib/git/config as a fallback to user-wide config 2021-06-08 20:13:57 +00:00
kvik a859d53145 git/revert: fork the namespace before running git/fs 2021-06-08 20:20:06 +00:00
Ori Bernstein 8aa69e55b6 git: avoid uninterruptible temporary warning
dont' fall into the rathole.
2021-06-06 23:50:45 +00:00
Ori Bernstein 8d578014cf rio: match background screen color format (thanks noam) 2021-06-06 22:44:36 +00:00
Ori Bernstein d1d5f21992 distproto: sync with hg 2021-06-06 13:21:53 -04:00
Ori Bernstein ce30e785b1 git/branch: diff clean and dirty lists correctly
no spaces in our lists.
2021-06-06 13:07:51 -04:00
Ori Bernstein fb15534c78 git/branch: revert optimization fully
it doesn't help *that* much, and confuses the code.
2021-06-06 13:07:51 -04:00
Ori Bernstein 78d2064a7c git/branch: somewhere in the syncing, the fix for junk files was lost
bring it back.
2021-06-06 13:07:51 -04:00
Ori Bernstein a2a0717c99 git/send: allow the remote to have refs that we don't
It's not fatal for someone else to push a branch
with objects that we don't have. We should deal
with it gracefully, and act as though it doesn't
exist.
2021-06-06 13:07:51 -04:00
Ori Bernstein 74912993de git/commit: allow passing absolute paths
we would treat paths as relative, and not
step past leading '/'s, leading to an infinte
loop.
2021-06-06 13:07:51 -04:00
glenda 706aad3d94 git/branch: merge correct set of files
we were switching branches before we got the full list
of modified files, which could garble what we were trying
to merge.
2021-06-05 18:50:20 +00:00
Ori Bernstein fd9679d97b git: handle absolute paths better
we were catting $gitrel onto absolute paths. stop it.
2021-06-05 13:40:28 +00:00
Alex Musolino 347b552b18 merge 2021-06-05 01:42:10 +09:30
Alex Musolino 3568348260 upas/Mail: fix bug where Redraw must be executed twice to have an effect
In showlist, call bwindata instead of bwinopen in order to use a
pre-existing fd to write to the data file.  This existing fd will
properly honour any address set by a previous write to the addr file.
Specifically, the redraw function sets addr to "," before calling
showlist in order to overwrite the entire contents of the window.
2021-06-05 01:21:55 +09:30
cinap_lenrek 5a34cc86a8 git: allow local repository directories as remote uri's
This is implemented by checking first if the uri is
a directory containing the .git/ subdirectory.
If this is the case, we fork git/serve serving the
repository on a pipe.
2021-06-04 17:47:26 +02:00
cinap_lenrek 4dd461e440 git/serve: remove undocumented -n namespace option and -r /usr/git default
This makes it easier to serve local repositories where the sandboxing
gets in the way.
2021-06-04 17:44:29 +02:00
Ori Bernstein db5ca0017c git/log: show first commit as file change
We checked if the file was changed from its parents.
If there were no parents, the answer was no, but it
should be yes.
2021-06-03 16:15:16 -07:00
Ori Bernstein b42111117b git/init: create fs dir 2021-05-31 19:30:07 -07:00
Ori Bernstein 1160919f81 git/send: pick minimal delta set correctly (thanks igor)
We weren't giving all objects to the twixt() function, and
it was making bad life choices -- gambling, smoking, drinking,
and packing in too much data.

With more information, it doesn't do the last.
2021-05-31 18:02:23 -07:00
Ori Bernstein f0bb6bbcb7 git/branch: ...all the debug prints. 2021-05-30 19:21:57 -07:00
Ori Bernstein 519ff30098 git/branch: remove debug prints 2021-05-30 19:07:11 -07:00
Ori Bernstein 31fc689ad9 git/branch: reduce execs to sync working dir
We were execing a lot to copy the data -- do less of it.
2021-05-30 19:06:01 -07:00
Ori Bernstein 12e952e684 git/fs: move mount point to $repo/.git/fs
Moving the mount point to within the repo
directory means that we can have multiple
git repos mounted at once with no conflict.
2021-05-30 17:46:21 -07:00
cinap_lenrek 1af2546e96 vac: add -t flag to exclude temporary files and directories (thanks foura) 2021-05-30 14:30:50 +02:00
Sigrid 8ac28a3e21 zuke: treat toggle as play in stopped state 2021-05-28 13:02:58 +02:00
Sigrid e18da032f0 zuke: fix seeking in paused mode 2021-05-27 07:47:10 +02:00
cinap_lenrek d168b89ab1 mkpaqfs(8): allow setting compression level 2021-05-23 17:06:14 +02:00
Ori Bernstein 1ee1bfaa8c git: got git?
Add a snapshot of git9 to 9front.
2021-05-16 18:49:45 -07:00
foura e72da62915 ip/ftpd: Add explict and implicit FTPS support.
Removed:
- Challenge reponse auth.
- Noworld login.
- Anonymous users writing files to /incoming.
2021-05-02 15:29:43 +01:00
james palmer 9633c9fc65 libpanel: fix text sliding around in libpanel text entry widgets. 2021-05-13 21:29:19 +01:00
cinap_lenrek 682414ce0d vmx: fix 9p debug server and make it compatible to /proc
The 9p debug server was broken as it assumed the first
tree file added would have a qid of 0 (it has a qid
of 1 as the root directory is using 0 already).

Instead, just compare File* pointers and get rid of
the table (less code).

When passing 64-bit unsigned addresses as 64-bit signed
file offsets, we have to make sure to not pass negative
offsets (filtered out by kernel and lib9p)!
This is solved by clearing and sign bit in encoding and
63-bit sign extension on decoding.

Make the mem file writable (needed for acid).

The 9p debug server provided a single directory containing
mem and regs files. This patch renames the regs file
(which is in vmx specific text format) to "xregs" and
adds "regs" and "kregs" file which use the same format
as exported by the kernels /proc filesystem.

This allows one to bind the vmx directory over a proc
directory and attach acid to a running system like:

mount -b /srv/vmx /proc/1
acid -k -lkernel 1 /sys/src/9/pc64/9pc64
2021-05-12 18:17:06 +02:00
cinap_lenrek 532c7479e9 vmx: avoid strdup() register names for register cache
If we tokenize the register file contents in a static buffer,
we can avoid having to duplicate the register names.

All callers to rpoke() provide constant register arguments
so they also do not need to be duplicated.
2021-05-12 18:04:25 +02:00
cinap_lenrek 67eac97a81 vmx: implement long mode page table translation
This allows vmx to translate virtual addresses to physical
when the gues runs in long mode.
2021-05-12 18:00:46 +02:00
cinap_lenrek ebaddcf030 merge 2021-05-05 01:51:20 +02:00
cinap_lenrek 7c1e0be919 cpu: properly handle end of file in readstr() 2021-05-05 01:50:09 +02:00
Sigrid 5e81cc48bd libtags: upstream updates 2021-05-03 21:04:39 +02:00
Ori Bernstein b66bffe91c Mail: remove message about cyclic threads
They happen, and we break the cycle. There's nothing
the user can do, so there's no point in warning.
2021-05-01 15:33:31 -04:00
cinap_lenrek ee289c2415 lib9p: remove Srv.srvfd, make postsrv() and threadpostsrv() return the mountable file descriptor, update documentation
Now that we have these new functions,
we can also make them return an error
instead of calling sysfatal() like
postmountsrv().

Remove the confusing Srv.srvfd, as it
is only temporarily used and return
it from postsrv() instead.
2021-05-01 19:58:58 +02:00
Sigrid 013b498314 libtags: use nelem 2021-04-30 12:36:01 +02:00
Sigrid dd86214d77 libtags: trim text tags and ignore empty values 2021-04-30 00:20:39 +02:00
Sigrid e5535fad32 libtags: modules: ignore empty title 2021-04-29 23:35:52 +02:00
Sigrid 7cff84371d libtags: use CP437 as the default encoding for module formats 2021-04-29 21:44:06 +02:00
Sigrid 51ead1072b file: partially revert 8419 to detect <?xml as html 2021-04-25 21:49:01 +02:00
cinap_lenrek 6b4b8e405a rio: avoid re-triggering clicks on resize/hide/unhide and send wctl when focus is lost 2021-04-25 12:41:20 +02:00
cinap_lenrek e0cf0261d0 resample: improve performance (thanks José Miguel Sánchez García)
Resample is well known for taking a long time to resize an image. This
patch brings an important performance boost (in my test image, time
was reduced from ~2850ms to ~500ms). It does that by extracting FP
multiplication and division out of the innermost loop of
resamplex/resampley.

The results differ slightly from the current implementation: in my
test: ~0.3% of the bytes had a ±2 difference in their value, which I
attribute to rounding errors. I'm personally not concerned with that
deviation, given the performance gains. However, I recommend testing
it just to be sure I didn't overlook anything.

José Miguel Sánchez García
2021-04-25 12:16:40 +02:00
Sigrid b0e2ea4e5f libtags, zuke: add *.mod support (thanks kemal) 2021-04-24 16:07:24 +02:00
Sigrid 83277da309 zuke: fix middle-click restarting playback if held while mouse pointer is moving 2021-04-23 11:20:30 +02:00
Sigrid 1919e9183b zuke: fix position formatter using a wrong type 2021-04-22 08:40:50 +02:00
Humm b2ef0ff49d plumber: fix substrings in match rules
Unmatched substrings are nil, so we can't rely on nil terminating the
array of substrings.
2021-04-21 08:28:32 +02:00
Sigrid f5db3bf0e0 nusb/ether: rndis: add standard class code (tested by jmi2k with OnePlus 8) 2021-04-20 18:08:58 +02:00
kemal 2cdc8075f8 file: recognize executable scripts, etc.
The patch does the following:

1. Adds recognition of executable script (shebang) files.
2. Returns correct MIME type for mbox files (RFC 4155).
3. Returns XML instead of HTML type in some cases.
2021-04-20 01:40:31 +02:00
unobe f7ae890ecb patch for imap when imap fails
changeset:   8411:19f6a88ea241
branch:      mbp-2011
user:        Romano <unobe@cpan.org>
date:        Sat Apr 17 14:35:21 2021 -0700
files:       sys/src/cmd/upas/fs/imap.c
description:
When an imap fetch fails, it's helpful at times to know the underlying
cause.  This provides more details by providing the underlying error
message.
2021-04-17 18:52:11 -07:00
Ori Bernstein 9923ea348c Mail: remove impliicit headers (thanks unobe)
Setting headers from Mail can cause conflicts
with the headers that upas/marshal adds when
sending attachments.

So, let's not set them.
2021-04-17 18:46:02 -07:00
Ori Bernstein 0256a34560 acme: fix border size, autoindent undo: imported from plan9port (thanks jxy)
origin:

https://github.com/9fans/plan9port/pull/493
https://github.com/9fans/plan9port/pull/489
https://github.com/9fans/plan9port/pull/461
2021-04-14 20:30:24 -07:00
Sigrid a90a801685 zuke: include libtags in CFLAGS 2021-04-13 15:55:19 +02:00
Sigrid ff220ea29b zuke: remove -G option (old playlists not supported anymore) 2021-04-13 13:28:31 +02:00
Sigrid c6cdee420d audio/: zuke, mkplist, readtags 2021-04-13 13:20:27 +02:00
Ori Bernstein fd4e8eef0b Mail: correctly track the number of messages (thanks igor)
We forgot to update the message count when deleting
messages in mail, meaning we could access trailing
messages that had been freed.
2021-04-12 09:22:48 -07:00
qwx dc8da7c232 crop: allow no-ops for pipelines
unlike other tools like iconv(1), a crop(1) without arguments or with
ones resulting in a no-op, like `-t 0 0', errors out.  other options
like `-i 0' do not error.  this breaks assumptions and results in
tedious intermediary steps or hacks like:

	foo | {crop -t $1 $2 >[2]/null || cat} > baz.bit

instead, just ignore the check.  subsequent code doesn't make
assumptions on that.
2021-04-12 10:29:54 +02:00
cinap_lenrek 5fb37e15b6 ip/tftpd: add a syslog message about what error we return to the client on a NAK 2021-04-11 23:58:30 +02:00
cinap_lenrek a89bee7373 ip/dhcpd: work around raspberry pi pxe firmware by providing dhcp option 66
The raspberry pi 4 PXE firmware insists on finding the tftp
server address by parsing dhcp option 66 as an ip address
string.
2021-04-11 20:20:41 +02:00
cinap_lenrek d9bf5d074d ip/ipconfig: ODtftpserver (dhcp option 66) is of type string 2021-04-11 20:18:03 +02:00
Humm 50d23b6acc page: fix for kerTeX dvi 2021-04-09 16:40:56 +02:00
Humm d6ce7969ed disk/fdisk: add OpenBSD partition type 2021-04-09 16:11:48 +02:00
Humm fe1c8010de printfont: load all fonts for printfont all 2021-04-09 16:09:31 +02:00
Humm a0997f38c4 trofftable.rc: make work 2021-04-09 16:05:30 +02:00
Stephen Gregoratto 4c981d440d [9front] walk: properly format permissions
This patch adds dirmodefmt from fcall.h to pretty-print file
permissions, similarly to ls -l. I didn't notice any performance
degradation.

I hope no-one relied on the old behaviour.
2021-04-06 14:43:38 +02:00
cinap_lenrek d41c867696 file: detect webp files (thanks kemal)
this patch adds a small check to the "iff" function, so this
way file can detect webp files. tested with a webp file i
found randomly.
2021-04-03 19:32:47 +02:00
cinap_lenrek afa5800b5b acme: fix suicide *and* resource leak in ecmd.c (thanks igor)
To reproduce the suicide try running the following in acme:

• 'Edit B <ls lib'

by select and middle clicking in a window that is in your $home.

There is a very high chance acme will commit suicide like this:

<snip>
cpu% broke
echo kill>/proc/333310/ctl # acme
cpu% acid 333310
/proc/333310/text:amd64 plan 9 executable
/sys/lib/acid/port
/sys/lib/acid/amd64
acid: lstk()
edittext(nr=0x31,q=0x0,r=0x45aa10)+0x8 /sys/src/cmd/acme/ecmd.c:135
xfidwrite(x=0x461230)+0x28a /sys/src/cmd/acme/xfid.c:479
        w=0x0
        qid=0x5
        fc=0x461390
        t=0x1
        nr=0x100000031
        r=0x45aa10
        eval=0x3100000000
        a=0x405621
        nb=0x500000001
        err=0x419310
        q0=0x100000000
        tq0=0x80
        tq1=0x8000000000
        buf=0x41e8d800000000
xfidctl(arg=0x461230)+0x35 /sys/src/cmd/acme/xfid.c:52
        x=0x461230
launcheramd64(arg=0x461230,f=0x22357e)+0x10 /sys/src/libthread/amd64.c:11
0xfefefefefefefefe ?file?:0
</snap>

The suicide issue is caused by the following chain of events:

• /sys/src/cmd/acme/ecmd.c:/^edittext is called at
/sys/src/cmd/acme/xfid.c:479 passing nil as its first parameter:

<snip>
...
        case QWeditout:
                r = fullrunewrite(x, &nr);
                if(w)
                        err = edittext(w, w->wrselrange.q1, r, nr);
                else
                        err = edittext(nil, 0, r, nr);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
</snap>

...and /sys/src/cmd/acme/ecmd.c:/^edittext dereferences the
first parameter that is *nil* at the first statement:

<snip>
char*
edittext(Window *w, int q, Rune *r, int nr)
{
        File *f;

        f = w->body.file;
^^^^^^^^^^^^^^^^^^^^^
This will crash if 'w' is *nil*

        switch(editing){
...
</snap>

Moving the the derefernce of 'w' into the case where it is
needed (see above patch) fixes the suicude.

The memory leak is fixed in /sys/src/cmd/acme/ecmd.c:/^filelist.  The
current implementation of filelist(...) breaks its contract with its
caller, thereby leading to a memory leak in /sys/src/cmd/acme/ecmd.c:/^B_cmd
and /sys/src/cmd/acme/ecmd.c:/^D_cmd.

The contract /sys/src/cmd/acme/ecmd.c:/^filelist seems to have with
its callers is that in case of success it fills up a 'collection' that
callers can then clear with a call to clearcollection(...).

The fix above honours this contract and thereby removes the leak.

After you apply the patch the following two tests should succeed:

• Execute by select and middle click in a Tag:
        'Edit B lib/profile'

• Execute by select and middle click in a Tag:
        'Edit B <ls lib'

The former lead to a resource leak that is now fixed.

The latter lead to a suicide that is now fixed by moving the statement
that dereferences the parameter to the location where it is needed,
which is not the path used in the case of 'Edit B <ls'.

Cheers,
Igor
2021-04-02 15:51:15 +02:00
Romano a398a09783 [9front] [patch] nusb/ether -t rndis 2021-04-01 12:54:08 +02:00