Commit graph

3571 commits

Author SHA1 Message Date
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
cinap_lenrek 9de5aac7a2 5c, 6c, 7c, 8c, kc, qc, vc: use explicit gmove(... , nn) in cgen() for result of OAS*, OPREINC, OPOSTINC
The expression value of the assignment operation was
returned implicitely by relying on regalloc() on the
right hand side "nod" borrowing the register from nn.

But this only works if nn is a register.

In case of 6c, it can also be a ONAME from a .safe
rathole returned by regsalloc().

This change adds explicit gmove() calls to assign the
expression value. Note that gmove() checks if source
and destination are the same register so it wont emit
redundant move operations in the common case.

The same is applied also to OPREINC and OPOSTINC operations.
2021-03-13 13:56:40 +01:00
rgl 2fc22d067d correct off-by-one nul termination. 2021-03-11 19:37:44 +01:00
Ori Bernstein 9162533526 Mail: separate deletion from relinking messages
Mutating lists that are being iterated is needlessly error
prone, and we were removing the wrong message in some cases
if it the dummy got inserted in the right place.

Separating deletion into a redraw/relink and zap phase
simplifies the problem.
2021-03-10 16:49:17 -08:00
cinap_lenrek b5783b1e39 rio: make window focus changes deterministic, cleanup wind.c
Switching window focus used to be non deterministic
as the current window in focus (Window *input) was set
concurrently while processing window messages such as
Resized and Topped.

This implements a new approach where wcurrent() and
wuncurrent() are responsible for the synchronization
and switch of the input.

It is implemented by sending a Repaint message to the
old input window first, neccesarily waiting until that
window releases the focus and then input is updated
and then a Topped or Reshaped message is send to the
new input window.

Note, that when the whole screen is resized that no
input changes need to happening anymore.
2021-03-07 20:26:30 +01:00
Sigrid 5ac3fa0257 mothra: "d": use lite version, disable redirect 2021-03-02 08:41:02 +01:00
Sigrid 2aba7615af mothra: add "d" command to search for a text on the internet (using duckduckgo) 2021-03-02 08:21:56 +01:00
Ori Bernstein f234b29c7f Mail: revert 096538d64724 2021-03-01 19:23:13 -08:00
Ori Bernstein 3555843110 Mail: fix infinite deletion loop
When deleting messages that came in just
the right order, we would end up stuck in
a loop deleting and reinserting a dummy
parent, rather than the messages we wanted
to remove.
2021-02-28 16:36:42 -08:00
cinap_lenrek 51f4f46ae0 ramfs: fix truncfile() for non multiple of extend size (64k)
The calculation of the last block size is wrong and we can
only shrink the size of the last data block, not extend it.
2021-02-27 15:08:34 +01:00
Sigrid 692919521c vmx: reduce cpu load by eliminating nop-loop
Sacrifice some of the sub-millisecond timer precision in favor of less
cpu load when the timer is about to be kicked a bit early.  Result is
visible *especially* when the guest idling.

Timer proc *still* has to send to the channel (in order to kick PIT
and RTC logic), which takes time, and compensates a bit for possibly
early runs.
2021-02-23 15:54:09 +01:00
Sigrid 007d42e741 html2ms: 0xFFFD → Runeerror 2021-02-23 08:52:59 +01:00
cinap_lenrek 27ad886c95 ip/tftpd: add -n namespace-file flag (thanks sam-d)
tftpd currently unconditionally sets its namespace via /lib/namespace
(newns("none", nil)), which stymied my attempts to pxe boot the
openbsd installer without creating a real /etc dir on 9front, which
would've been gross.

I tried working around this with -h (and -r for good measure), but
again hit issues because the namespace is rebuilt from scratch -- any
binds of /386, /amd64, /cfg/pxe, etc. into the tftp-specific directory
disappeared from tftpd's namespace and rendered my *9front* boxes
unable to boot. I could maintain copies of the needed files in the
tftp-specific directory, but that'd be kind of a drag.

The following patch adds a -n flag to allow the specification of a
namespace file in place of /lib/namespace; similar to ip/ftpd.

