1
0
mirror of https://github.com/openbsd/src.git synced 2024-12-21 23:18:00 -08:00
Commit Graph

3369 Commits

Author SHA1 Message Date
jmc
93da23dae1 use a more readable explanation of directory creation;
from evan silberman, tweaked by millert

ok sthen (pre-tweak)
2024-11-30 06:59:12 +00:00
claudio
85ce0bb8de Add PS_STOPPED to the flags 2024-10-15 13:49:49 +00:00
jsg
118f3e42b7 remove duplicate includes and license; feedback and ok miod@ 2024-10-14 08:26:48 +00:00
jsg
1ca96170b4 remove duplicate unistd.h include 2024-10-12 07:58:40 +00:00
claudio
c59e78d336 Print the session id (PID of the session leader) instead of a pointer.
Pointers are only visible when run as superuser. Also in most cases
you want to know which process is the session leader and which process
groups belong together. So it is better to print the session id.
OK deraadt@ (long time ago)
2024-10-10 10:24:14 +00:00
jmc
e9d1bb1d46 remove some unneeded Xo/Xc calls; from evan silberman
the original diff had a couple of errors, which i've fixed
2024-09-25 06:13:01 +00:00
deraadt
e667928637 If during parsing lines in the script, ksh finds a NUL byte on the
line, it should abort ("syntax error: NUL byte unexpected").  There
appears to be one piece of software which is misinterpreting guidance
of this, and trying to depend upon embedded NUL.  During research,
every shell we tested has one or more cases where a NUL byte in the
input or inside variable contents will create divergent behaviour from
other shells.  (ie. gets converted to a space, is silently skipped, or
aborts script parsing or later execution).  All the shells are written
in C, and majority of them use C strings for everything, which means
they cannot embed a NUL, so this is not surprising.  It is quite
unbelievable there are people trying to rewrite history on a lark, and
expecting the world to follow alone.

If there is ONE THING the Unix world needs, it is for bash/ksh/sh to
stop diverging further by permitting STUPID INPUT that cannot
plausibly work in all other shells.  We are in a post-Postel world.

It remains possible to put arbitrary bytes *AFTER* the parts of the
shell script that get parsed & executed (like some Solaris patch files
do).  But you can't put arbirary bytes in the middle, ahead of shell
script parsed lines, because shells can't jump to arbitrary offsets
inside the input file, they go THROUGH all the 'valid shell script
text lines' to get there.

This was in snapshots for more than 2 months, and only spotted one
other program depending on the behaviour (and that test program did
not observe that it was therefore depending in incorrect behaviour!!)

