summaryrefslogtreecommitdiff
path: root/bin
AgeCommit message (Collapse)Author
2024-10-15Add PS_STOPPED to the flagsClaudio Jeker
2024-10-14remove duplicate includes and license; feedback and ok miod@Jonathan Gray
2024-10-12remove duplicate unistd.h includeJonathan Gray
2024-10-10Print the session id (PID of the session leader) instead of a pointer.Claudio Jeker
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-09-25remove some unneeded Xo/Xc calls; from evan silbermanJason McIntyre
the original diff had a couple of errors, which i've fixed
2024-09-23If during parsing lines in the script, ksh finds a NUL byte on theTheo de Raadt
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-08-27inline `start' and simplify; from/ok millert@Omar Polo
2024-08-27ksh: use strtonum() in findhistrel()Omar Polo
ok millert@, deraadt@
2024-08-25Since netstart r1.208 (2020), it no longer applies /etc/mynameTheo Buehler
Change Xr from netstart to rc. From Christian Schulte, ok florian
2024-08-21We do not need the PS_LIBCPIN and PS_PIN flag fields anymore, which wereTheo de Raadt
used during devlopment (for visibility). There is speculation claudio will immediately use these bits for something else.
2024-08-20Now that we have dup2(), csh can use it instead of close()+dup().Philip Guenther
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-19move ed/tests files to regress/bin/ed, where they are usedTheo de Raadt
2024-08-15unifdef for S_I{FLNK,FIFO,FSOCK}. For the operations where we usePhilip Guenther
access() (-r, -w, -x, -e) do them without requiring stat() to succeed first. ok tb@ deraadt@
2024-08-15'newercnt' no longer does anything that 'refcnt' doesn't; eliminatePhilip Guenther
the former in favor of the latter. ok millert@
2024-08-01bump posix spec from 2008 -> 2024;Jason McIntyre
no documented changes.
2024-08-01bump posix spec 2008 -> 2024;Jason McIntyre
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-01bump posix spec 2008 -> 2024;Jason McIntyre
2024-07-29Sync with sys/proc.h after P_CONTINUED -> PS_CONTINUED change.Claudio Jeker
OK mpi@
2024-07-28block SIGHUP in the same places where SIGCHLD is blocked to protectTheo de Raadt
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-22Sync with proc.h: s/PS_STOPPED/PS_STOPPING/Claudio Jeker
OK kettenis@
2024-07-16Fix the SIGHUP signal race. ed's "event loop" operates a getchar(); checkTheo de Raadt
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-14Zap trailing whitespaceJeremie Courreges-Anglas
Dummy commit to trigger the git exporter.
2024-07-12Rewrite bytes/sec calculation using fixed point math.Florian Obser
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-12refactor the signal handlers for clarity, inverting the situation:Theo de Raadt
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-12annotate broken signal handlerTheo de Raadt
2024-06-18Stop trying to deprecate "test -L" in favour of "test -h" (or vice versa).Ingo Schwarze
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-05-21remove prototypes with no matching function and externs with no varJonathan Gray
partly checked by millert@
2024-05-18prefixing flags to ps(1) by a hyphen is optional; while here, make synopsisIgor Sobrado
fit in a 80-column display. ok jmc@
2024-05-18When comparing mtimes for the -u and -Z options and the target isPhilip Guenther
'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-10pax: make list file handle line-buffered unless it is stderr.Todd C. Miller
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-04-28gmtime(3) / locatime(3) can fail when timestamps are way off.Florian Obser
Add missing error checks to all calls under bin/ Input & OK millert
2024-04-27Use propper knf.Florian Obser
Spotted by kettenis.
2024-04-27localtime(3) can fail if time_t is very far in the future or past.Florian Obser
found using afl++ OK millert
2024-04-23correct indentation; no functional changeJonathan Gray
ok tb@
2024-04-17Provide a pax format specific option handlerJeremie Courreges-Anglas
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-17Fold long lineJeremie Courreges-Anglas
2024-04-17Fixup commentJeremie Courreges-Anglas
Spotted by caspar@ earlier
2024-04-16Switch tar(1) write default format to 'pax'Jeremie Courreges-Anglas
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-16Fix reading large pax extended recordsJeremie Courreges-Anglas
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-16Fix pasto: broken storage of symbolic link long destinations in pax formatJeremie Courreges-Anglas
2024-04-16Revert wip patch, not intended for commitJeremie Courreges-Anglas
2024-04-16Add tar(1) -F option to select write formatJeremie Courreges-Anglas
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-16Correctly detect 'pax' format archives in append modeJeremie Courreges-Anglas
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-15Amend previous: improve commentCaspar Schutijser
2024-04-15Switch pax(1) to write archives using the 'pax' format by defaultJeremie Courreges-Anglas
ramdisk versions will keep using ustar for writing. ok millert@
2024-03-27printtime: use the Unix epoch if the file's timestamp is invalidTodd C. Miller
Fixes a crash in "ls -l" for files with bogus timestamp values. OK miod@ denis@
2024-03-06add missing Ev macro; from mail at lukasneukom chJason McIntyre
2024-02-03Remove Softdep.Bob Beck
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-01-28Remove the 'l' and 'L' flag printing in 'STAT' column. These were addedTheo de Raadt
to provide visibility of the internal behaviour of pinsyscalls(2) during introduction. These flags remain (less) visible in the "-o procflags" option, as 0x08000000 (PS_PIN) and 0x10000000 (PS_LIBCPIN). That's good enough.
2024-01-20Better formatting for pax extended header timesJeremie Courreges-Anglas
As specified, don't include the subsecond part if zero and drop trailing zeros in the subsecond part. ok millert@