I thought about setting up a /lib/namespace.tftp to act as a default
rather than continuing to use /lib/namespace by default (which
security-wise is about the same as allowing 9p mounts by user none,
which I also have disabled), but I had trouble coming up with a sane
default. Maybe someone more experienced would like to try that out.

- sam-d
2021-02-23 01:47:33 +01:00
cinap_lenrek a96cf495fa ip/tftpd: use procsetuser() instead of writing #c/user 2021-02-23 01:41:09 +01:00
Ori Bernstein f3a05b16ad upas/send: add \n to error in refuse() (thanks josuah) 2021-02-20 15:25:25 -08:00
Ori Bernstein 2d13ac5d39 marshal: remove debug junk.
Oops.
2021-02-20 13:03:35 -08:00
Ori Bernstein fb88cab9ff upas/marshal: use login instead of user (thanks sirjofri)
User is the upasname, and is unlikely to exist when we save
the message to the outbox. We should use the login name instead.
2021-02-20 13:01:48 -08:00
Ori Bernstein 245264e371 upas/marshal: handle nonexistent save folder correctly (thanks sirjofri)
When the save folder did not exist, and we could not create
it, we would handle up to one Biobuf worth of message, and
then fail, due to a failed tee. The sequence of events leading
up to this was:

	openfolder() -> error
	tee(0, fd, -1) -> wait for read
	write(0, data) ->
		write(fd, data) -> ok
		write(-1, data) -> error, tee terminates
	write(0, attachment) -> error

This change prevents us from writing to a closed fd, and
therefore from erroring out when sending.

We also warn the user.
2021-02-20 12:49:03 -08:00
sl 4bbb3b0b21 /sys/src/cmd/ndb/dns.h:
---

To: 9front@9front.org
Date: Sun, 07 Feb 2021 14:56:39 +0100
From: kvik@a-b.xyz
Subject: Re: [9front] transient dns errors cause smtp failure
Reply-To: 9front@9front.org

I think I found a reason for DNS failing on known good domains.

/sys/src/cmd/ndb/dns.h:156,157
	/* tune; was 60*1000; keep it short */
	Maxreqtm=	8*1000,	/* max. ms to process a request */

So, 8 seconds is how much the resolver will bother with a request it
has been handed, before dropping it on the floor with little
explanation.

It seems quite possible that this is too short a timeout on a machine
during a spam queue run, which predictably stresses the compute and
network resources.

In turn, negative response caching might explain why a particular
unlucky domain would basically stop receiveing any mail for a while.

I'm dying to know if bumping this limit would clear up the queue of
such DNS errors.

---

[narrator: it did.]
2021-02-19 21:29:55 -05:00
sl 29e8ea26f2 sam/{address.c, sam.h}: bump STRSIZE to 512MB (thanks, Ori_B) 2021-02-19 21:15:15 -05:00
Sigrid ca1542a199 audio/flacenc: fix usage 2021-02-18 15:13:25 +01:00
Sigrid 79cf39c53a mothra: tune up entry control logic for easier text editing 2021-02-16 22:04:50 +01:00
cinap_lenrek b5690a5ae7 ndb/dns: implement RFC6844 certificate authority authorization record type 2021-02-14 14:25:41 +01:00
Michael Forney 5fd4fa912e [9front] audio/flacenc: fix error check for fseeko
fseeko returns 0 on success, not the new stream position.

This allows flacenc to update the streaminfo block when it is finished
(for example to set the number of samples and checksum).
2021-02-11 09:37:36 +01:00
cinap_lenrek 2f28aaac65 nusb: don't create rw iso endpoints (by Michael Forney)
There may be two iso endpoints with the same ID if it is asynchronous
or adaptive (one for data, one for feedback), and rw iso endpoints are
unusable (error out with "iso i/o is half-duplex").
2021-02-10 20:08:13 +01:00
cinap_lenrek d7ade692c8 nusb: don't create rw iso endpoints (by Michael Forney)
There may be two iso endpoints with the same ID if it is asynchronous
or adaptive (one for data, one for feedback), and rw iso endpoints are
unusable (error out with "iso i/o is half-duplex").
2021-02-10 19:52:00 +01:00
Michael Forney 29fbba7b6d [9front] upas/vf: exclude mime boundary from temporary attachment files
validateattachment has no business with the mime boundary; it is not
part of the attachment itself.

