1
0

Relocate true(1) article

This commit is contained in:
dtb 2022-07-09 19:08:22 -04:00
parent ff8f077829
commit ebbe8d4033
3 changed files with 73 additions and 81 deletions

View File

@ -86,7 +86,6 @@ I'm vaccinated against COVID-19. Are you?
<A HREF="knowledge/cat/" >cat(1)</A>, <A HREF="knowledge/cat/" >cat(1)</A>,
<A HREF="knowledge/c78" >c78</A>, <A HREF="knowledge/c78" >c78</A>,
<A HREF="knowledge/software">software</A>, <A HREF="knowledge/software">software</A>,
<A HREF="knowledge/true" >true(1)</A>,
<A HREF="knowledge/x200t" >X200T</A>; <A HREF="knowledge/x200t" >X200T</A>;
<B>shilling</B>: <B>shilling</B>:
<A HREF="#stickers">#stickers</A> <A HREF="#stickers">#stickers</A>

View File

@ -16,7 +16,6 @@
<SCRIPT SRC="/js/sheets.js" TYPE="application/javascript"></SCRIPT> <SCRIPT SRC="/js/sheets.js" TYPE="application/javascript"></SCRIPT>
<SCRIPT TYPE="application/javascript">window.onload = window.initializesheets;</SCRIPT> <SCRIPT TYPE="application/javascript">window.onload = window.initializesheets;</SCRIPT>
<H1>software</H1> <H1>software</H1>
<H3>updated 2022-05-26</H3>
<HR ALIGN="left" SIZE="1" WIDTH="25%" /> <HR ALIGN="left" SIZE="1" WIDTH="25%" />
<H2>Foreword</H2> <H2>Foreword</H2>
<P> <P>
@ -35,6 +34,11 @@ Ultimately, the humans were the ones that produced the computers, and computers
Try to be kind to everyone but don't take anything too seriously. Try to be kind to everyone but don't take anything too seriously.
</P> </P>
<H2>UNIX</H2>
<UL>
<LI><A HREF="https://github.com/dspinellis/unix-history-repo">unix-history-repo</A> (GitHub)</LI>
</UL>
<H2>ACPI client</H2> <H2>ACPI client</H2>
<P> <P>
An ACPI client is a program that displays computer ACPI information, typically power and thermal statuses. An ACPI client is a program that displays computer ACPI information, typically power and thermal statuses.
@ -299,6 +303,10 @@ Make sure that service is added to runlevel boot.
Configuration is in <CODE>/etc/conf.d/dmcrypt</CODE> and further configuration should be done in <CODE><A HREF="#fstab">fstab</A></CODE>. Configuration is in <CODE>/etc/conf.d/dmcrypt</CODE> and further configuration should be done in <CODE><A HREF="#fstab">fstab</A></CODE>.
<CODE>dm-crypt</CODE> will need the UUID of the <I>physical</I> block device while fstab (if being configured with UUIDs will need the UUID of the decrypted block device in the device mapper. <CODE>dm-crypt</CODE> will need the UUID of the <I>physical</I> block device while fstab (if being configured with UUIDs will need the UUID of the decrypted block device in the device mapper.
</P> </P>
<H3>TestDisk</H3>
<UL>
<LI><A HREF="https://en.wikipedia.org/wiki/TestDisk">TestDisk</A> (Wikipedia)</LI>
</UL>
<H2>PCI Utilities</H2> <H2>PCI Utilities</H2>
<UL> <UL>
@ -342,12 +350,22 @@ Supplies <CODE>lspci(8)</CODE>, <CODE>setpci(8)</CODE>, and <CODE>update-pciids(
<I>Do not</I> use SSL workarounds like (in the case of git) <CODE>GIT_SSL_NO_VERIFY</CODE>. <I>Do not</I> use SSL workarounds like (in the case of git) <CODE>GIT_SSL_NO_VERIFY</CODE>.
These leave your system open to man-in-the-middle attacks. These leave your system open to man-in-the-middle attacks.
</P> </P>
<H3>rc.d</H3>
<UL>
<LI><A HREF="http://www.mewburn.net/luke/papers/rc.d.pdf">The Design and Implementation of the NetBSD rc.d system</A></LI>
</UL>
<H3>System logging</H3> <H3>System logging</H3>
<UL> <UL>
<LI><A HREF="https://www.unitedbsd.com/d/548-system-instability-on-unstable-version-how-do-i-get-logs/7">System instability on unstable version - how do I get logs?</A></LI> <LI><A HREF="https://www.unitedbsd.com/d/548-system-instability-on-unstable-version-how-do-i-get-logs/7">System instability on unstable version - how do I get logs?</A></LI>
</UL> </UL>
<P>See <CODE>syslogd(8)</CODE> and <CODE>syslog.conf(5)</CODE>, which pertain to system logging.</P> <P>See <CODE>syslogd(8)</CODE> and <CODE>syslog.conf(5)</CODE>, which pertain to system logging.</P>
<P>Setting <CODE>DDB_ONPANIC</CODE> (see <CODE>options(4)</CODE> and <CODE>sysctl(8)</CODE>) will save a crash dump at <CODE>/var/crash</CODE> on kernel panic. <P>Setting <CODE>DDB_ONPANIC</CODE> (see <CODE>options(4)</CODE> and <CODE>sysctl(8)</CODE>) will save a crash dump at <CODE>/var/crash</CODE> on kernel panic.
<H3>Upgrading</H3>
<UL>
<LI>The NetBSD Guide - <A HREF="https://www.netbsd.org/docs/guide/en/chap-upgrading.html">Chapter 4: Upgrading NetBSD</A></LI>
<LI><A HREF="https://www.unitedbsd.com/d/110-upgrading-netbsd-using-sysinst">Upgrading NetBSD using sysinst</A></LI>
</UL>
<H2 ID="power">Power</H2> <H2 ID="power">Power</H2>
<P>Much of this can be configured in the ACPI settings in your <A HREF="#login_manager">login manager</A>, provided you have one running that can do this.</P> <P>Much of this can be configured in the ACPI settings in your <A HREF="#login_manager">login manager</A>, provided you have one running that can do this.</P>
@ -401,6 +419,59 @@ Technically <CODE>cat(1)</CODE> and other UNIX utilities can be used in a hacky
You'd be better off using <CODE>ed(1)</CODE>; the UX is very similar. You'd be better off using <CODE>ed(1)</CODE>; the UX is very similar.
</P> </P>
<H2 ID="true">true(1)</H2>
<UL>
<LI><A HREF="http://trillian.mit.edu/~jc/;-)/ATT_Copyright_true.html">CHAMBERS John - The /bin/true Command and Copyright</A></LI>
<LI><A HREF="https://twitter.com/rob_pike/status/966896123548872705">PIKE Rob - "/bin/true used to be an empty file."</A></LI>
<LI><A HREF="https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html">RAITER Brian - A Whirlwind Tutorial on Creating Really Teensy ELF Executables for Linux</A></LI>
<LI><A HREF="https://www.unix.com/man-page/posix/1p/true/">true(1p)</A> (The Open Group, 2003)</LI>
<LI>Notable true implementations<UL>
<LI><B>ongoing</B> started 1992 - <A HREF="https://www.gnu.org/">GNU</A>/<A HREF="https://www.gnu.org/software/coreutils/">coreutils</A> - <A HREF="https://git.savannah.gnu.org/cgit/coreutils.git/tree/src/true.c">src/true.c</A></LI>
<LI><B>ongoing</B> forked from 4.4BSD-Lite2 - <A HREF="https://www.netbsd.org/">NetBSD</A>/<A HREF="https://github.com/NetBSD/src">src</A> - <A HREF="https://github.com/NetBSD/src/blob/trunk/usr.bin/true/true.sh">usr.bin/true/true.sh</A></LI>
</UL></LI>
</UL>
<P>
<CODE>true(1)</CODE> is a tool that <I>only</I> quits silently with an exit status of 0.
Similarly, <CODE>false(1)</CODE> is a tool that <I>only</I> quits silently with an exit status of 1.
Recognizing arguments, printing to standard output, reading from standard input, or otherwise exiting with any other status of 0, is a violation of the POSIX specification for <CODE>true(1)</CODE>.
These utilities find use in shell scripting, which, though extremely relevant to these utilities, is beyond the scope of this article.
</P>
<P>
Because <CODE>true(1)</CODE>'s required functionality is so simple a POSIX-compliant implementation is a one-liner in most languages, so long as you're willing to make an exception in your code styling.
For example, in C:
</P>
<PRE><CODE CLASS="language-c" DATA-LANG="c">
int main(void) { return 0; }
</CODE></PRE>
<P>
Because executing an empty shellscript file will in most shells do nothing and return an exit status of 0, technically an empty shellscript file is a POSIX-compliant <CODE>true(1)</CODE> implementation in 0 bytes.
This was the <CODE>true(1)</CODE> implementation on early versions of UNIX, including Research UNIX, System V, and Sun's Solaris, according to both Rob Pike and John Chambers.
A more explicit implementation also exists in POSIX shell:
</P>
<PRE><CODE CLASS="language-shell" DATA-LANG="shell">
#!/bin/sh
exit 0
</CODE></PRE>
<P>
This happens to be nearly identical in source to the implementation used by NetBSD.
</P>
<P>
Python has the same 0 byte <CODE>true(1)</CODE> implementation feature as most shells.
Here's <CODE><I>false</I>(1)</CODE> in Python rather than <CODE>true(1)</CODE> to demonstrate how exiting with an arbitrary exit status can be done:
</P>
<PRE><CODE CLASS="language-python" DATA-LANG="python">
import sys
sys.exit(1)
</CODE></PRE>
<P>
In some shells, <CODE>true(1)</CODE> is a shell built-in command, so running <CODE>true</CODE> will run the shell author's implementation of <CODE>true(1)</CODE> rather than the system implementation.
</P>
<P>
GNU <CODE>true(1)</CODE>, from the GNU coreutils, is well known for being a maximalist implementation - it's eighty lines long and directly includes four C header files.
Their <CODE>true.c</CODE> is 2.3 kilobytes and parses the arguments <CODE>--help</CODE> and <CODE>--version</CODE> (only if either are the first argument to the program).
The GNU coreutils implementation of <CODE>true(1)</CODE> is not POSIX compliant.
</P>
<H2>util-linux</H2> <H2>util-linux</H2>
<UL> <UL>
<LI><A HREF="https://en.wikipedia.org/wiki/Util-linux">util-linux - Wikipedia</A></LI> <LI><A HREF="https://en.wikipedia.org/wiki/Util-linux">util-linux - Wikipedia</A></LI>
@ -426,7 +497,7 @@ network={
} }
</PRE> </PRE>
<P> <P>
See <CODE>wpa_supplicant.conf(5)<CODE>. See <CODE>wpa_supplicant.conf(5)</CODE>.
</P> </P>
<H2>X</H2> <H2>X</H2>

View File

@ -1,78 +0,0 @@
<!DOCTYPE html>
<HTML LANG="en">
<HEAD>
<LINK HREF="http://www.trinity.moe/knowledge/true" REL="canonical" />
<LINK HREF="https://raw.githubusercontent.com/devenblake/homepage/main/favicon.ico" REL="shortcut icon" TYPE="image/x-icon" />
<LINK HREF="/css/blank.css" ID="styling" REL="stylesheet" />
<META CHARSET="UTF-8" />
<META CONTENT="noindex" NAME="googlebot" /> <!-- FUCK GOOGLE -->
<META CONTENT="interest-cohort=()" HTTP-EQUIV="Permissions-Policy" /> <!-- FUCK GOOGLE -->
<META NAME="viewport" CONTENT="width=device-width, initial-scale=1" />
<TITLE>true(1)</TITLE>
</HEAD>
<BODY>
<P><A HREF="/">~ Return to the rest of the site</A></P>
<SCRIPT SRC="/js/cookies.js" TYPE="application/javascript"></SCRIPT>
<SCRIPT SRC="/js/sheets.js" TYPE="application/javascript"></SCRIPT>
<SCRIPT TYPE="application/javascript">window.onload = window.initializesheets;</SCRIPT>
<H1>POSIX true(1)</H1>
<H3>updated 2021-08-18</H3>
<HR ALIGN="left" SIZE="1" WIDTH="25%" />
<P>
<CODE>true(1)</CODE> is a tool that <I>only</I> quits silently with an exit status of 0.
Similarly, <CODE>false(1)</CODE> is a tool that <I>only</I> quits silently with an exit status of 1.
Recognizing arguments, printing to standard output, reading from standard input, or otherwise exiting with any other status of 0, is a violation of the POSIX specification for <CODE>true(1)</CODE>.
These utilities find use in shell scripting, which, though extremely relevant to these utilities, is beyond the scope of this article.
</P>
<P>
Because <CODE>true(1)</CODE>'s required functionality is so simple a POSIX-compliant implementation is a one-liner in most languages, so long as you're willing to make an exception in your code styling.
For example, in C:
</P>
<PRE><CODE CLASS="language-c" DATA-LANG="c">
int main(void) { return 0; }
</CODE></PRE>
<P>
Because executing an empty shellscript file will in most shells do nothing and return an exit status of 0, technically an empty shellscript file is a POSIX-compliant <CODE>true(1)</CODE> implementation in 0 bytes.
This was the <CODE>true(1)</CODE> implementation on early versions of UNIX, including Research UNIX, System V, and Sun's Solaris, according to both Rob Pike and John Chambers.
A more explicit implementation also exists in POSIX shell:
</P>
<PRE><CODE CLASS="language-shell" DATA-LANG="shell">
#!/bin/sh
exit 0
</CODE></PRE>
<P>
This happens to be nearly identical in source to the implementation used by NetBSD.
</P>
<P>
Python has the same 0 byte <CODE>true(1)</CODE> implementation feature as most shells.
Here's <CODE><I>false</I>(1)</CODE> in Python rather than <CODE>true(1)</CODE> to demonstrate how exiting with an arbitrary exit status can be done:
</P>
<PRE><CODE CLASS="language-python" DATA-LANG="python">
import sys
sys.exit(1)
</CODE></PRE>
<P>
In some shells, <CODE>true(1)</CODE> is a shell built-in command, so running <CODE>true</CODE> will run the shell author's implementation of <CODE>true(1)</CODE> rather than the system implementation.
</P>
<P>
GNU <CODE>true(1)</CODE>, from the GNU coreutils, deserves a special mention, as it's eighty lines long and directly includes four C header files.
This is not a joke.
Their <CODE>true.c</CODE> is 2.3 kilobytes, parses the arguments <CODE>--help</CODE> and <CODE>--version</CODE> (only if either are the first argument to the program), and I don't know how big the executable ends up being because the first thing I do when I take control of a GNU system is <CODE>dd if=/dev/null of="$(which true)";chmod +x "$(which true)"</CODE> (<B>use at your own risk</B>).
The GNU coreutils implementation of <CODE>true(1)</CODE> is not POSIX compliant.
</P>
<H2>Cited media and further reading</H2><UL>
<LI>Articles and posts<UL>
<LI><A HREF="http://trillian.mit.edu/~jc/;-)/ATT_Copyright_true.html">CHAMBERS John - The /bin/true Command and Copyright</A></LI>
<LI><A HREF="https://twitter.com/rob_pike/status/966896123548872705">PIKE Rob - "/bin/true used to be an empty file."</A></LI>
<LI><A HREF="https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html">RAITER Brian - A Whirlwind Tutorial on Creating Really Teensy ELF Executables for Linux</A></LI>
</UL></LI>
<LI>Manual pages<UL>
<LI><A HREF="https://www.unix.com/man-page/posix/1p/true/">true(1p)</A> (The Open Group, 2003)</LI>
</UL></LI>
<LI>Notable true implementations<UL>
<LI><B>ongoing</B> started 1992 - <A HREF="https://www.gnu.org/">GNU</A>/<A HREF="https://www.gnu.org/software/coreutils/">coreutils</A> - <A HREF="https://git.savannah.gnu.org/cgit/coreutils.git/tree/src/true.c">src/true.c</A></LI>
<LI><B>ongoing</B> forked from 4.4BSD-Lite2 - <A HREF="https://www.netbsd.org/">NetBSD</A>/<A HREF="https://github.com/NetBSD/src">src</A> - <A HREF="https://github.com/NetBSD/src/blob/trunk/usr.bin/true/true.sh">usr.bin/true/true.sh</A></LI>
</UL></LI>
</UL>
</BODY>
</HTML>