IABSD.fr/src/bin

Branch :


Log

Author Commit Date CI Message
b51bc68f 2026-05-17 02:00:36 add missing sigfillset() call caught by clang-22 -Wuninitialized-const-pointer ok millert@ deraadt@ guenther@
468b6257 2026-05-06 12:54:27 High Severity end-of-line whitespace found by GrepTechnologies AI ok guenther mlarkin
1ac8d6c9 2026-04-04 09:33:18 ksh: yank on 'change' in vi-mode Until now, only 'delete' operations in ksh's vi-mode yank the deleted range to the yank buffer. Make 'change' operations do the same. This is consistent with vi(1)'s behavior. ok tb@
e8b5f432 2026-03-05 05:40:37 satisfy the requirements of ksh build with -DSMALL in the install media
009ff5ea 2026-03-05 05:38:58 Inspecting Flag(FTALKING) to activate curses in the spot chosen by the previous commit seems to fail in some circumstances because of order of operations in ksh startup. So move the test and curses initialization immediately before the tputs() calls. discussion with tb
3b88903c 2026-03-04 03:54:25 If ksh is not interactive, do not initialize curses. Instrumentation showed that during a typical build process the terminfo file was being opened (and parsed) a gazilion times. diagnosed with matthieu, ok millert
d2b25f5d 2026-02-25 21:57:43 add -e to process escape sequences and support for multiple groups of dash args like ksh's echo does ok deraadt millert
4d4b7e5b 2026-01-28 20:31:49 ls(1): use correct buffer size for ngroup. In numeric long format, ngroup is formatted using sizeof nuser. That's a copy-paste bug. It's harmless only because the arrays are the same size today; it would become a real truncation/overflow risk if they ever diverge. From Michal Mazurek (akfaew@), thanks! OK kn@, tb@
0fede2ff 2026-01-18 14:05:29 Avoid statement that was misleading by being overly specific: without -T, the format of the last modification column varies. Being less specific is actually better because that indicates to the reader that it's intended for human consumption, and that trying to parse it programmatically is likely not a good idea. Issue reported by Jan Stary <hans@stare.cz> on tech. Patch by me, OK sthen@.
7ae91379 2026-01-09 19:54:57 Report the inodes statistics in 'df -hi' in a scaled manner This improves readability and column alignment for large file systems, leaving more space for displaying the mountpoint on the same line. OK asou@ sthen@
7bb11a6f 2026-01-05 03:34:18 remove unneeded includes; ok deraadt@
bc2c047e 2025-12-31 22:12:25 Correct POSIX ISBN. 1-55937-255-9 was mistakenly changed to 1-55937-266-9 when the page was converted to mdoc in rev 1.15 ok millert@
6553e559 2025-08-15 04:21:00 Move the proc.ps_flags PS_* bits that are only changed by sys_execve() and not tested (by name) in userland to a new ps_iflags member. This frees up some ps_flags bits for other uses. ok mpi@ claudio@
3a33cb1c 2025-07-20 21:24:07 Completely rewrite rewindow(), the function that chooses a new starting byte for the editing window when the cursor leaves the editing window to the right or to the left side. The main reason for the rewrite is that UTF-8 handling was broken and would often start the editing window on a UTF-8 continuation byte, sending UTF-8 syntax errors to the terminal. Besides, the function was unnecessarily complicated (iterating twice) and inefficient (iterating the whole buffer from the beginning even when the cursor was far out to the right) without even being exact (picking a bit position that brings the cursor near the middle of the window, but nor always as close to the middle as possible). The old algorithm was rougly O(L + 2*W), where W is half of the window width, and L is the amount of text left of the window. Instead, pick an algorithm that is simpler, more robust, and faster than before, but avoid complication by still being content with an approximate solution that can be implemented with a simple O(W) backwards linear search. Do not go overboard with an O(W log W) binary search or an O(W^2) linear search, either of which would be required to find the optimal position. OK millert@
60f78633 2025-07-17 05:30:41 md5(1): avoid incompatible function pointer casts This is a bit of a stupid change with lots of boilerplate. The problem is undefined behavior due to the second sentence of C99 6.3.2.3, 8: A pointer to a function of one type may be converted to a pointer to a function of another type and back again; the result shall compare equal to the original pointer. If a converted pointer is used to call a function whose type is not compatible with the pointed-to type, the behavior is undefined. The notion of compatibility for the functions here boils down to compatible return type and compatible argument list, which in particular means the same number of arguments. See 6.7.5.3, 15 for the gory details. There's also a version understandable to a human being lacking the brain damage necessary for successfully deciphering the C99 standard's language: https://en.cppreference.com/w/c/language/type.html So calling 'void CKSUM_Final(CKSUM_CTX *);' through the final member of struct hash_function is clearly UB since the numbers of parameters don't match. If that was all, the fix would be trivial. But the same goes for void MD5Final(MD5_CTX *, char *); because MD5_CTX * and void * aren't compatible in this sense: by definition, two pointer types are compatible if they point to compatible types. Or, if you prefer: void * has looser alignment requirements than MD5_CTX *, so they aren't compatible. The below avoids this by adding wrapper functions that have the correct types that then propagate their parameters by using the appropriate union member. with/ok millert
cb70e683 2025-07-14 02:40:15 found a local but non-static function and fixed it
609a0f69 2025-07-06 19:25:51 Print a message when failing to write tar, ustar and pax (extended) headers. Do no not abort but skip the file if the extended header size or checksum do not fit, same as for regular ustar headers. Not sure if it can really happen in practice. OK millert@
9fbd021d 2025-07-02 13:25:05 use a local definition of MINIMUM
e6fd7d81 2025-07-02 13:24:48 stop using an extern variable to collect errors; ok tedu millert
85dca62a 2025-06-30 02:53:26 delete extern for variable that was removed
f043eea3 2025-06-29 20:29:48 Don't exit silently when writing out the extended headers if the mtime didn't fit in the ustar header for the extended header record. OK jca@
9020431b 2025-06-29 16:22:05 always read nlist, now called getkernvars. the logic to only read sometimes was bugged, meaning %CPU didn't work. reported by job. ok deraadt.
12ab075d 2025-05-19 14:27:38 Minor improvement of the "move right by character" command ('l', SPACE) in VI editing mode. If we are on the first byte in the command line and it is a UTF-8 continuation byte, then it actually takes up a column in the terminal, which typically displays U+FFFD REPLACEMENT CHARACTER. Consequently, moving past this byte should consume one right movement. OK lucas@
442b24d3 2025-05-18 21:18:27 In VI editing mode, rewrite that part of the cursor movement function that moves the cursor to the right. Simplify the code by making sure that the column number index "ci" and the byte pointer "wb" always point to the same character; that's achieved by incrementing ci at the beginning and wb at the end of the loop. This simplification allows using one call to isu8cont() rather than two. The rewrite was needed because command lines starting with a UTF-8 continuation byte were mishandled in two ways. * If the target column is right after the prompt (col == pwidth), do not enter the printing loop at all, not even if the first byte is a UTF-8 continuation byte. * If the target column is further to the right (col > pwidth), let the first byte always advance the column (ci++), even if it is a UTF-8 continuation byte. Issues found while studying test input suggested by lucas@. OK lucas@.
ca274558 2025-05-15 17:07:13 In ksh(1) VI mode, prevent display corruption when the command line being edited starts with a UTF-8 continuation byte. In particular, in case a UTF-8 continuation byte is the first byte on the line, count it as width 1 rather than width 0, and in case a UTF-8 continuation byte is the first byte that changes, only back up the column if it's not in the first column. This was discussed in more detail on tech@. OK lucas@; anton@ and kn@ also think i should go ahead.
98a7e0c6 2025-05-14 15:51:58 Fix two bugs that naddy@ reported on tech@: 1. POSIX requires that "mkdir dir; ln -s dir lnk; rmdir lnk/" removes "dir" because rmdir(1) is required to behave like rmdir(2) in this respect and that requires resolving the pathname, and "Base Definitions 4.16 Pathname Resolution" specifies that pathname resolution of "lnk" is complete, while pathname resolution of "lnk/" is not complete, but it resolves to "dir". 2. rmdir -p on an absolute path should not fail with the spurious error "rmdir: : No such file or directory". Both FreeBSD and NetBSD changed this code, too, but we discussed what both did on tech@ and found downsides we don't want. The best fix is to: 1. Completely remove the handling of trailing slashes from main() such that rmdir(1) aligns correctly with rmdir(2). 2. Completely rewrite rm_path() because having two nested while loops, both moving the parse pointer p backwards, was neither necessary nor particularly readable and complicated fixing the bug. Include some minor KNF improvements while here. Feedback and OK tb@. OK naddy@ on an earlier version of this diff.
eacfe1d9 2025-04-29 17:44:00 remove references to fs.posix.setuid; ok tedu
2da3dbd6 2025-04-29 03:48:10 remove obsolete rsz keyword. ok job
3952e21b 2025-04-29 03:45:27 adjust column width by scanning the proc array. ok job
9d850c1b 2025-04-27 17:06:58 Simple fix to prevvent the "delete to EOL" (D) command in VI mode from corrupting the cursor position when the last character remaining on the line is UTF-8. Instead of putting the cursor on the last byte, let the loop after the end of the "select" block put it at the beginning of the last character. Tested by Walter Alejandro Iglesias <wai at roquesor dot com>, and no objection was raised when shown on tech@.
82b01731 2025-04-25 18:28:33 In VI command line editing mode, make the behaviour of "1P" consistent with the behaviour of "2P" such that both back up to the first byte of the last character inserted. As a side benefit, that also makes "[n]P" work in the presence of UTF-8 characters. According to pascal@, the new behaviour of "P" is conistent with ksh93 and all historical versions of ksh he tested on sdf.org, so the deviant behaviour of "1P" was likely not intentional, but a bug in pdksh. According to Walter Alejandro Iglesias <wai at roquesor dot com>, the new behaviour is also conistent with vim and bash. OK pascal@
d2877cdf 2025-04-24 14:15:29 Combine three almost identical synopsis lines into a single one, and three almost identical entries in the options list likewise, bcause all three have identical meaning and almost identical syntax. While here, call the list of signals in signal(3) "complete" rather than "more complete", because that's also true, a stronger statement, and more concise. OK jmc@
6a0df33e 2025-04-24 12:25:02 for "case", note that opening "(" and final ";;" are optional (text lifted from sh.1); pointed out by tomas rippl
efd8dac2 2025-04-22 16:49:14 From user commands, reference the simpler signal(3) manual rather than the more complicated sigaction(2); both provide a complete list of signals. Suggested by both Theos, tb@ and deraadt@, and jmc@ does not seem to object.
1ce6de1f 2025-04-21 20:06:15 Fix UTF-8 handling in the "paste after" (p) command in VI editing mode. This patch makes sure that "p" does not insert anything into the middle of any UTF-8 sequence and that the cursor is afterwards put onto the first byte of the last character inserted. Feature gap reported by Walter Alejandro Iglesias <wai at roquesor dot com>. OK anton@, and deraadt@ says he is not afraid of binary growth
5d5e0184 2025-04-20 18:55:24 Some markup improvements (.Cm TERM, .Bl -column, avoid improper .Li) and add the missing fact that -0 does not send any signal. OK jmc@
06d45920 2025-04-20 13:47:54 use warnc(3) instead of handrolling it; OK florian
873aa132 2025-03-24 22:19:42 Use timespeccmp() and st_mtim intead of comparing st_mtime. Fixes comparison of files with modification times that differ by less than a second. From Collin Funk.
ae70326d 2025-03-24 21:43:40 add a digit to vsz and rss to accomodate larger procs. ok deraadt job
0ecf0981 2025-03-24 20:15:08 Use timespeccmp() and st_mtim intead of comparing st_mtime. Fixes comparison of files with modification times that differ by less than a second. From Collin Funk.
d663acfa 2025-03-12 16:01:31 Adjust alignment when printing inode columns This makes 'df -hi' on systems with large partitions easier on the eyes. OK krw@
93da23da 2024-11-30 06:59:12 use a more readable explanation of directory creation; from evan silberman, tweaked by millert ok sthen (pre-tweak)
85ce0bb8 2024-10-15 13:49:49 Add PS_STOPPED to the flags
118f3e42 2024-10-14 08:26:48 remove duplicate includes and license; feedback and ok miod@
1ca96170 2024-10-12 07:58:40 remove duplicate unistd.h include
c59e78d3 2024-10-10 10:24:14 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)
e9d1bb1d 2024-09-25 06:13:01 remove some unneeded Xo/Xc calls; from evan silberman the original diff had a couple of errors, which i've fixed
e6679286 2024-09-23 21:18:33 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.
8c6999ca 2024-08-27 19:27:19 inline `start' and simplify; from/ok millert@
edf882c3 2024-08-27 18:45:58 ksh: use strtonum() in findhistrel() ok millert@, deraadt@
79df796a 2024-08-25 09:32:08 Since netstart r1.208 (2020), it no longer applies /etc/myname Change Xr from netstart to rc. From Christian Schulte, ok florian
c7735c59 2024-08-21 03:07:45 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.
b0522082 2024-08-20 23:40:39 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@
421bf2dd 2024-08-19 01:43:23 move ed/tests files to regress/bin/ed, where they are used
18d62080 2024-08-15 06:27:24 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@
b27f9b39 2024-08-15 00:47:44 'newercnt' no longer does anything that 'refcnt' doesn't; eliminate the former in favor of the latter. ok millert@
33f846a6 2024-08-01 14:44:34 bump posix spec from 2008 -> 2024; no documented changes.
4cef13ba 2024-08-01 14:30:17 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.
20b6c1a1 2024-08-01 14:08:38 bump posix spec 2008 -> 2024;
ca1e11fc 2024-08-01 14:08:07 bump posix spec 2008 -> 2024;
b7fe6922 2024-07-29 09:50:30 Sync with sys/proc.h after P_CONTINUED -> PS_CONTINUED change. OK mpi@
324a3c8c 2024-07-28 15:31:22 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
fc20a59e 2024-07-22 09:44:37 Sync with proc.h: s/PS_STOPPED/PS_STOPPING/ OK kettenis@
2bde29b3 2024-07-16 05:01:10 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
c7d97141 2024-07-14 14:32:02 Zap trailing whitespace Dummy commit to trigger the git exporter.
ba080721 2024-07-12 19:11:25 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
f901c358 2024-07-12 14:30:27 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
9606c166 2024-07-12 07:22:44 annotate broken signal handler
1245b84d 2024-06-18 16:41:39 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.
ce7279d8 2024-05-21 05:00:47 remove prototypes with no matching function and externs with no var partly checked by millert@
375f1517 2024-05-18 13:08:09 prefixing flags to ps(1) by a hyphen is optional; while here, make synopsis fit in a 80-column display. ok jmc@
bb7daa6d 2024-05-18 05:21:38 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@
8758bb59 2024-05-10 20:28:31 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@
55449a4b 2024-04-28 16:43:15 gmtime(3) / locatime(3) can fail when timestamps are way off. Add missing error checks to all calls under bin/ Input & OK millert
9a584187 2024-04-27 19:49:42 Use propper knf. Spotted by kettenis.
a782b597 2024-04-27 14:57:02 localtime(3) can fail if time_t is very far in the future or past. found using afl++ OK millert
e6c7c102 2024-04-23 13:34:50 correct indentation; no functional change ok tb@
8df76133 2024-04-17 18:12:12 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@
3e7fedf4 2024-04-17 15:48:44 Fold long line
4ce91cbe 2024-04-17 10:19:17 Fixup comment Spotted by caspar@ earlier
e313d3eb 2024-04-16 23:09:35 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@
fe4b30a0 2024-04-16 22:58:10 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@
cf0ae65b 2024-04-16 20:51:11 Fix pasto: broken storage of symbolic link long destinations in pax format
489289b7 2024-04-16 19:09:06 Revert wip patch, not intended for commit
f30fa552 2024-04-16 19:04:11 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@
ce1e26fb 2024-04-16 18:52:43 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@
85d4a8a2 2024-04-15 22:07:08 Amend previous: improve comment
9dcb0c6d 2024-04-15 17:33:10 Switch pax(1) to write archives using the 'pax' format by default ramdisk versions will keep using ustar for writing. ok millert@
ba906cc6 2024-03-27 14:44:52 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@
6be3c107 2024-03-06 06:26:22 add missing Ev macro; from mail at lukasneukom ch
81fb472f 2024-02-03 18:51:57 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@
58457bb1 2024-01-28 19:05:33 Remove the 'l' and 'L' flag printing in 'STAT' column. These were added 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.
b54e1577 2024-01-20 17:34:50 Better formatting for pax extended header times As specified, don't include the subsecond part if zero and drop trailing zeros in the subsecond part. ok millert@
3b5541ba 2024-01-16 19:08:37 print flag 'l' for base program or ld.so being under pinsyscalls enforcement, and 'L' for libc.so. This flag printing may be deleted once we are entirely confident this is working correctly. ok kettenis
554c9a8f 2023-12-27 08:29:41 'pax' format support for mtime and atime Access time can't be represented by ustar, so always include it when using the pax format. Also include an extended header record for mtime if the file modification time can't be fully represented by ustar (eg subsecond resolution). Input & ok millert@
cd67bb40 2023-12-22 20:32:29 Zap useless newline added in previous
eafddf6e 2023-12-22 20:29:27 'pax' format support for files over 8GB ok millert@
ba5cb451 2023-12-21 01:20:54 Print the proper file name in case we fail to allocate a "path" extended header Use name, not ln_name. Pasto introduced in previous.
013e174a 2023-12-09 23:00:11 Add basic write support for 'pax' format archives Keep writing archives in ustar format by default. People can test the posix 'pax' format using pax(1) -w -x pax ... or cpio -o -H pax ...; tar(1) can't exercise this code yet. Only long names file and link names are supported for now. With input and tests from caspar@, ok millert@
c01bd743 2023-11-26 16:04:17 mark functions as static when they're unused elsewhere, makes the code slightly easier to understand. okay and tweak kn@