Also, it causes the boundary to be dropped in the message output from
upas/vf, effectively dropping the following attachment (though the
content is still present after the last boundary of the wrapped first
attachment part).

Consider the following sequence of events:
1. upas/vf is run on a message containing two attachments.
2. The first attachment does not have a known extension, so is saved
   to a temporary file *including* the following mime boundary.
3. This file is opened as p->tmpbuf, which is used for subsequent
   reads until switching back to stdin.
4. The attachment fails validateattachment, so upas/vf wraps it in a
   multipart with a warning message.
5. problemchild() calls passbody(p, 0), which copies from p->tmpbuf
   until it hits the outer boundary line, which it excludes, seeks
   back one line, then returns the outer multipart.
6. problemchild() then writes its own boundary, and then copies one
   line from *stdin* to stdout, expecting the outer boundary.
   However, this boundary was already read from stdin in 2, so it ends
   up reading the first line of the subsequent part instead.

To fix this, pass 0 to passbody() in save() to exclude it from the
attachment file and make it available in stdin when expected.
2021-02-08 20:59:01 -08:00
Ori Bernstein 491fe25158 Mail: correct rendering of nested multipart messages
Reading nested subparts of messages into the root
message array allows deeply nested multipart trees
of messages to show correctly in the message view.
2021-02-07 20:30:04 -08:00
Michael Forney e20dcb151a [9front] upas/vf: remove debugging print statements
These messages aren't useful and were presumably left over from
someone debugging this code.
2021-02-07 20:17:06 -08:00
Michael Forney 827bf1b7da [9front] upas/vf: install %τ format specifier
upas/vf was converted to use tmdate, but the formatter was never
installed.  This caused it to send attachments to validateattachment
with header `From virusfilter %τ%`, which always failed since upas/fs
would just skip over the message.
2021-02-07 08:02:36 -08:00
Alex Musolino b562b269ce test: fix expression parser
The old parser code was rubbish and only worked for trivial
expressions.  The new code properly handles complex expressions,
including short circuit evaluation.

As such, the BUGS section has been removed from the test(1) man page.
The description of an unimplemented feature has also been removed.
2021-02-06 15:51:09 +10:30
Ori Bernstein 101312c1d7 mklib, upas/common: clean up libcommon properly (thanks mikan)
Despite pervious efforts, mk clean still doesn't remove libcommon.a*
files from cmd/upas/common/. To fix this, let's tell cmd/mklib to do
the job instead.
2021-02-03 08:10:11 -08:00
cinap_lenrek 01ab07ef72 acme: fix use after free in warning() call (thanks igor) 2021-02-03 01:19:19 +01:00
Ori Bernstein 3c1022a3de merge 2021-02-02 07:21:47 -08:00
Ori Bernstein 49d7ca8d92 runq: clean up code, fix error handling.
Runq spawns a number of processes, and wait()s for them
in 2 different places. Because of the way that the exit
handling is done, the wait can get the wrong message.

It turns out that only one place in the code needs to
wait for the child, and in all other cases, it's just
muddling the problem.

