summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2015-02-23 23:28:58 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2015-02-23 23:28:58 +0000
commitfe1f70d5f729e331facf481ec45cc1c64e095d85 (patch)
tree54ecbfa97635cf15f1e7b1cbd8eae33939ad1747
parent1a193920ece5297d8676afef5b1e69e785522ad3 (diff)
downloads6-portable-utils-2.0.2.0.tar.xz
Add s6-hiercopy (based on skalibs)v2.0.2.0
Version: rc for 2.0.2.0
-rw-r--r--INSTALL2
-rw-r--r--doc/index.html6
-rw-r--r--doc/s6-hiercopy.html66
-rw-r--r--doc/upgrade.html8
-rw-r--r--package/deps.mak3
-rw-r--r--package/info2
-rw-r--r--package/modes1
-rw-r--r--package/targets.mak1
-rw-r--r--src/skaembutils/deps-exe/s6-hiercopy1
-rw-r--r--src/skaembutils/s6-hiercopy.c17
10 files changed, 103 insertions, 4 deletions
diff --git a/INSTALL b/INSTALL
index 00d050d..083a780 100644
--- a/INSTALL
+++ b/INSTALL
@@ -6,7 +6,7 @@ Build Instructions
- A POSIX-compliant C development environment
- GNU make version 4.0 or later
- - skalibs version 2.2.0.0 or later: http://skarnet.org/software/skalibs/
+ - skalibs version 2.3.1.0 or later: http://skarnet.org/software/skalibs/
This software will run on any operating system that implements
POSIX.1-2008, available at:
diff --git a/doc/index.html b/doc/index.html
index 5d00821..95b4372 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -60,7 +60,9 @@ the package is now used to host specific utilities such as
<li> A POSIX-compliant system with a standard C development environment </li>
<li> GNU make, version 4.0 or later </li>
<li> <a href="http://skarnet.org/software/skalibs/">skalibs</a> version
-2.2.0.0 or later </li>
+2.3.1.0 or later. It's a build-time requirement. It's also a run-time
+requirement if you link against the shared version of the skalibs
+library. </li>
</ul>
<h3> Licensing </h3>
@@ -74,7 +76,7 @@ the package is now used to host specific utilities such as
<ul>
<li> The current released version of s6-portable-utils is
-<a href="s6-portable-utils-2.0.1.0.tar.gz">2.0.1.0</a>. </li>
+<a href="s6-portable-utils-2.0.2.0.tar.gz">2.0.2.0</a>. </li>
<li> Alternatively, you can checkout a copy of the s6-portable-utils git repository:
<pre> git clone git://git.skarnet.org/s6-portable-utils </pre> </li>
</ul>
diff --git a/doc/s6-hiercopy.html b/doc/s6-hiercopy.html
new file mode 100644
index 0000000..a4c12f0
--- /dev/null
+++ b/doc/s6-hiercopy.html
@@ -0,0 +1,66 @@
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <meta http-equiv="Content-Language" content="en" />
+ <title>s6-portable-utils: the s6-hiercopy program</title>
+ <meta name="Description" content="s6-portable-utils: the s6-hiercopy program" />
+ <meta name="Keywords" content="s6 linux administration root utilities hiercopy cp -a" />
+ <!-- <link rel="stylesheet" type="text/css" href="http://skarnet.org/default.css" /> -->
+ </head>
+<body>
+
+<p>
+<a href="index.html">s6-portable-utils</a><br />
+<a href="http://skarnet.org/software/">Software</a><br />
+<a href="http://skarnet.org/">skarnet.org</a>
+</p>
+
+<h1> The <tt>s6-hiercopy</tt> program </h1>
+
+<p>
+<tt>s6-hiercopy</tt> copies a directory structure recursively.
+</p>
+
+<h2> Interface </h2>
+
+<pre>
+ s6-hiercopy <em>source</em> <em>destination</em>
+</pre>
+
+<ul>
+ <li> <tt>s6-hiercopy</tt> recursively copies <em>source</em> to
+<em>destination</em>, which is created if it doesn't exist.
+The permissions are preserved. The owner and group are preserved
+if the user is the superuser. </li>
+ <li> It exits 0 on success and 111 on temporary failure. </li>
+</ul>
+
+<h2> Notes </h2>
+
+<ul>
+ <li> Copying files and browsing through directories is one of Unix's
+weakest points, and <tt>s6-hiercopy</tt> is not meant to work around
+the problem; it's only a quick hack that I needed to boot my embedded
+platform. I originally planned to write the ultimate <tt>cp</tt> utility,
+portable and reliable and featureful and everything - while needing
+approximately a hundred times less resources than GNU <tt>cp</tt> does,
+of course. But I eventually dropped the idea: it's impossible to
+design, much less write, such a utility. Notably,
+ you cannot make it reliable because Unix's set of filesystem
+management primitives is just too weak. It lacks a lot of atomic
+operations, and filesystem transactions. As a result, <tt>s6-hiercopy</tt>
+is a walking race condition and should <strong>absolutely not</strong>
+be considered instant when used in a multitasking environment.
+But then, <tt>cp</tt> shouldn't either. </li>
+ <li> There is no standard way of creating device nodes on a
+filesystem, so any <tt>cp</tt>-like utility is inherently
+non-portable. Fortunately, most systems still agree on the non-portable usages of
+<a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/mknod.html">mknod
+specification</a>, so things should work in practice. Consequently,
+the s6-hiercopy utility has been moved from
+<a href="http://skarnet.org/software/s6-linux-utils/">s6-linux-utils</a>
+to s6-portable-utils. </li>
+</ul>
+
+</body>
+</html>
diff --git a/doc/upgrade.html b/doc/upgrade.html
index 70d8b07..26bb1a8 100644
--- a/doc/upgrade.html
+++ b/doc/upgrade.html
@@ -17,6 +17,14 @@
<h1> What has changed in s6-portable-utils </h1>
+<h2> in 2.0.2.0 </h2>
+
+<ul>
+ <li> skalibs dependency bumped to 2.3.1.0. </li>
+ <li> s6-hiercopy now belongs to this package. (It formely belonged
+to s6-linux-utils, but it is actually portable in practice.) </li>
+</ul>
+
<h2> in 2.0.1.0 </h2>
<ul>
diff --git a/package/deps.mak b/package/deps.mak
index adbca33..8ea0be0 100644
--- a/package/deps.mak
+++ b/package/deps.mak
@@ -16,6 +16,7 @@ src/skaembutils/s6-false.o src/skaembutils/s6-false.lo: src/skaembutils/s6-false
src/skaembutils/s6-format-filter.o src/skaembutils/s6-format-filter.lo: src/skaembutils/s6-format-filter.c
src/skaembutils/s6-grep.o src/skaembutils/s6-grep.lo: src/skaembutils/s6-grep.c
src/skaembutils/s6-head.o src/skaembutils/s6-head.lo: src/skaembutils/s6-head.c
+src/skaembutils/s6-hiercopy.o src/skaembutils/s6-hiercopy.lo: src/skaembutils/s6-hiercopy.c
src/skaembutils/s6-linkname.o src/skaembutils/s6-linkname.lo: src/skaembutils/s6-linkname.c
src/skaembutils/s6-ln.o src/skaembutils/s6-ln.lo: src/skaembutils/s6-ln.c
src/skaembutils/s6-ls.o src/skaembutils/s6-ls.lo: src/skaembutils/s6-ls.c
@@ -71,6 +72,8 @@ s6-grep: private EXTRA_LIBS :=
s6-grep: src/skaembutils/s6-grep.o -lskarnet
s6-head: private EXTRA_LIBS :=
s6-head: src/skaembutils/s6-head.o -lskarnet
+s6-hiercopy: private EXTRA_LIBS :=
+s6-hiercopy: src/skaembutils/s6-hiercopy.o -lskarnet
s6-linkname: private EXTRA_LIBS :=
s6-linkname: src/skaembutils/s6-linkname.o -lskarnet
s6-ln: private EXTRA_LIBS := ${SOCKET_LIB} ${TAINNOW_LIB}
diff --git a/package/info b/package/info
index 9ea8651..150bf47 100644
--- a/package/info
+++ b/package/info
@@ -1,4 +1,4 @@
package=s6-portable-utils
-version=2.0.1.0
+version=2.0.2.0
category=admin
package_macro_name=S6_PORTABLE_UTILS
diff --git a/package/modes b/package/modes
index 2e8bf85..2704081 100644
--- a/package/modes
+++ b/package/modes
@@ -12,6 +12,7 @@ s6-false 0755
s6-format-filter 0755
s6-grep 0755
s6-head 0755
+s6-hiercopy 0755
s6-linkname 0755
s6-ln 0755
s6-ls 0755
diff --git a/package/targets.mak b/package/targets.mak
index 09fe7b1..ffdd6f0 100644
--- a/package/targets.mak
+++ b/package/targets.mak
@@ -13,6 +13,7 @@ s6-false \
s6-format-filter \
s6-grep \
s6-head \
+s6-hiercopy \
s6-linkname \
s6-ln \
s6-ls \
diff --git a/src/skaembutils/deps-exe/s6-hiercopy b/src/skaembutils/deps-exe/s6-hiercopy
new file mode 100644
index 0000000..e7187fe
--- /dev/null
+++ b/src/skaembutils/deps-exe/s6-hiercopy
@@ -0,0 +1 @@
+-lskarnet
diff --git a/src/skaembutils/s6-hiercopy.c b/src/skaembutils/s6-hiercopy.c
new file mode 100644
index 0000000..9ba3fd5
--- /dev/null
+++ b/src/skaembutils/s6-hiercopy.c
@@ -0,0 +1,17 @@
+/* ISC license. */
+
+#include <sys/stat.h>
+#include <skalibs/strerr2.h>
+#include <skalibs/djbunix.h>
+
+#define USAGE "s6-hiercopy src dst"
+
+int main (int argc, char const *const *argv)
+{
+ PROG = "s6-hiercopy" ;
+ if (argc < 3) strerr_dieusage(100, USAGE) ;
+ umask(0) ;
+ if (!hiercopy(argv[1], argv[2]))
+ strerr_diefu4sys(111, "copy hierarchy from ", argv[1], " to ", argv[2]) ;
+ return 0 ;
+}