about summary refs log tree commit diff
path: root/doc/s6-hiercopy.html
blob: 43fdc13d7fb568ab05682d3e60ae6de62eaa617a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <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="//skarnet.org/default.css" /> -->
  </head>
<body>

<p>
<a href="index.html">s6-portable-utils</a><br />
<a href="//skarnet.org/software/">Software</a><br />
<a href="//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="https://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="//skarnet.org/software/s6-linux-utils/">s6-linux-utils</a>
to s6-portable-utils. </li>
</ul>

</body>
</html>