This change adds the RFNOWAIT call to all the processes
we don't need to wait for, so that the places that do
need wait will always get the correct child.
2021-02-02 06:52:00 -08:00
Sigrid bd78bad3c7 winwatch: always reflow when possible (thanks telephil9) 2021-02-02 11:56:45 +01:00
Ori Bernstein 34ed7f7aa2 Mail: only clear upas-maintained flags on change (thanks deuteron)
When message flags change, Mail would clear all the flags and
recompute them. This would clobber internal flags like Ftodel.
So, don't do that.
2021-02-01 20:38:40 -08:00
Ori Bernstein c20f68f801 mothra: don't insert newline after div (thanks phil9) 2021-01-31 12:25:03 -08:00
Ori Bernstein 273c4bff7a Mail: fix inverted reply-all condition 2021-01-29 18:29:01 -08:00
Ori Bernstein bee6271ae1 Mail: rewrite.
Acme mail made it hard to do threading, so I wrote a new one.
2021-01-29 17:34:47 -08:00
Ori Bernstein 319e625be0 screenlock: use initdisplay(2), top the window (thanks stuart morrow)
Screenlock should use libdraw(2) to init the display
and create the window, instead of looking at the screen
file directly. Also, to prevent new windows from popping
up over screenlock, bring it to the top periodically.
2021-01-28 18:07:48 -08:00
Ori Bernstein a5517fca5f news: make -a and -n get along (thanks lyndon)
currently, -a and -n are mutually exclusive.
this change allows them to be used together.
2021-01-26 18:07:04 -08:00
Ori Bernstein 21e5726f43 cc: mk clean should delete cc.a$O
It's surprising when 'mk clean' doesn't actually
do a clean build in cc -- fix this.
2021-01-24 09:58:39 -08:00
Ori Bernstein 5b8b5884f4 5l: fix shifts by zero
on arm32, we can do one of 4 shifts
by a constant:

	reg<<(0..31)
	reg>>(1..32)
	((u32int)reg)>>(1..32)
	reg ROT (0..31)

There's no way to encode a 0 bit right
shift,  so when encoding reg>>0, flip
it to the equivalent nop reg<<0, which
can be encoded.
2021-01-23 20:36:09 -08:00
Michael Forney 988bdd05a3 [9front] ape: remove _SUSV2_SOURCE guard from inttypes.h
inttypes.h was added to C99, and this is the only header that used
_SUSV2_SOURCE.

Also, remove now unneeded _SUSV2_SOURCE from python mkfile.
2021-01-23 19:47:12 -08:00
Michael Forney e8b8cec9c7 [9front] cc: fix comparison warning with constant LHS
This prevents an incorrect warning for a comparison such as `0 < x`,
where x is an unsigned type.  Previously, this would get normalized as
`x >= 0` rather than `x > 0` when checking the comparison.
2021-01-23 18:28:08 -08:00
Michael Forney a8834acf73 [9front] cc: remove unnecessary 128-bit add function
Instead, just change the comparisons from <=/>= to </>.
2021-01-23 18:26:34 -08:00
Ori Bernstein ed2b1d5c61 upas/fs: fix swapped argument, dead code
With ntlm auth, we were trying to set 0 bytes of
the auth struct to its size. The args were clearly
swapped. Fix it.

While we're here, remove some dead code.
2021-01-23 18:02:46 -08:00
Ori Bernstein f164ee6dd9 upas/runq: fix typo
one slipped in to the last commit.
2021-01-23 16:38:32 -08:00
Ori Bernstein 51319cc5b5 upas/runq: bring back -a
Turns out -a is useful in crontab, so bring
back a simplified version of it. This only
iterates through directories one at a time.
2021-01-23 16:05:21 -08:00
Ori Bernstein bd5af0df5d vnc: I don't like your face.
Cosmetic improvements to vnc auth code.
Should not have user-visible changes.
2021-01-23 13:20:09 -08:00
Ori Bernstein f321298c55 upas/runq: support parallel queue processing, drop -a
When running a mail queue, it's useful to run it with limited
parallelism. This helps mailing lists process messages in a
reasonable time.

At the same time, we can remove the load balancing from runq,
since the kinds of systems that this matters on no longer
exist, and running multiple queues at once can be better
done through xargs.
2021-01-23 11:03:05 -08:00
cinap_lenrek b5c7158f39 syscall: don't rely on . being in $path (thanks Silas) 2021-01-23 15:06:30 +01:00
Sigrid a9e70446a0 nusb/kb: correct Mod4 scancode (125 → 91, to match what kbdfs has) 2021-01-22 17:48:41 +01:00
Sigrid 9025176193 aux/acpi: do not expose empty files 2021-01-22 10:57:43 +01:00
Sigrid 6a78bb2e4f stats: don't query battery and temp as often when using acpi
Querying battery (or temperature) using ACPI takes quite some
resources, which makes the battery discharge faster.  It doesn't make
much sense to have it queried as often either.  So, when using ACPI:

1) set battery query period to 10s minimum
2) set temperature query period to 5s minimum
2021-01-22 10:15:36 +01:00
Ori Bernstein 50efe18550 webcookies: remove straggling custom date parser
One place missed in the tmdate purge.
2021-01-19 18:14:53 -08:00
Ori Bernstein 417dc79cff upas/ml: touch the artwork
Global variables deserve more greppable names,
since I'm likely to know where they're used.
2021-01-19 18:12:30 -08:00
Ori Bernstein cb7ba0e640 dd: error with invalid size suffixes, add 'm'
When invoking with dd with an invalid size suffix, we
silently accept the suffix. This can lead to confusion,
because lines like:

	dd -bs 1K
	dd -bs 1m

will silently copy in 1-byte increments. This has caught
people by surprise. While we're at it, megabytes are
convenient, so let's have them too.
2021-01-19 15:15:12 -08:00
Sigrid 67c15c1e47 mothra: linkify text starting with gemini:// and ftp:// 2021-01-19 15:04:40 +01:00
Sigrid 8781283fbd mothra: resolve urls on middle click. helps with snarfing of relative urls 2021-01-19 14:14:28 +01:00
Ori Bernstein 8c9cbbb142 passwd: make legacy mode explicit
Passwd used to produce a very confusing error
about DES not being enabled whenever the password
was mistyped. This happened because we attempted
to guess what authentication method to use, and
preseneted the error from the wrong one on failure.