ok ingo.  Softer ok's from various others.
2024-09-23 21:18:33 +00:00
op
8c6999ca73 inline `start' and simplify; from/ok millert@ 2024-08-27 19:27:19 +00:00
op
edf882c32d ksh: use strtonum() in findhistrel()
ok millert@, deraadt@
2024-08-27 18:45:58 +00:00
tb
79df796aa5 Since netstart r1.208 (2020), it no longer applies /etc/myname
Change Xr from netstart to rc.

From Christian Schulte, ok florian
2024-08-25 09:32:08 +00:00
deraadt
c7735c59e1 We do not need the PS_LIBCPIN and PS_PIN flag fields anymore, which were
used during devlopment (for visibility). There is speculation claudio will
immediately use these bits for something else.
2024-08-21 03:07:45 +00:00
guenther
b05220827c Now that we have dup2(), csh can use it instead of close()+dup().
Also, as used here, dup/dup2 will clear the close-on-exec flag, so
delete the superfluous fcntl(F_SETFD,0) calls

ok deraadt@
2024-08-20 23:40:39 +00:00
deraadt
421bf2dd52 move ed/tests files to regress/bin/ed, where they are used 2024-08-19 01:43:23 +00:00
guenther
18d6208093 unifdef for S_I{FLNK,FIFO,FSOCK}. For the operations where we use
access() (-r, -w, -x, -e) do them without requiring stat() to succeed first.

ok tb@ deraadt@
2024-08-15 06:27:24 +00:00
guenther
b27f9b3934 'newercnt' no longer does anything that 'refcnt' doesn't; eliminate
the former in favor of the latter.

ok millert@
2024-08-15 00:47:44 +00:00
jmc
33f846a619 bump posix spec from 2008 -> 2024;
no documented changes.
2024-08-01 14:44:34 +00:00
jmc
4cef13ba6b bump posix spec 2008 -> 2024;
no change noted from 2008 spec, but i've added -h to the list
of extensions. that was an omission from our 2008 notes,
rather than a change in the spec.
2024-08-01 14:30:17 +00:00
jmc
20b6c1a110 bump posix spec 2008 -> 2024; 2024-08-01 14:08:38 +00:00
jmc
ca1e11fc67 bump posix spec 2008 -> 2024; 2024-08-01 14:08:07 +00:00
claudio
b7fe6922be Sync with sys/proc.h after P_CONTINUED -> PS_CONTINUED change.
OK mpi@
2024-07-29 09:50:30 +00:00
deraadt
324a3c8c4f block SIGHUP in the same places where SIGCHLD is blocked to protect
the process lists, because the SIGHUP handler looks at them (and
it is very difficult to rewrite the that handler a different way)
ok millert
2024-07-28 15:31:22 +00:00
claudio
fc20a59e00 Sync with proc.h: s/PS_STOPPED/PS_STOPPING/
OK kettenis@
2024-07-22 09:44:37 +00:00
deraadt
2bde29b351 Fix the SIGHUP signal race. ed's "event loop" operates a getchar(); check
the hup flag before and after that call, when the buffer structures are stable
for write_file() to work.  Remove the hup handling from the SPL0() macro,
because this is run in at least one place during structure instability.
The SIGINT handler, which uses siglongjmp(), is also trusting the SPL1/SPL0
dance more than it should.
ok millert
2024-07-16 05:01:10 +00:00
jca
c7d9714183 Zap trailing whitespace
Dummy commit to trigger the git exporter.
2024-07-14 14:32:02 +00:00
florian
ba080721f3 Rewrite bytes/sec calculation using fixed point math.
This makes signal handler safe on OpenBSD.

To avoid overflows the accuracy is scaled. Above 10 minutes run time
we only care about second accuracy. Between 1 seconds and 10 minutes
we use millisecond accuracy.

Below one second we use nanoseconds, but those numbers are probably
meaningless.

Signal handler problem pointed out by deraadt

OK deraadt, millert, tb
2024-07-12 19:11:25 +00:00
deraadt
f901c358bd refactor the signal handlers for clarity, inverting the situation:
the signal handler was calling a big function which is shared between
multiple contexts -- that hides the rule that this big function has
signal safe requirements (which it fails).  now, the signal handler
contains all the code, and everyone else calls the signal handler function
as a regular function, from their (normal) contexts.
the signal handler context is the most strict, so this pattern is better.
ok florian
2024-07-12 14:30:27 +00:00
deraadt
9606c1668a annotate broken signal handler 2024-07-12 07:22:44 +00:00
schwarze
1245b84dd8 Stop trying to deprecate "test -L" in favour of "test -h" (or vice versa).
It's hopeless because POSIX requires both since Issue 6 (2001).
Both always worked on OpenBSD, no matter which base system shell was used.

According to research done by jsg@, it seems likely that actually,
"test -L" has precedence over "test -h" by about one year:
v8 (Feb 1985) had -L, SunOS 3.0 (Feb 1986) had -h; but SVR4 (1989)
already had both, so we are talking about 35 years of petrification.
More details: https://marc.info/?l=openbsd-bugs&m=171867441927989

Resolving a question raised by Tim dot theCHASEs dot com on bugs@.
OK deraadt@ millert@ jsg@ jmc@  and also works for Tim Chase.
2024-06-18 16:41:39 +00:00
jsg
ce7279d89b remove prototypes with no matching function and externs with no var
partly checked by millert@
2024-05-21 05:00:47 +00:00
sobrado
375f1517cd prefixing flags to ps(1) by a hyphen is optional; while here, make synopsis
fit in a 80-column display.

ok jmc@
2024-05-18 13:08:09 +00:00
guenther
bb7daa6de6 When comparing mtimes for the -u and -Z options and the target is
'too old', use pathconfat(_PC_TIMESTAMP_RESOLUTION, AT_SYMLINK_NOFOLLOW)
to get the timestamp resolution to which the _source_ timestamp
should be truncated for a stable comparison.

Problem reported by Walter Alejandro Iglesias (wai(at)roquesor.com)
ok millert@
2024-05-18 05:21:38 +00:00
millert
8758bb5921 pax: make list file handle line-buffered unless it is stderr.
This fixes a problem where the file list output was fully-buffered
when used as part of a pipeline.  With this change, files are listed
as they are extracted in verbose mode.  OK deraadt@ guenther@
2024-05-10 20:28:31 +00:00
florian
55449a4bb3 gmtime(3) / locatime(3) can fail when timestamps are way off.
Add missing error checks to all calls under bin/

Input & OK millert
2024-04-28 16:43:15 +00:00
florian
9a584187e4 Use propper knf.
Spotted by kettenis.
2024-04-27 19:49:42 +00:00
florian
a782b597b2 localtime(3) can fail if time_t is very far in the future or past.
found using afl++

OK millert
2024-04-27 14:57:02 +00:00
jsg
e6c7c102cf correct indentation; no functional change
ok tb@
2024-04-23 13:34:50 +00:00
jca
8df7613330 Provide a pax format specific option handler
The existing tar_opt() implements support for -o write_opt=nodir for the
old tar and ustar formats. We don't really want to support it for the
pax format, and we want to be able to implement pax format specific
options (even if there are none right now).  ok millert@
2024-04-17 18:12:12 +00:00
jca
3e7fedf45e Fold long line 2024-04-17 15:48:44 +00:00
jca
4ce91cbef9 Fixup comment
Spotted by caspar@ earlier
2024-04-17 10:19:17 +00:00
jca
e313d3eb7c Switch tar(1) write default format to 'pax'
Lets us store longer file names, link names, finer grained timestamps,
larger archive member files, etc; at the expense of larger uncompressed
archives and less widespread support across the ecosystem.  If you're
unhappy with the new defaults, you can use -F ustar.  Or you can help
fix bugs / find a better middle ground.

Prodding from various including job@ and deraadt@
ok sthen@ caspar@ millert@
2024-04-16 23:09:35 +00:00
jca
fe4b30a064 Fix reading large pax extended records
512 bytes isn't enough if you want to store rather large but still
useful long file names or symbolic links destinations.  The best way to
size the buffer to read those records is based upon the largest paths
pax(1) can handle, and that is PAXPATHLEN.

Reported by caspar@, input and ok millert@
2024-04-16 22:58:10 +00:00
jca
cf0ae65b89 Fix pasto: broken storage of symbolic link long destinations in pax format 2024-04-16 20:51:11 +00:00
jca
489289b76a Revert wip patch, not intended for commit 2024-04-16 19:09:06 +00:00
jca
f30fa5528e Add tar(1) -F option to select write format
We want to move towards 'pax' as the default format for writing, this
option lets users downgrade to -F ustar where the 'pax' format isn't
convenient/usable (same as -x <format> in pax(1)).

-F <format> is more generic than -o/-O. -H (GNU tar) was already used
and we don't want long options so --format (NetBSD/FreeBSD) is excluded
too.

ok sthen@ caspar@ millert@
2024-04-16 19:04:11 +00:00
jca
ce1e26fb72 Correctly detect 'pax' format archives in append mode
We expect that existing pax archives start with a global or extended
header. If they don't, append operations will be done using ustar
format.

Fixes append mode on pax archives where pax(1) would bail out when
appending to pax archives, falsely detecting a mismatch.  Reading was
unaffected.  Reported by caspar@, ok caspar@ millert@
2024-04-16 18:52:43 +00:00
caspar
85d4a8a216 Amend previous: improve comment 2024-04-15 22:07:08 +00:00
jca
9dcb0c6dfd Switch pax(1) to write archives using the 'pax' format by default
ramdisk versions will keep using ustar for writing.

ok millert@
2024-04-15 17:33:10 +00:00
millert
ba906cc60a printtime: use the Unix epoch if the file's timestamp is invalid
Fixes a crash in "ls -l" for files with bogus timestamp values.
OK miod@ denis@
2024-03-27 14:44:52 +00:00
jmc
6be3c107b7 add missing Ev macro; from mail at lukasneukom ch 2024-03-06 06:26:22 +00:00
beck
81fb472f13 Remove Softdep.
Softdep has been a no-op for some time now, this removes it to get
it out of the way.

Flensing mostly done in Talinn, with some help from krw@

ok deraadt@
2024-02-03 18:51:57 +00:00