xargs article: add some notes for portability and historic context - www.codemadness.org - www.codemadness.org saait content files
 (HTM) git clone git://git.codemadness.org/www.codemadness.org
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 48acce4b0ec634fc893b61589bd755069a70f25f
 (DIR) parent 7f6beb4e5733154d4067672b4a0d0e4e51e23fd2
 (HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
       Date:   Sun, 17 Dec 2023 12:34:39 +0100
       
       xargs article: add some notes for portability and historic context
       
       Diffstat:
         M config.cfg                          |       2 +-
         M output/atom.xml                     |       4 ++--
         M output/atom_content.xml             |      53 ++++++++++++++++++++++++++-----
         M output/rss_content.xml              |      49 +++++++++++++++++++++++++++----
         M output/sitemap.xml                  |       2 +-
         M output/xargs.html                   |      49 +++++++++++++++++++++++++++----
         M output/xargs.md                     |      65 +++++++++++++++++++++++++++----
         M pages/xargs.cfg                     |       2 +-
         M pages/xargs.md                      |      65 +++++++++++++++++++++++++++----
       
       9 files changed, 252 insertions(+), 39 deletions(-)
       ---
 (DIR) diff --git a/config.cfg b/config.cfg
       @@ -1,5 +1,5 @@
        # last updated the site.
       -siteupdated = 2023-11-22
       +siteupdated = 2023-12-17
        
        sitetitle = Codemadness
        siteurl = https://www.codemadness.org
 (DIR) diff --git a/output/atom.xml b/output/atom.xml
       @@ -2,7 +2,7 @@
        <feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
                <title>Codemadness</title>
                <subtitle>blog with various projects and articles about computer-related things</subtitle>
       -        <updated>2023-11-22T00:00:00Z</updated>
       +        <updated>2023-12-17T00:00:00Z</updated>
                <link rel="alternate" type="text/html" href="https://www.codemadness.org" />
                <id>https://www.codemadness.org/atom.xml</id>
                <link rel="self" type="application/atom+xml" href="https://www.codemadness.org/atom.xml" />
       @@ -10,7 +10,7 @@
                <title>xargs: an example for parallel batch jobs</title>
                <link rel="alternate" type="text/html" href="https://www.codemadness.org/xargs.html" />
                <id>https://www.codemadness.org/xargs.html</id>
       -        <updated>2023-11-23T00:00:00Z</updated>
       +        <updated>2023-12-17T00:00:00Z</updated>
                <published>2023-11-22T00:00:00Z</published>
                <author>
                        <name>Hiltjo</name>
 (DIR) diff --git a/output/atom_content.xml b/output/atom_content.xml
       @@ -2,7 +2,7 @@
        <feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
                <title>Codemadness</title>
                <subtitle>blog with various projects and articles about computer-related things</subtitle>
       -        <updated>2023-11-22T00:00:00Z</updated>
       +        <updated>2023-12-17T00:00:00Z</updated>
                <link rel="alternate" type="text/html" href="https://www.codemadness.org" />
                <id>https://www.codemadness.org/atom_content.xml</id>
                <link rel="self" type="application/atom+xml" href="https://www.codemadness.org/atom_content.xml" />
       @@ -10,7 +10,7 @@
                <title>xargs: an example for parallel batch jobs</title>
                <link rel="alternate" type="text/html" href="https://www.codemadness.org/xargs.html" />
                <id>https://www.codemadness.org/xargs.html</id>
       -        <updated>2023-11-23T00:00:00Z</updated>
       +        <updated>2023-12-17T00:00:00Z</updated>
                <published>2023-11-22T00:00:00Z</published>
                <author>
                        <name>Hiltjo</name>
       @@ -18,7 +18,7 @@
                </author>
                <summary>xargs: an example for parallel batch jobs</summary>
                <content type="html"><![CDATA[<h1>xargs: an example for parallel batch jobs</h1>
       -        <p><strong>Last modification on </strong> <time>2023-11-23</time></p>
       +        <p><strong>Last modification on </strong> <time>2023-12-17</time></p>
                <p>This describes a simple shellscript programming pattern to process a list of
        jobs in parallel. This script example is contained in one file.</p>
        <h1>Simple but less optimal example</h1>
       @@ -156,11 +156,7 @@ For example if the program is killed, stopped or the exit status is 255 then
        xargs stops running also.</p>
        </li>
        </ul>
       -<h1>xargs -P and portability</h1>
       -<p>Note that some of the options, like -P are as of writing (2023) non-POSIX:
       -<a href="https://pubs.opengroup.org/onlinepubs/9699919799/">https://pubs.opengroup.org/onlinepubs/9699919799/</a>.
       -However many systems support this useful extension.</p>
       -<h1>Explanation of used xargs options:</h1>
       +<h1>Description of used xargs options</h1>
        <p>From the OpenBSD man page: <a href="https://man.openbsd.org/xargs">https://man.openbsd.org/xargs</a></p>
        <pre><code>xargs - construct argument list(s) and execute utility
        </code></pre>
       @@ -177,6 +173,47 @@ ending in unescaped white space and the next non-empty line are considered
        to form one single line. If EOF is reached and fewer than number lines have
        been read then utility will be called with the available lines.</li>
        </ul>
       +<h1>xargs options -0 and -P, portability and historic context</h1>
       +<p>Some of the options, like -P are as of writing (2023) non-POSIX:
       +<a href="https://pubs.opengroup.org/onlinepubs/9699919799/utilities/xargs.html">https://pubs.opengroup.org/onlinepubs/9699919799/utilities/xargs.html</a>.
       +However many systems support this useful extension for many years now.</p>
       +<p>The specification even mentions implementations which support parallel
       +operations:</p>
       +<p>"The version of xargs required by this volume of POSIX.1-2017 is required to
       +wait for the completion of the invoked command before invoking another command.
       +This was done because historical scripts using xargs assumed sequential
       +execution. Implementations wanting to provide parallel operation of the invoked
       +utilities are encouraged to add an option enabling parallel invocation, but
       +should still wait for termination of all of the children before xargs
       +terminates normally."</p>
       +<p>Some historic context:</p>
       +<p>The xargs -0 option was added on 1996-06-11 by Theo de Raadt, about a year
       +after the NetBSD import (over 27 years ago at the time of writing):</p>
       +<p><a href="http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/xargs/xargs.c?rev=1.2&amp;content-type=text/x-cvsweb-markup">CVS log</a></p>
       +<p>On OpenBSD the xargs -P option was added on 2003-12-06 by syncing the FreeBSD
       +code:</p>
       +<p><a href="http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/xargs/xargs.c?rev=1.14&amp;content-type=text/x-cvsweb-markup">CVS log</a></p>
       +<p>Looking at the imported git history log of GNU findutils (which has xargs), the
       +very first commit already had the -0 and -P option:</p>
       +<p><a href="https://savannah.gnu.org/git/?group=findutils">git log</a></p>
       +<pre><code>commit c030b5ee33bbec3c93cddc3ca9ebec14c24dbe07
       +Author: Kevin Dalley &lt;kevin@seti.org&gt;
       +Date:   Sun Feb 4 20:35:16 1996 +0000
       +
       +    Initial revision
       +</code></pre>
       +<h1>xargs: some incompatibilities found</h1>
       +<ul>
       +<li>Using the -0 option empty fields are handled differently in different
       +implementations.</li>
       +<li>The -n and -L option doesn't work correctly in many of the BSD implementations.
       +Some count empty fields, some don't.  In early implementations in FreeBSD and
       +OpenBSD it only processed the first line.  In OpenBSD it has been improved
       +around 2017.</li>
       +</ul>
       +<p>Depending on what you want to do a workaround could be to use the -0 option
       +with a single field and use the -n flag.  Then in each child program invocation
       +split the field by a separator.</p>
        <h1>References</h1>
        <ul>
        <li>xargs: <a href="https://man.openbsd.org/xargs">https://man.openbsd.org/xargs</a></li>
 (DIR) diff --git a/output/rss_content.xml b/output/rss_content.xml
       @@ -13,7 +13,7 @@
                <dc:date>2023-11-22T00:00:00Z</dc:date>
                <author>Hiltjo</author>
                <description><![CDATA[<h1>xargs: an example for parallel batch jobs</h1>
       -        <p><strong>Last modification on </strong> <time>2023-11-23</time></p>
       +        <p><strong>Last modification on </strong> <time>2023-12-17</time></p>
                <p>This describes a simple shellscript programming pattern to process a list of
        jobs in parallel. This script example is contained in one file.</p>
        <h1>Simple but less optimal example</h1>
       @@ -151,11 +151,7 @@ For example if the program is killed, stopped or the exit status is 255 then
        xargs stops running also.</p>
        </li>
        </ul>
       -<h1>xargs -P and portability</h1>
       -<p>Note that some of the options, like -P are as of writing (2023) non-POSIX:
       -<a href="https://pubs.opengroup.org/onlinepubs/9699919799/">https://pubs.opengroup.org/onlinepubs/9699919799/</a>.
       -However many systems support this useful extension.</p>
       -<h1>Explanation of used xargs options:</h1>
       +<h1>Description of used xargs options</h1>
        <p>From the OpenBSD man page: <a href="https://man.openbsd.org/xargs">https://man.openbsd.org/xargs</a></p>
        <pre><code>xargs - construct argument list(s) and execute utility
        </code></pre>
       @@ -172,6 +168,47 @@ ending in unescaped white space and the next non-empty line are considered
        to form one single line. If EOF is reached and fewer than number lines have
        been read then utility will be called with the available lines.</li>
        </ul>
       +<h1>xargs options -0 and -P, portability and historic context</h1>
       +<p>Some of the options, like -P are as of writing (2023) non-POSIX:
       +<a href="https://pubs.opengroup.org/onlinepubs/9699919799/utilities/xargs.html">https://pubs.opengroup.org/onlinepubs/9699919799/utilities/xargs.html</a>.
       +However many systems support this useful extension for many years now.</p>
       +<p>The specification even mentions implementations which support parallel
       +operations:</p>
       +<p>"The version of xargs required by this volume of POSIX.1-2017 is required to
       +wait for the completion of the invoked command before invoking another command.
       +This was done because historical scripts using xargs assumed sequential
       +execution. Implementations wanting to provide parallel operation of the invoked
       +utilities are encouraged to add an option enabling parallel invocation, but
       +should still wait for termination of all of the children before xargs
       +terminates normally."</p>
       +<p>Some historic context:</p>
       +<p>The xargs -0 option was added on 1996-06-11 by Theo de Raadt, about a year
       +after the NetBSD import (over 27 years ago at the time of writing):</p>
       +<p><a href="http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/xargs/xargs.c?rev=1.2&amp;content-type=text/x-cvsweb-markup">CVS log</a></p>
       +<p>On OpenBSD the xargs -P option was added on 2003-12-06 by syncing the FreeBSD
       +code:</p>
       +<p><a href="http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/xargs/xargs.c?rev=1.14&amp;content-type=text/x-cvsweb-markup">CVS log</a></p>
       +<p>Looking at the imported git history log of GNU findutils (which has xargs), the
       +very first commit already had the -0 and -P option:</p>
       +<p><a href="https://savannah.gnu.org/git/?group=findutils">git log</a></p>
       +<pre><code>commit c030b5ee33bbec3c93cddc3ca9ebec14c24dbe07
       +Author: Kevin Dalley &lt;kevin@seti.org&gt;
       +Date:   Sun Feb 4 20:35:16 1996 +0000
       +
       +    Initial revision
       +</code></pre>
       +<h1>xargs: some incompatibilities found</h1>
       +<ul>
       +<li>Using the -0 option empty fields are handled differently in different
       +implementations.</li>
       +<li>The -n and -L option doesn't work correctly in many of the BSD implementations.
       +Some count empty fields, some don't.  In early implementations in FreeBSD and
       +OpenBSD it only processed the first line.  In OpenBSD it has been improved
       +around 2017.</li>
       +</ul>
       +<p>Depending on what you want to do a workaround could be to use the -0 option
       +with a single field and use the -n flag.  Then in each child program invocation
       +split the field by a separator.</p>
        <h1>References</h1>
        <ul>
        <li>xargs: <a href="https://man.openbsd.org/xargs">https://man.openbsd.org/xargs</a></li>
 (DIR) diff --git a/output/sitemap.xml b/output/sitemap.xml
       @@ -2,7 +2,7 @@
        <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
        <url>
                <loc>https://www.codemadness.org/xargs.html</loc>
       -        <lastmod>2023-11-23</lastmod>
       +        <lastmod>2023-12-17</lastmod>
        </url>
        <url>
                <loc>https://www.codemadness.org/youtube-feed.html</loc>
 (DIR) diff --git a/output/xargs.html b/output/xargs.html
       @@ -42,7 +42,7 @@
        <header>
                <h1>xargs: an example for parallel batch jobs</h1>
                <p>
       -        <strong>Last modification on </strong> <time>2023-11-23</time>
       +        <strong>Last modification on </strong> <time>2023-12-17</time>
                </p>
        </header>
        
       @@ -183,11 +183,7 @@ For example if the program is killed, stopped or the exit status is 255 then
        xargs stops running also.</p>
        </li>
        </ul>
       -<h1>xargs -P and portability</h1>
       -<p>Note that some of the options, like -P are as of writing (2023) non-POSIX:
       -<a href="https://pubs.opengroup.org/onlinepubs/9699919799/">https://pubs.opengroup.org/onlinepubs/9699919799/</a>.
       -However many systems support this useful extension.</p>
       -<h1>Explanation of used xargs options:</h1>
       +<h1>Description of used xargs options</h1>
        <p>From the OpenBSD man page: <a href="https://man.openbsd.org/xargs">https://man.openbsd.org/xargs</a></p>
        <pre><code>xargs - construct argument list(s) and execute utility
        </code></pre>
       @@ -204,6 +200,47 @@ ending in unescaped white space and the next non-empty line are considered
        to form one single line. If EOF is reached and fewer than number lines have
        been read then utility will be called with the available lines.</li>
        </ul>
       +<h1>xargs options -0 and -P, portability and historic context</h1>
       +<p>Some of the options, like -P are as of writing (2023) non-POSIX:
       +<a href="https://pubs.opengroup.org/onlinepubs/9699919799/utilities/xargs.html">https://pubs.opengroup.org/onlinepubs/9699919799/utilities/xargs.html</a>.
       +However many systems support this useful extension for many years now.</p>
       +<p>The specification even mentions implementations which support parallel
       +operations:</p>
       +<p>"The version of xargs required by this volume of POSIX.1-2017 is required to
       +wait for the completion of the invoked command before invoking another command.
       +This was done because historical scripts using xargs assumed sequential
       +execution. Implementations wanting to provide parallel operation of the invoked
       +utilities are encouraged to add an option enabling parallel invocation, but
       +should still wait for termination of all of the children before xargs
       +terminates normally."</p>
       +<p>Some historic context:</p>
       +<p>The xargs -0 option was added on 1996-06-11 by Theo de Raadt, about a year
       +after the NetBSD import (over 27 years ago at the time of writing):</p>
       +<p><a href="http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/xargs/xargs.c?rev=1.2&amp;content-type=text/x-cvsweb-markup">CVS log</a></p>
       +<p>On OpenBSD the xargs -P option was added on 2003-12-06 by syncing the FreeBSD
       +code:</p>
       +<p><a href="http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/xargs/xargs.c?rev=1.14&amp;content-type=text/x-cvsweb-markup">CVS log</a></p>
       +<p>Looking at the imported git history log of GNU findutils (which has xargs), the
       +very first commit already had the -0 and -P option:</p>
       +<p><a href="https://savannah.gnu.org/git/?group=findutils">git log</a></p>
       +<pre><code>commit c030b5ee33bbec3c93cddc3ca9ebec14c24dbe07
       +Author: Kevin Dalley &lt;kevin@seti.org&gt;
       +Date:   Sun Feb 4 20:35:16 1996 +0000
       +
       +    Initial revision
       +</code></pre>
       +<h1>xargs: some incompatibilities found</h1>
       +<ul>
       +<li>Using the -0 option empty fields are handled differently in different
       +implementations.</li>
       +<li>The -n and -L option doesn't work correctly in many of the BSD implementations.
       +Some count empty fields, some don't.  In early implementations in FreeBSD and
       +OpenBSD it only processed the first line.  In OpenBSD it has been improved
       +around 2017.</li>
       +</ul>
       +<p>Depending on what you want to do a workaround could be to use the -0 option
       +with a single field and use the -n flag.  Then in each child program invocation
       +split the field by a separator.</p>
        <h1>References</h1>
        <ul>
        <li>xargs: <a href="https://man.openbsd.org/xargs">https://man.openbsd.org/xargs</a></li>
 (DIR) diff --git a/output/xargs.md b/output/xargs.md
       @@ -154,14 +154,8 @@ The child process:
          xargs stops running also.
        
        
       -# xargs -P and portability
        
       -Note that some of the options, like -P are as of writing (2023) non-POSIX:
       -<https://pubs.opengroup.org/onlinepubs/9699919799/>.
       -However many systems support this useful extension.
       -
       -
       -# Explanation of used xargs options:
       +# Description of used xargs options
        
        From the OpenBSD man page: <https://man.openbsd.org/xargs>
        
       @@ -181,6 +175,63 @@ Options explained:
          been read then utility will be called with the available lines.
        
        
       +# xargs options -0 and -P, portability and historic context
       +
       +Some of the options, like -P are as of writing (2023) non-POSIX:
       +<https://pubs.opengroup.org/onlinepubs/9699919799/utilities/xargs.html>.
       +However many systems support this useful extension for many years now.
       +
       +The specification even mentions implementations which support parallel
       +operations:
       +
       +"The version of xargs required by this volume of POSIX.1-2017 is required to
       +wait for the completion of the invoked command before invoking another command.
       +This was done because historical scripts using xargs assumed sequential
       +execution. Implementations wanting to provide parallel operation of the invoked
       +utilities are encouraged to add an option enabling parallel invocation, but
       +should still wait for termination of all of the children before xargs
       +terminates normally."
       +
       +
       +Some historic context:
       +
       +The xargs -0 option was added on 1996-06-11 by Theo de Raadt, about a year
       +after the NetBSD import (over 27 years ago at the time of writing):
       +
       +[CVS log](http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/xargs/xargs.c?rev=1.2&content-type=text/x-cvsweb-markup)
       +
       +On OpenBSD the xargs -P option was added on 2003-12-06 by syncing the FreeBSD
       +code:
       +
       +[CVS log](http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/xargs/xargs.c?rev=1.14&content-type=text/x-cvsweb-markup)
       +
       +
       +Looking at the imported git history log of GNU findutils (which has xargs), the
       +very first commit already had the -0 and -P option:
       +
       +[git log](https://savannah.gnu.org/git/?group=findutils)
       +
       +        commit c030b5ee33bbec3c93cddc3ca9ebec14c24dbe07
       +        Author: Kevin Dalley <kevin@seti.org>
       +        Date:   Sun Feb 4 20:35:16 1996 +0000
       +        
       +            Initial revision
       +
       +
       +# xargs: some incompatibilities found
       +
       +* Using the -0 option empty fields are handled differently in different
       +  implementations.
       +* The -n and -L option doesn't work correctly in many of the BSD implementations.
       +  Some count empty fields, some don't.  In early implementations in FreeBSD and
       +  OpenBSD it only processed the first line.  In OpenBSD it has been improved
       +  around 2017.
       +
       +Depending on what you want to do a workaround could be to use the -0 option
       +with a single field and use the -n flag.  Then in each child program invocation
       +split the field by a separator.
       +
       +
        # References
        
        * xargs: <https://man.openbsd.org/xargs>
 (DIR) diff --git a/pages/xargs.cfg b/pages/xargs.cfg
       @@ -3,4 +3,4 @@ id = xargs
        description = xargs: an example for parallel batch jobs
        keywords = xargs, wow hyper speed
        created = 2023-11-22
       -updated = 2023-11-23
       +updated = 2023-12-17
 (DIR) diff --git a/pages/xargs.md b/pages/xargs.md
       @@ -154,14 +154,8 @@ The child process:
          xargs stops running also.
        
        
       -# xargs -P and portability
        
       -Note that some of the options, like -P are as of writing (2023) non-POSIX:
       -<https://pubs.opengroup.org/onlinepubs/9699919799/>.
       -However many systems support this useful extension.
       -
       -
       -# Explanation of used xargs options:
       +# Description of used xargs options
        
        From the OpenBSD man page: <https://man.openbsd.org/xargs>
        
       @@ -181,6 +175,63 @@ Options explained:
          been read then utility will be called with the available lines.
        
        
       +# xargs options -0 and -P, portability and historic context
       +
       +Some of the options, like -P are as of writing (2023) non-POSIX:
       +<https://pubs.opengroup.org/onlinepubs/9699919799/utilities/xargs.html>.
       +However many systems support this useful extension for many years now.
       +
       +The specification even mentions implementations which support parallel
       +operations:
       +
       +"The version of xargs required by this volume of POSIX.1-2017 is required to
       +wait for the completion of the invoked command before invoking another command.
       +This was done because historical scripts using xargs assumed sequential
       +execution. Implementations wanting to provide parallel operation of the invoked
       +utilities are encouraged to add an option enabling parallel invocation, but
       +should still wait for termination of all of the children before xargs
       +terminates normally."
       +
       +
       +Some historic context:
       +
       +The xargs -0 option was added on 1996-06-11 by Theo de Raadt, about a year
       +after the NetBSD import (over 27 years ago at the time of writing):
       +
       +[CVS log](http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/xargs/xargs.c?rev=1.2&content-type=text/x-cvsweb-markup)
       +
       +On OpenBSD the xargs -P option was added on 2003-12-06 by syncing the FreeBSD
       +code:
       +
       +[CVS log](http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/xargs/xargs.c?rev=1.14&content-type=text/x-cvsweb-markup)
       +
       +
       +Looking at the imported git history log of GNU findutils (which has xargs), the
       +very first commit already had the -0 and -P option:
       +
       +[git log](https://savannah.gnu.org/git/?group=findutils)
       +
       +        commit c030b5ee33bbec3c93cddc3ca9ebec14c24dbe07
       +        Author: Kevin Dalley <kevin@seti.org>
       +        Date:   Sun Feb 4 20:35:16 1996 +0000
       +        
       +            Initial revision
       +
       +
       +# xargs: some incompatibilities found
       +
       +* Using the -0 option empty fields are handled differently in different
       +  implementations.
       +* The -n and -L option doesn't work correctly in many of the BSD implementations.
       +  Some count empty fields, some don't.  In early implementations in FreeBSD and
       +  OpenBSD it only processed the first line.  In OpenBSD it has been improved
       +  around 2017.
       +
       +Depending on what you want to do a workaround could be to use the -0 option
       +with a single field and use the -n flag.  Then in each child program invocation
       +split the field by a separator.
       +
       +
        # References
        
        * xargs: <https://man.openbsd.org/xargs>