This puts the legacy mode behind a flag, so that
we don't even try the old method unless it's
explicitly requested.
2021-01-17 18:01:53 -08:00
Ori Bernstein bf7e0791e1 seconds: remove junk from usage 2021-01-17 11:12:18 -08:00
Sigrid 0f3ef52fd7 tweak: support showdata plumb action (thanks sirjofri) 2021-01-16 18:30:50 +01:00
Sigrid 7b12e8084a cal: use Sa/Su in all cases, also simplify the code 2021-01-12 21:08:12 +01:00
Sigrid 72f7609106 cal: fix -s 7 2021-01-12 13:32:38 +01:00
Sigrid 806f97a47b cal: add -s option to specify the starting day of the week 2021-01-12 13:23:37 +01:00
Sigrid 6103d6ed2c audio/flacenc: missed an argument in fprintf() 2021-01-12 11:15:18 +01:00
Sigrid b9f2050d59 libFLAC/mkfile: update version and build with -DNDEBUG 2021-01-11 16:58:04 +01:00
Sigrid c789c05480 libvorbis: fix free() called on a wrong pointer 2021-01-11 16:17:48 +01:00
Sigrid ce82f6750c audio/flacenc 2021-01-11 15:45:12 +01:00
Ori Bernstein 888c59c07e merge 2021-01-05 19:48:26 -08:00
Ori Bernstein 1787a8b990 acid: increase hash size (thanks jonas.amoson)
when loading large binaries such as netsurf, with many
symbols, our hash table fills up with collisions and
loading the symbol table gets very slow. Bumping it up
drops the time to lstk() in acid on netsurf from 4 minutes
to 8 seconds.
2021-01-05 19:37:26 -08:00
Alex Musolino 95b9b8863d qr: fix exit status
Call exits(0) instead of returning from main.  Also call sysfatal if
writing of image data fails.  Previously, qr(1) would exit with
default non-nil status "main" unconditionally as a result of returning
from main.
2021-01-05 22:36:03 +10:30
Sigrid 5991e01ed7 file: ftyp mp4* is video/mp4 as well 2021-01-01 22:58:05 +01:00
Ori Bernstein c3b30544e1 sort: fix memory leak (thanks Igor Boehm)
Free the last line that we examine when looping
through the lines in a file.
2021-01-01 11:48:39 -08:00
BurnZeZ fd1db35c4d cc: add a couple notes to the comments regarding flags 2020-12-29 19:38:59 +00:00
cinap_lenrek fb08e3655e plumber: open rule files as OCEXEC, to avoid leaking them to sub commands 2020-12-29 18:45:42 +01:00
Sigrid b7b740a04c text2post: check font index for out of range 2020-12-28 21:21:22 +01:00
cinap_lenrek ceeb701a2b plumber: don't leak srvfd file descriptor into sub processes
Put OCEXEC flag on the srvfd so it wont be leaked
on sub-processes we spawn from plumb rules.
2020-12-28 21:00:15 +01:00
Sigrid 67672ffdc9 plumb: fix wrong click attribute offset (thanks umbraticus) 2020-12-28 12:24:47 +01:00
cinap_lenrek 0596178dd6 kbmap: avoid division by zero when window becomes too small 2020-12-27 23:39:28 +01:00
cinap_lenrek 0e632454e2 aux/vga: remove panning, add screen tilting support 2020-12-27 23:10:39 +01:00
Sigrid 7bcdd1b5d8 libvorbis: 1.3.5 → 1.3.7 (fixes a bunch of CVE and other small issues) 2020-12-23 12:18:07 +01:00
cinap_lenrek 809a7402fc aout2uimage: fix missing \n in usage print (thanks james) 2020-12-22 19:33:49 +01:00
cinap_lenrek 157166d4fc kbdfs: fix mistake, remove leftover static user variable (thanks umbraticus and igor) 2020-12-22 16:36:45 +01:00
cinap_lenrek 41c60689b3 ndb/dns: handle dnskey RR's (thanks moody)
On 12/18/20, Jacob Moody wrote:
> Hello,
>
> I recently ran in to some issues with pointing an unbound server towards a
> 9front dns server as its upstream.
> The parsing seemed to fail when ndb/dns received a DNSKEY RR from it's own
> upstream source on behalf of unbound.
> This patch catches and stores the DNSKEY from the upstream server to prevent
> this.
2020-12-20 23:08:11 +01:00
cinap_lenrek 08c1622b0d [12kq]l: remove unix compat code for cputime() 2020-12-19 19:15:02 +01:00
cinap_lenrek eb1dfed9ab libauth: change programs to use the new procsetuser() function 2020-12-19 18:02:37 +01:00
cinap_lenrek daccd2b226 aux/kbdfs: use getuser() from libc 2020-12-19 15:52:41 +01:00
cinap_lenrek ba20914d01 acme: use global user string variable instead of getuser() 2020-12-19 15:50:30 +01:00
cinap_lenrek c7fc69bd6a acme: use getuser() in fsinit() 2020-12-19 15:36:07 +01:00
Ori Bernstein 4dc437c076 vt: rfork environment varibles (thanks fshahriar)
vt sets several environment variables ($TERM, $COLS, $LINES)
after exiting. This change rforks the environment so that this
detritus doesn't get left behind.
2020-12-18 19:23:48 -08:00
Sigrid 5016ac0c63 pc: set exit status depending on errors 2020-12-15 14:37:36 +01:00
Sigrid d0c6ade53d pc: treat EOF gracefully, allowing easier use within sam command language 2020-12-15 14:25:59 +01:00
Alex Musolino 3749e92cdb merge 2020-12-15 20:55:41 +10:30
Alex Musolino 404c901f29 ico: avoid potential nil pointer dereferences
Bgeticon can fail, leaving the Icon img pointers nil.
2020-12-15 20:45:26 +10:30
Alex Musolino 81647c2025 ico: fix interpretation of 0 widths/heights 2020-12-15 20:44:11 +10:30
cinap_lenrek 32291b52bc iostats: dup 9p pipe to both fd 0 and fd 1 for exportfs 2020-12-13 20:23:03 +01:00
cinap_lenrek 27a83106f4 oexportfs: move legacy code for cpu and import to separate program
The initial protocol handling in exportfs for
cpu and import services is a huge mess.

Saparate the code out into its own program with
its own oexportfs(4) manpage.
2020-12-13 20:09:03 +01:00
Sigrid f5d1fce9b5 vmx: clean up mksegment, memset only if segment existed (devsegment clears new ones) 2020-12-10 12:19:45 +01:00