about summary refs log tree commit diff
path: root/doc/s6-hiercopy.html
blob: e8dd2ed884529958e03a9542048fdc5fcd14386a (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
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="Content-Language" content="en" />
    <title>s6-linux-utils: the s6-hiercopy program</title>
    <meta name="Description" content="s6-linux-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-linux-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>

<p>
 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 just impossible to
design, much less write, such a utility.
</p>

<ul>
 <li> You can't make it portable because there's no universal standard.
There is no portable way of creating device special files, for instance.
So <tt>s6-hiercopy</tt> appears here instead of in
<a href="http://skarnet.org/software/s6-portable-utils/">s6-portable-utils</a>:
the platform where I needed that kind of tool is Linux. </li>
 <li> You can't 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 -a</tt> shouldn't either. </li>
</ul>

</body>
</html>